From d97e486fb43db64a601b5cd3d0c7c17c2199a279 Mon Sep 17 00:00:00 2001 From: Cheryl Foil Date: Tue, 1 Jul 2008 21:02:36 +0000 Subject: [PATCH 001/314] Small modifications to place comments into the parse tree (Fairly inflexible at the moment) git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2008-cherylfoil@10620 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Source/CParse/cscanner.c | 10 ++++++++++ Source/CParse/parser.y | 33 ++++++++++++++++++++++++++++++++- 2 files changed, 42 insertions(+), 1 deletion(-) diff --git a/Source/CParse/cscanner.c b/Source/CParse/cscanner.c index 2a0d341b5..140b7fedd 100644 --- a/Source/CParse/cscanner.c +++ b/Source/CParse/cscanner.c @@ -426,6 +426,14 @@ int yylook(void) { if ((strncmp(loc,"/*@SWIG@",6) == 0) && (loc[Len(cmt)-3] == '@')) { scanner_locator(cmt); } + + if (strncmp(loc, "/**", 3) == 0 || strncmp(loc, "///", 3) == 0||strncmp(loc, "/*!", 3) == 0||strncmp(loc, "//!", 3) == 0) { + printf("Doxygen Comment: %s lines %d-%d [%s]\n", Char(Scanner_file(scan)), Scanner_start_line(scan), Scanner_line(scan), loc); + yylval.str = NewString(loc); + return DOXYGENSTRING; + } + + } break; case SWIG_TOKEN_ENDLINE: @@ -897,6 +905,8 @@ int yylex(void) { return (ID); case POUND: return yylex(); + case SWIG_TOKEN_COMMENT: + return yylex(); default: return (l); } diff --git a/Source/CParse/parser.y b/Source/CParse/parser.y index 4fe8b47ed..6a835c7f3 100644 --- a/Source/CParse/parser.y +++ b/Source/CParse/parser.y @@ -55,6 +55,14 @@ static int max_class_levels = 0; static int class_level = 0; static Node **class_decl = NULL; +/* ----------------------------------------------------------------------------- + * Doxygen Comment Globals + * ----------------------------------------------------------------------------- */ + +int isComment = 0; /* boolean for parsing Doxygen Comments */ +String *currentComment = 0; /* Location of the stored Doxygen Comment */ +static String *sideDoxComments = 0; + /* ----------------------------------------------------------------------------- * Assist Functions * ----------------------------------------------------------------------------- */ @@ -71,6 +79,12 @@ static Node *new_node(const String_or_char *tag) { set_nodeType(n,tag); Setfile(n,cparse_file); Setline(n,cparse_line); + /* Sets Comment if a Comment is Availible */ + if(isComment){ + String *copyComment = Copy(currentComment); + Setattr(n,"comment",copyComment); + isComment = 0; + } return n; } @@ -1440,6 +1454,7 @@ static void tag_nodes(Node *n, const String_or_char *attrname, DOH *value) { %token OPERATOR %token COPERATOR %token PARSETYPE PARSEPARM PARSEPARMS +%token DOXYGENSTRING %left CAST %left QUESTIONMARK @@ -1511,6 +1526,7 @@ static void tag_nodes(Node *n, const String_or_char *attrname, DOH *value) { %type type_specifier primitive_type_list ; %type fname stringtype; %type featattr; +%type doxygen_comment; %% @@ -1568,6 +1584,7 @@ interface : interface declaration { declaration : swig_directive { $$ = $1; } | c_declaration { $$ = $1; } | cpp_declaration { $$ = $1; } + | doxygen_comment { $$ = $1; } | SEMI { $$ = 0; } | error { $$ = 0; @@ -2811,6 +2828,7 @@ warn_directive : WARN string { } ; + /* ====================================================================== * C Parsing * ====================================================================== */ @@ -3132,6 +3150,20 @@ c_constructor_decl : storage_class type LPAREN parms RPAREN ctor_end { } ; +/* ------------------------------------------------------------ + A Doxygen Comment (a string in Doxygen Format) + ------------------------------------------------------------ */ + +doxygen_comment : DOXYGENSTRING + { + currentComment = NewString($1); + isComment = 1; + $$ = 0; + } + ; + + + /* ====================================================================== * C++ Support * ====================================================================== */ @@ -5977,4 +6009,3 @@ ParmList *Swig_cparse_parms(String *s) { /* Printf(stdout,"typeparse: '%s' ---> '%s'\n", s, top); */ return top; } - From 848e1b55fc8edb487e9b654b6cf7d3a55f1937ee Mon Sep 17 00:00:00 2001 From: Cheryl Foil Date: Tue, 1 Jul 2008 22:06:28 +0000 Subject: [PATCH 002/314] 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; +%} From af125cd25151eaca3f96098c418326edf7a957c6 Mon Sep 17 00:00:00 2001 From: Cheryl Foil Date: Mon, 7 Jul 2008 02:59:22 +0000 Subject: [PATCH 003/314] Major overhaul to the basic structure of this parser, currently still sensitive and buggy. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2008-cherylfoil@10654 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Source/DoxygenTranslator/DoxygenEntity.cpp | 17 +- Source/DoxygenTranslator/DoxygenEntity.h | 10 +- .../DoxygenTranslator/DoxygenTranslator.cpp | 665 +++++++++++++++--- 3 files changed, 573 insertions(+), 119 deletions(-) diff --git a/Source/DoxygenTranslator/DoxygenEntity.cpp b/Source/DoxygenTranslator/DoxygenEntity.cpp index 9b02ade12..cd192601e 100644 --- a/Source/DoxygenTranslator/DoxygenEntity.cpp +++ b/Source/DoxygenTranslator/DoxygenEntity.cpp @@ -30,13 +30,13 @@ string findCommand(int commandNum){ int arraySize = sizeof(commandArray2)/sizeof(*commandArray2); if (commandNum - 101 >= 0 && commandNum - 101 < arraySize){ - return commandArray2[commandNum]; + return commandArray2[commandNum - 101]; } return "" ; } -DoxygenEntity::DoxygenEntity(int typeEnt){ +DoxygenEntity::DoxygenEntity(string typeEnt){ typeOfEntity = typeEnt; data = ""; isLeaf = 1; @@ -47,7 +47,7 @@ DoxygenEntity::DoxygenEntity(int typeEnt){ * example: \b word * OR holding a string */ -DoxygenEntity::DoxygenEntity(int typeEnt, string param1){ +DoxygenEntity::DoxygenEntity(string typeEnt, string param1){ typeOfEntity = typeEnt; data = param1; isLeaf = 1; @@ -56,7 +56,7 @@ DoxygenEntity::DoxygenEntity(int typeEnt, string param1){ /* Nonterminal node * contains */ -DoxygenEntity::DoxygenEntity(int typeEnt, list entList){ +DoxygenEntity::DoxygenEntity(string typeEnt, list entList){ typeOfEntity = typeEnt; data = ""; isLeaf = 0; @@ -64,16 +64,19 @@ DoxygenEntity::DoxygenEntity(int typeEnt, list entList){ } -void DoxygenEntity::printEntity(){ +void DoxygenEntity::printEntity(int level){ if (isLeaf) { - cout << "Node Command: " << findCommand(typeOfEntity); + for (int i = 0; i < level; i++) {cout << "\t";} + cout << "Node Command: " << typeOfEntity << " "; if (data.compare("") != 0) cout << "Node Data: " << data; cout << endl; } else{ + cout << "Node Command : " << typeOfEntity << endl; list::iterator p = entityList.begin(); + level++; while (p != entityList.end()){ - (*p).printEntity(); + (*p).printEntity(level); p++; } } diff --git a/Source/DoxygenTranslator/DoxygenEntity.h b/Source/DoxygenTranslator/DoxygenEntity.h index 8330e4507..a0a99ed70 100644 --- a/Source/DoxygenTranslator/DoxygenEntity.h +++ b/Source/DoxygenTranslator/DoxygenEntity.h @@ -9,12 +9,12 @@ using namespace std; class DoxygenEntity{ public: - DoxygenEntity(int typeEnt); - DoxygenEntity(int typeEnt, string param1); - DoxygenEntity(int typeEnt, list entList); + DoxygenEntity(string typeEnt); + DoxygenEntity(string typeEnt, string param1); + DoxygenEntity(string typeEnt, list entList); virtual ~DoxygenEntity(); - void printEntity(); - int typeOfEntity; + void printEntity(int level); + string typeOfEntity; list entityList; string data; int isLeaf; diff --git a/Source/DoxygenTranslator/DoxygenTranslator.cpp b/Source/DoxygenTranslator/DoxygenTranslator.cpp index dadea41b5..e2fdaef8a 100644 --- a/Source/DoxygenTranslator/DoxygenTranslator.cpp +++ b/Source/DoxygenTranslator/DoxygenTranslator.cpp @@ -22,9 +22,10 @@ to test. */ //int testCommandParsingFunctions = 1;// not implemented -int testCodeCrawlingFunctions = 1; -int demonstrateParsing = 0; - +int testCodeCrawlingFunctions = 0; +int demonstrateParsing = 1; +int noisy = 1; // set this to 1 for extra chatter from the parsing stage. +int addCommand(string commandName, int &startInd, list &doxyList, string doxygenString); ////////////////////////////////////////// @@ -50,7 +51,7 @@ string commandArray[] = {"a", "addindex", "addtogroup", "anchor", "arg", "attent "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(1, 92), string(1, '&'), "~", "<", ">", string(1, '#'), "%"}; string sectionIndicators[] = { "attention", "author", "brief", "bug", "cond", "date", "deprecated", "details", @@ -58,12 +59,35 @@ string sectionIndicators[] = { "attention", "author", "brief", "bug", "cond", "d "tparam", "post" , "pre", "remarks", "return", "retval", "sa", "see", "since", "test", "throw", "todo", "version", "warning", "xrefitem" }; +/* All of the doxygen commands divided up by how they are parsed */ +string simpleCommands[] = {"n", "$", "@", string(1, 92), string(1, '&'), "~", "<", ">", string(1, '#'), "%"}; +string ignoredSimpleCommands[] = {"nothing at the moment"}; +string commandWords[] = {"a", "b", "c", "e", "em", "p", "def", "enum", "example", "package", + "relates", "namespace", "relatesalso","anchor", "dontinclude", "include", "includelineno"}; +string ignoredCommandWords[] = {"copydoc", "copybrief", "copydetails", "verbinclude", "htmlinclude"}; +string commandLines[] = {"addindex", "fn", "name", "line", "var", "skipline", "typedef", "skip", "until", "property"}; +string ignoreCommandLines[] = {"nothing at the moment"}; +string commandParagraph[] = {"return", "remarks", "since", "test", "sa", "see", "pre", "post", "details", "invariant", + "deprecated", "date", "note", "warning", "version", "todo", "bug", "attention", "brief", "arg", "author"}; +string ignoreCommandParagraphs[] = {"nothing at the moment"}; +string commandEndCommands[] = {"code", "dot", "msc", "f$", "f[", "f{environment}{", "htmlonly", "latexonly", "manonly", + "verbatim", "xmlonly", "cond", "if", "ifnot", "link"}; +string commandWordParagraphs[] = {"param", "tparam", "throw", "retval", "exception"}; +string commandWordLines[] = {"page", "subsection", "subsubsection", "section", "paragraph", "defgroup"}; +string commandWordOWordOWords [] = {"category", "class", "protocol", "interface", "struct", "union"}; +string commandOWords[] = {"dir", "file", "cond"}; +string commandErrorThrowings[] = {"annotatedclasslist", "classhierarchy", "define", "functionindex", "header", + "headerfilelist", "inherit", "l", "postheader", "private", "privatesection", "protected", + "protectedsection", "public", "publicsection", "endcode", "enddot", "endmsc", "endhtmlonly", + "endlatexonly", "endmanonly", "endlink", "endverbatim", "endxmlonly", "f]", "f}", "endcond", + "endif"}; +string commandUniques[] = {"xrefitem", "ingroup", "par", "headerfile", "overload", "weakgroup", "ref", + "subpage", "dotfile", "image", "addtogroup", "li"}; int startIndex = 0; int endIndex = 0; int isNewLine = 0; - - string doxygenString = ""; + //string doxygenString = ""; int briefDescExists = 0; /* Entity list is the root list. @@ -99,6 +123,61 @@ string sectionIndicators[] = { "attention", "author", "brief", "bug", "cond", "d } return -1; } + + int commandBelongs(string theCommand){ + string smallString = StringToLower(theCommand ); + //cout << " Looking for command " << theCommand << endl; + int i = 0; + for ( i = 0; i < sizeof(simpleCommands)/sizeof(*simpleCommands); i++){ + if(smallString.compare(simpleCommands[i]) == 0){return 1;} + } + for ( i = 0; i < sizeof(ignoredSimpleCommands)/sizeof(*ignoredSimpleCommands); i++){ + if(smallString.compare(ignoredSimpleCommands[i]) == 0){return 2;} + } + for ( i = 0; i < sizeof(commandWords)/sizeof(*commandWords); i++){ + if(smallString.compare( commandWords[i]) == 0){return 3;} + } + for ( i = 0; i < sizeof(ignoredCommandWords)/sizeof(*ignoredCommandWords); i++){ + if(smallString.compare( ignoredCommandWords[i]) == 0){return 4;} + } + for ( i = 0; i < sizeof(commandLines)/sizeof(*commandLines); i++){ + if(smallString.compare( commandLines[i]) == 0){return 5;} + } + for ( i = 0; i < sizeof(ignoreCommandLines)/sizeof(*ignoreCommandLines); i++){ + if(smallString.compare( ignoreCommandLines[i]) == 0){return 6;} + } + for ( i = 0; i < sizeof(commandParagraph)/sizeof(*commandParagraph); i++){ + if(smallString.compare( commandParagraph[i]) == 0){return 7;} + } + /* IgnoreCommandParagraph */ + for ( i = 0; i < sizeof(ignoreCommandParagraphs)/sizeof(*ignoreCommandParagraphs); i++){ + if(smallString.compare( ignoreCommandParagraphs[i]) == 0){return 8;} + } + for ( i = 0; i < sizeof(commandEndCommands)/sizeof(*commandEndCommands); i++){ + if(smallString.compare( commandEndCommands[i]) == 0){return 9;} + } + for ( i = 0; i < sizeof(commandWordParagraphs)/sizeof(*commandWordParagraphs); i++){ + if(smallString.compare( commandWordParagraphs[i]) == 0){return 10;} + } + for ( i = 0; i < sizeof(commandWordLines)/sizeof(*commandWordLines); i++){ + if(smallString.compare( commandWordLines[i]) == 0){return 11;} + } + for ( i = 0; i < sizeof(commandWordOWordOWords)/sizeof(*commandWordOWordOWords); i++){ + if(smallString.compare( commandWordOWordOWords[i]) == 0){return 12;} + } + for ( i = 0; i < sizeof(commandOWords)/sizeof(*commandOWords); i++){ + if(smallString.compare( commandOWords[i]) == 0){return 13;} + } + for ( i = 0; i < sizeof(commandErrorThrowings)/sizeof(*commandErrorThrowings); i++){ + if(smallString.compare( commandErrorThrowings[i]) == 0){return 14;} + } + for ( i = 0; i < sizeof(commandUniques)/sizeof(*commandUniques); i++){ + if(smallString.compare( commandUniques[i]) == 0){return 15;} + } + + return 0; + + } /* isSectionIndicator returns a boolean if the command is a section indicator * This is a helper method for finding the end of a paragraph @@ -123,7 +202,7 @@ string sectionIndicators[] = { "attention", "author", "brief", "bug", "cond", "d /* Tiny method to compartmentalise the removal of all optional comment fluff such as /// * or **** that often occurs before commment blobs. */ - int clearFluff(int startInd){ + int clearFluff(int &startInd, string doxygenString){ int startIndex = startInd; int amountRemoved = 0; @@ -132,7 +211,7 @@ string sectionIndicators[] = { "attention", "author", "brief", "bug", "cond", "d startIndex++; amountRemoved++; } - + startInd = startIndex; return startIndex; } @@ -141,13 +220,13 @@ string sectionIndicators[] = { "attention", "author", "brief", "bug", "cond", "d * Updates the index it is given after completion. */ - string getNextWord(int &startInd){ + string getNextWord(int &startInd, string doxygenString){ int startIndex = startInd; string nextWord = ""; - while (doxygenString[startIndex] == '/'|| doxygenString[startIndex] == ' ' + while (startIndex < doxygenString.length() && (doxygenString[startIndex] == '/'|| doxygenString[startIndex] == ' ' || doxygenString[startIndex] == '*' || doxygenString[startIndex]== '\n' - || doxygenString[startIndex] == '!'){ - if(doxygenString[startIndex]== '\n') return nextWord; + || doxygenString[startIndex] == '!')){ + if(doxygenString[startIndex]== '\n'){ startInd = startIndex; return nextWord;} startIndex++; //cout << "Start Index" << startIndex << endl; } @@ -168,7 +247,7 @@ string sectionIndicators[] = { "attention", "author", "brief", "bug", "cond", "d * and moved the index to the NEXT line * returns "" if nothing on the current line. */ - string getOneLine(int &startInd){ + string getOneLine(int &startInd, string doxygenString){ int startIndex = startInd; while (doxygenString[startIndex] == '/'|| doxygenString[startIndex] == ' ' || doxygenString[startIndex] == '*' || doxygenString[startIndex]== '\n' @@ -187,13 +266,11 @@ string sectionIndicators[] = { "attention", "author", "brief", "bug", "cond", "d startInd = endIndex; return returnedLine; } - -/* Returns a Paragraph- defined in Doxygen to be a paragraph of text - * seperate by either a structural command or a blank line - * This method is VERY messy currently +/* Returns a properly formatted (all doxygen *, //! etc removed) + * up til ANY command or end of paragraph is encountered. Has all the same issues as + * getStringTilEndOfParagraph formatting wise. */ - //TODO fix getStringTilEndOfParagraph to be more forgiving, work on ' ' characters - string getStringTilEndOfParagraph(int &startInd){ +string getStringTilCommand(int &startInd, string doxygenString){ if (startInd >= doxygenString.length()) return ""; int startIndex = startInd; int endIndex = startInd; @@ -203,8 +280,89 @@ string sectionIndicators[] = { "attention", "author", "brief", "bug", "cond", "d int spareIndex = 0; int counter; int finalIndex; - while(keepLooping && endIndex < doxygenString.length()){ - if (doxygenString[endIndex] == '\n'){ + while(keepLooping){ + if(endIndex >= doxygenString.length()){ + finalIndex = endIndex; + keepLooping = 0; + } + else 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] == '@'){ + finalIndex = endIndex; + keepLooping = 0; + } + else if(endIndex < doxygenString.length() -2 + && string("**/").compare(doxygenString.substr(endIndex , endIndex + 2)) == 0){ + finalIndex = endIndex; + //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]; + } + //if(noisy) cout << "Final Index is: " << finalIndex << endl; + startInd = finalIndex; + return description; + } + + +/* Returns a Paragraph- defined in Doxygen to be a paragraph of text + * seperate by either a structural command or a blank line + * This method is VERY messy currently + */ + //TODO fix getStringTilEndOfParagraph to be more forgiving, work on ' ' characters + string getStringTilEndOfParagraph(int &startInd, string doxygenString){ + if (startInd >= 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){ + if(endIndex >= doxygenString.length()){ + finalIndex = endIndex; + keepLooping = 0; + } + else if (doxygenString[endIndex] == '\n'){ //cout << "1 "; counter = endIndex; if ( keepLooping && endIndex < doxygenString.length()-1) { @@ -226,7 +384,7 @@ string sectionIndicators[] = { "attention", "author", "brief", "bug", "cond", "d else if (doxygenString[endIndex] == 92 || doxygenString[endIndex] == '@'){ //cout << "2 "; spareIndex = endIndex; - if (isSectionIndicator(getNextWord(spareIndex))) keepLooping = 0; + if (isSectionIndicator(getNextWord(spareIndex, doxygenString))) keepLooping = 0; } else if(endIndex < doxygenString.length() - 1 && string("*/").compare(doxygenString.substr(endIndex , endIndex + 1)) == 0){ @@ -266,7 +424,7 @@ string sectionIndicators[] = { "attention", "author", "brief", "bug", "cond", "d * 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){ + int progressTilEndCommand(string theCommand, int &startInd, string doxygenString){ endIndex = startInd; while (endIndex < doxygenString.length()){ if (doxygenString[endIndex] == 92 || doxygenString[endIndex] == '@'){ @@ -282,7 +440,7 @@ string sectionIndicators[] = { "attention", "author", "brief", "bug", "cond", "d return 0; } - string getStringTilAnyCommand(string theCommand, int &startInd){ + string getStringTilAnyCommand(string theCommand, int &startInd, string doxygenString){ endIndex = startInd; startIndex = startInd; int keepLooping = 1; @@ -319,15 +477,17 @@ string sectionIndicators[] = { "attention", "author", "brief", "bug", "cond", "d * differs wildly */ int testClearFluff(){ - + string doxygenString = ""; string cases[] = {"/** WORD", "/*! WORD", "/******* WORD", "///// WORD", "//! WORD", "//! WORD", "///WORD", "/**\nWORD", "/**\n*WORD", "/** \n WORD"}; int testPassed = 1; + int placement = 0; int casesSize = sizeof(cases)/sizeof(*cases); for (int i = 0; i < casesSize; i++){ + placement = 0; doxygenString = cases[i]; - if(cases[i][clearFluff(0)] != 'W'){ - cout << "ClearFluff failed for string :" << doxygenString << "\t Displayed :" << cases[i][clearFluff(0)] << ": Instead." << endl; + if(cases[i][clearFluff(placement, doxygenString)] != 'W'){ + cout << "ClearFluff failed for string :" << doxygenString << "\t Displayed :" << cases[i][clearFluff(placement = 0, doxygenString)] << ": Instead." << endl; testPassed = 0; } } @@ -338,6 +498,7 @@ string sectionIndicators[] = { "attention", "author", "brief", "bug", "cond", "d }; int testGetNextWord(){ + string doxygenString = ""; string cases[] = {"/** WORD ", " * WORD ", "///!WORD ", " WORD ", "//! WORD ", " * WORD ", "*WORD "}; int testPassed = 1; string testWord = ""; @@ -346,7 +507,7 @@ string sectionIndicators[] = { "attention", "author", "brief", "bug", "cond", "d for (int i = 0; i < casesSize; i++){ doxygenString = cases[i]; placement = 0; - testWord = getNextWord(placement); + testWord = getNextWord(placement, doxygenString); if(testWord.compare("WORD") != 0){ cout << "GetNextWord failed for string :" << doxygenString << "\t Displayed :" << testWord << ": Instead." << endl; testPassed = 0; @@ -355,7 +516,7 @@ string sectionIndicators[] = { "attention", "author", "brief", "bug", "cond", "d } placement = 0; doxygenString = " * @WORD "; - testWord = getNextWord(placement); + testWord = getNextWord(placement, doxygenString); if(testWord.compare("@WORD") != 0){ cout << "GetNextWord failed for string :" << doxygenString << "\t Displayed :" << testWord << ": Instead." << endl; @@ -369,7 +530,7 @@ string sectionIndicators[] = { "attention", "author", "brief", "bug", "cond", "d commandWord = commandWord + "WORD"; doxygenString = testWord; placement = 0; - testWord = getNextWord(placement); + testWord = getNextWord(placement, doxygenString); if(testWord.compare(commandWord) != 0){ cout << "GetNextWord failed for string :" << doxygenString << "\t Displayed :" << testWord << ": Instead." << endl; @@ -377,38 +538,38 @@ string sectionIndicators[] = { "attention", "author", "brief", "bug", "cond", "d //else cout << "GetNextWord passed for string :" << doxygenString << endl; doxygenString = "WORD ANOTHER WORD1 WORD2 \n"; placement = 0; - testWord = getNextWord(placement); + testWord = getNextWord(placement, doxygenString); 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); + testWord = getNextWord(placement, doxygenString); 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); + testWord = getNextWord(placement, doxygenString); 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); + testWord = getNextWord(placement, doxygenString); 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); + testWord = getNextWord(placement, doxygenString); 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); + testWord = getNextWord(placement, doxygenString); if(testWord.compare("") != 0){ cout << "GetNextWord failed for string :" << doxygenString << "\t Displayed :" << testWord << ": Instead." << endl; @@ -420,6 +581,7 @@ string sectionIndicators[] = { "attention", "author", "brief", "bug", "cond", "d } int testGetOneLine(){ + string doxygenString = ""; string cases[] = {" * Crop this sentence after this period.\n", " * Crop this sentence after this period.\n", "Crop this sentence after this period.\n", @@ -433,7 +595,7 @@ string sectionIndicators[] = { "attention", "author", "brief", "bug", "cond", "d for (int i = 0; i < casesSize; i++){ doxygenString = cases[i]; placement = 0; - testWord = getOneLine(placement); + testWord = getOneLine(placement, doxygenString); if(testWord.compare("Crop this sentence after this period.") != 0){ cout << "GetOneLine failed for string :" << doxygenString << "\t Displayed :" << testWord << ": Instead." << endl; testPassed = 0; @@ -441,17 +603,17 @@ string sectionIndicators[] = { "attention", "author", "brief", "bug", "cond", "d } doxygenString = ("Get this line.\n * Now get this line."); placement = 0; - testWord = getOneLine(placement); + testWord = getOneLine(placement, doxygenString); if(testWord.compare("Get this line.") != 0){ cout << "GetOneLine failed for string :" << doxygenString << "\t Displayed :" << testWord << ": Instead." << endl; testPassed = 0; } - testWord = getOneLine(placement); + testWord = getOneLine(placement, doxygenString); if(testWord.compare("Now get this line.") != 0){ cout << "GetOneLine failed for string :" << doxygenString << "\t Displayed :" << testWord << ": Instead." << endl; testPassed = 0; } - testWord = getOneLine(placement); + testWord = getOneLine(placement, doxygenString); if(testWord.compare("") != 0){ cout << "GetOneLine failed for string :" << doxygenString << "\t Displayed :" << testWord << ": Instead." << endl; testPassed = 0; @@ -463,17 +625,18 @@ string sectionIndicators[] = { "attention", "author", "brief", "bug", "cond", "d } //TODO Flesh testGetStringTilEndOfParagraph out, fix weird spacing problems int testGetStringTilEndOfParagraph(){ + string doxygenString = ""; 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); + testParagraph = getStringTilEndOfParagraph(placement, doxygenString); 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); + testParagraph = getStringTilEndOfParagraph(placement, doxygenString); //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; @@ -487,25 +650,42 @@ string sectionIndicators[] = { "attention", "author", "brief", "bug", "cond", "d doxygenString.push_back(92); doxygenString += "author cheryl foil \n\n **/"; placement = 0; - testParagraph = getStringTilEndOfParagraph(placement); + testParagraph = getStringTilEndOfParagraph(placement, doxygenString); 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; + if(testPassed) cout << "+++GetGetStringTilEndOfParagraph passed for all tests+++\n" << endl; + else cout << "+++GetGetStringTilEndOfParagraphFAILED+++\n" << endl; return testPassed; } + int testGetStringTilCommand(){ + string doxygenString = ""; + int placement = 0; + int testPassed = 1; + string testParagraph; + doxygenString = ("/* This is a description,\n * thus it continues on\n * for several @b lines.\n\n This Shouldn't be included.\n\n **/"); + testParagraph = getStringTilCommand(placement, doxygenString); + if( testParagraph.compare("This is a description, thus it continues on for several ") != 0){ + cout << "GetOneLine failed for string :" << doxygenString << "\t Displayed :" << testParagraph << ": Instead." << endl; + testPassed = 0; + } + if(testPassed) cout << "+++GetStringTilCommand passed for all tests+++\n" << endl; + else cout << "+++GetStringTilCommand FAILED+++\n" << endl; + return testPassed; + + } int testProgressTilEndCommand(){ + string doxygenString = ""; 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); + progressTilEndCommand("endcode", placement, doxygenString); //cout << "Placement : " << placement << endl; if( doxygenString[placement] != 'S'){ cout << "GetOneLine failed for string :" << doxygenString << "\n\t Displayed :" << testParagraph << ": Instead." << endl; @@ -532,6 +712,8 @@ string sectionIndicators[] = { "attention", "author", "brief", "bug", "cond", "d cout << "Testing progressTilEndCommand" << endl; testProgressTilEndCommand(); + cout << "Testing GetStringTilCommand" << endl; + testGetStringTilCommand(); return 1; } @@ -542,88 +724,357 @@ string sectionIndicators[] = { "attention", "author", "brief", "bug", "cond", "d list::iterator p = rootList.begin(); while (p != rootList.end()){ - (*p).printEntity(); + (*p).printEntity(0); p++; } } + + + + list parse(int startInd, string doxygenString){ + string currWord = ""; + int startIndex = startInd; + int savedIndex; + list aNewList; + endIndex = doxygenString.length(); + int currCommand; + while (startIndex < endIndex){ + savedIndex = startIndex; + currWord = getNextWord(startIndex, doxygenString); + if(noisy) cout << "Parsing for phrase starting in:" << currWord << endl; + if(currWord == ""){ + if (startIndex < endIndex) startIndex++; + } + else if(currWord[0] == 92 || currWord[0] == '@'){ + currWord = currWord.substr(1, currWord.length() - 1); + currCommand = findCommand(currWord); + if (currCommand < 0 ){ cout << "BAD COMMAND: " << currWord << endl; exit(1);} + //cout << "Command: " << currWord << " " << currCommand << endl; + addCommand(currWord, startIndex, aNewList, doxygenString); + } + else{ + startIndex = savedIndex; + addCommand(string("plainstring"), startIndex, aNewList, doxygenString); + + } + } + + return aNewList; + } + + /* Method for Adding a Simple Command + * Format: @command + * Plain commands, such as newline etc, they contain no other data + * \n \\ \@ \& \$ \# \< \> \% + */ + int addSimpleCommand(string theCommand, int &startInd, list &doxyList, string doxygenString){ + + if (noisy) cout << "Parsing " << theCommand << endl; + doxyList.push_back(DoxygenEntity(theCommand)); + return 1; + } + + /* NOT INCLUDED Simple Commands + * Format: @command + * Plain commands, such as newline etc, they contain no other data + */ + int ignoreSimpleCommand(string theCommand, int &startInd, list &doxyList, string doxygenString){ + + if (noisy) cout << "Not Adding " << theCommand << endl; + return 1; + //doxyList.push_back(DoxygenEntity(108)); + } + + /* CommandWord + * Format: @command + * Commands with a single WORD after then such as @b + * "a", "b", "c", "e", "em", "p", "def", "enum", "example", "package", + * "relates", "namespace", "relatesalso","anchor", "dontinclude", "include", "includelineno" + */ + int addCommandWord(string theCommand, int &startInd, list &doxyList, string doxygenString){ + if (noisy) cout << "Parsing " << theCommand << endl; + string name = getNextWord(startInd, doxygenString); + if (!name.empty()){ + doxyList.push_back(DoxygenEntity(theCommand, name)); + return 1; + } + else cout << "No word followed " << theCommand << " command. Not added" << endl; + return 0; + } + /* NOT INCLUDED CommandWord + * Format: @command + * Commands with a single WORD after then such as @b + * "copydoc", "copybrief", "copydetails", "verbinclude", "htmlinclude" + */ + int ignoreCommandWord(string theCommand, int &startInd, list &doxyList, string doxygenString){ + if (noisy) cout << "Not Adding " << theCommand << endl; + string name = getNextWord(startInd, doxygenString); + if (!name.empty()){ + return 1; + } + else cout << "WARNING: No word followed " << theCommand << " command." << endl; + return 0; + } + + /* CommandLine + * Format: @command (line) + * Commands with a single LINE after then such as @var + * "addindex", "fn", "name", "line", "var", "skipline", "typedef", "skip", "until", "property" + */ + int addCommandLine(string theCommand, int &startInd, list &doxyList, string doxygenString){ + if (noisy) cout << "Parsing " << theCommand << endl; + string line = getOneLine(startInd, doxygenString); + if(!line.empty()){ + int placement = 0; + list aNewList; + aNewList = parse(placement, line); + doxyList.push_back( DoxygenEntity(theCommand, aNewList)); + return 1; + } + else cout << "No line followed " << theCommand << " command. Not added" << endl; + return 0; + } + + /* NOT INCLUDED CommandLine + * Format: @command (line) + * Commands with a single LINE after then such as @var + * + */ + int ignoreCommandLine(string theCommand, int &startInd, list &doxyList, string doxygenString){ + if (noisy) cout << "Not Adding " << theCommand << endl; + string line = getOneLine(startInd, doxygenString); + if(!line.empty()){ + return 1; + } + else cout << "WARNING: No line followed " << theCommand << " command." << endl; + return 0; + } + + /* CommandParagraph + * Format: @command {paragraph} + * Commands with a single paragraph after then such as @return + * "return", "remarks", "since", "test", "sa", "see", "pre", "post", "details", "invariant", + * "deprecated", "date", "note", "warning", "version", "todo", "bug", "attention", "brief", "arg", "author" + */ + int addCommandParagraph(string theCommand, int &startInd, list &doxyList, string doxygenString){ + if (noisy) cout << "Parsing " << theCommand << endl; + string restOfParagraph = getStringTilEndOfParagraph(startInd, doxygenString); + if(!restOfParagraph.empty()){ + int placement = 0; + list aNewList; + aNewList = parse(placement, restOfParagraph); + doxyList.push_back( DoxygenEntity(theCommand, aNewList)); + return 1; + } + else cout << "No line followed " << theCommand << " command. Not added" << endl; + return 0; + } + /* CommandParagraph + * Format: @command {paragraph} + * Commands with a single LINE after then such as @var + * + */ + int ignoreCommandParagraph(string theCommand, int &startInd, list &doxyList, string doxygenString){ + if (noisy) cout << "Not Adding " << theCommand << endl; + string restOfParagraph = getStringTilEndOfParagraph(startInd, doxygenString); + if(!restOfParagraph.empty()){ + return 1; + } + else cout << "WARNING: No line followed " << theCommand << " command." << endl; + return 0; + } + /* Command EndCommand + * Format: @command and ends at @endcommand + * Commands that take in a block of text such as @code + * "code", "dot", "msc", "f$", "f[", "f{environment}{", "htmlonly", "latexonly", "manonly", + * "verbatim", "xmlonly", "cond", "if", "ifnot", "link" + * Returns 1 if success, 0 if the endcommand is never encountered. + */ + + int ignoreCommandEndCommand(string theCommand, int &startInd, list &doxyList, string doxygenString){ + if (noisy) cout << "Not Adding " << theCommand << endl; + return progressTilEndCommand( "end" + theCommand, startInd, doxygenString); + + } + + /* CommandWordParagraph + * Format: @command {paragraph} + * Commands such as param + * "param", "tparam", "throw", "retval", "exception" + */ + int addCommandWordParagraph(string theCommand, int &startInd, list &doxyList, string doxygenString){ + if (noisy) cout << "Parsing " << theCommand << endl; + string name = getNextWord(startInd, doxygenString); + if (name.empty()){ + cout << "No word followed " << theCommand << " command. Not added" << endl; + return 0; + } + string restOfParagraph = getStringTilEndOfParagraph(startInd, doxygenString); + int placement = 0; + if(!restOfParagraph.empty()){ + list aNewList; + aNewList = parse(placement, restOfParagraph); + aNewList.push_front(DoxygenEntity("plainstring", name)); + doxyList.push_back(DoxygenEntity(theCommand, aNewList)); + return 1; + } + else cout << "No paragraph followed " << theCommand << " command. Not added" << endl; + return 0; + } + /* CommandWordLine + * Format: @command (line) + * Commands such as param + * "page", "subsection", "subsubsection", "section", "paragraph", "defgroup" + */ + int addCommandWordLine(string theCommand, int &startInd, list &doxyList, string doxygenString){ + if (noisy) cout << "Parsing " << theCommand << endl; + string name = getNextWord(startInd, doxygenString); + if (name.empty()){ + cout << "No word followed " << theCommand << " command. Not added" << endl; + return 0; + } + string restOfLine = getStringTilEndOfParagraph(startInd, doxygenString); + int placement = 0; + if(!restOfLine.empty()){ + list aNewList; + aNewList = parse(placement, restOfLine); + aNewList.push_front(DoxygenEntity("plainstring", name)); + doxyList.push_back(DoxygenEntity(theCommand, aNewList)); + return 1; + } + else cout << "No line followed " << theCommand << " command. Not added" << endl; + return 0; + } + + /* Command Word Optional Word Optional Word + * Format: @command [] [] + * Commands such as class + * "category", "class", "protocol", "interface", "struct", "union" + */ + int addCommandWordOWordOWord(string theCommand, int &startInd, list &doxyList, string doxygenString){ + if (noisy) cout << "Parsing " << theCommand << endl; + string name = getNextWord(startInd, doxygenString); + if (name.empty()){ + cout << "No word followed " << theCommand << " command. Not added" << endl; + return 0; + } + string headerfile = getNextWord(startInd, doxygenString); + string headername = getNextWord(startInd, doxygenString); + list aNewList; + aNewList.push_back(DoxygenEntity("plainstring", name)); + if (!headerfile.empty()) aNewList.push_back(DoxygenEntity("plainstring", headerfile)); + if (!headername.empty()) aNewList.push_back(DoxygenEntity("plainstring", headername)); + doxyList.push_back(DoxygenEntity(theCommand, aNewList)); + return 1; + } + + /* Command Optional Word + * Format: @command [] + * Commands such as dir + * "dir", "file", "cond" + */ + int addCommandOWord(string theCommand, int &startInd, list &doxyList, string doxygenString){ + if (noisy) cout << "Parsing " << theCommand << endl; + string name = getNextWord(startInd, doxygenString); + doxyList.push_back(DoxygenEntity(theCommand, name)); + return 1; + } + /* 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){ + int addCommand(string commandString, int &startInd, list &doxyList, string doxygenString){ + string theCommand = StringToLower(commandString); + string voidArray[] = {""}; + /* @command */ - /* \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; + + if (theCommand.compare("plainstring") == 0){ + string nextPhrase = getStringTilCommand(startInd, doxygenString); + if (noisy) cout << "Parsing plain string :" << nextPhrase << endl; + doxyList.push_back(DoxygenEntity("plainstring", nextPhrase )); + return 1; + } + int commandNumber = commandBelongs(theCommand); + if (commandNumber == 1){ + return addSimpleCommand(theCommand, startInd,doxyList, doxygenString); } - startInd = startIndex; + if (commandNumber == 2){ + return ignoreSimpleCommand(theCommand, startInd,doxyList, doxygenString); + } + if (commandNumber == 3){ + return addCommandWord(theCommand, startInd,doxyList, doxygenString); + } + if (commandNumber == 4){ + return ignoreCommandWord(theCommand, startInd,doxyList, doxygenString); + } + if (commandNumber == 5){ + return addCommandLine(theCommand, startInd,doxyList, doxygenString); + } + if (commandNumber == 6){ + return ignoreCommandLine(theCommand, startInd,doxyList, doxygenString); + } + if (commandNumber == 7){ + return addCommandParagraph(theCommand, startInd,doxyList, doxygenString); + } + if (commandNumber == 8){ + return ignoreCommandParagraph(theCommand, startInd,doxyList, doxygenString); + } + if (commandNumber == 9){ + return ignoreCommandEndCommand(theCommand, startInd,doxyList, doxygenString); + } + if (commandNumber == 10){ + return addCommandWordParagraph(theCommand, startInd,doxyList, doxygenString); + } + if (commandNumber == 11){ + return addCommandWordLine(theCommand, startInd,doxyList, doxygenString); + } + if (commandNumber == 12){ + return addCommandWordOWordOWord(theCommand, startInd,doxyList, doxygenString); + } + if (commandNumber == 13){ + return addCommandOWord(theCommand, startInd,doxyList, doxygenString); + } + if (commandNumber == 14){ + return 0; + } + if (commandNumber == 15){ + return 0; + } + + return 0; + } + + int weirdTest(){ + string doxygenString = "this is a test."; + string restOfParagraph = ""; + int startIndex = 0; + restOfParagraph = getStringTilEndOfParagraph(startIndex , doxygenString); + cout << restOfParagraph<< " " << startIndex << endl; + + startIndex = 0; + restOfParagraph = getStringTilCommand(startIndex, doxygenString); + cout << restOfParagraph<< " " << startIndex << endl; } - /* Returns the parse tree */ + /* Returns a parse tree for a string */ -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[]){ + //weirdTest(); if(testCodeCrawlingFunctions) testCCF(); if (demonstrateParsing){ + string doxygenString = " This is a small sentence.\n *\n This is a line with a @b bold letter \n * \n @brief small @b description. **/"; + //string doxygenString = "This is a description.\n\n * @param x this is a parameter."; int placement = 0; - clearFluff(0); - parse(0, doxygenString.length(), rootList); + clearFluff(placement, doxygenString); + rootList = parse(placement, doxygenString); + cout << "---THE TREE---" << endl; printTree(); } return 1; From c727877cf9dd9f32cb47449a96c5012dfe45f10c Mon Sep 17 00:00:00 2001 From: Cheryl Foil Date: Thu, 10 Jul 2008 04:18:22 +0000 Subject: [PATCH 004/314] Functionality fixes, small tweaks to make DoxygenTranslator more robust and the beginnings of a doxygen example collection git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2008-cherylfoil@10656 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Source/DoxygenTranslator/DoxygenEntity.cpp | 12 +- Source/DoxygenTranslator/DoxygenEntity.h | 2 +- .../DoxygenTranslator/DoxygenTranslator.cpp | 230 ++++++++++++------ Source/DoxygenTranslator/Examples/Example1 | 6 + Source/DoxygenTranslator/Examples/Example2 | 7 + Source/DoxygenTranslator/Examples/Example3 | 10 + Source/DoxygenTranslator/Examples/Example4 | 5 + 7 files changed, 186 insertions(+), 86 deletions(-) create mode 100644 Source/DoxygenTranslator/Examples/Example1 create mode 100644 Source/DoxygenTranslator/Examples/Example2 create mode 100644 Source/DoxygenTranslator/Examples/Example3 create mode 100644 Source/DoxygenTranslator/Examples/Example4 diff --git a/Source/DoxygenTranslator/DoxygenEntity.cpp b/Source/DoxygenTranslator/DoxygenEntity.cpp index cd192601e..6b8755592 100644 --- a/Source/DoxygenTranslator/DoxygenEntity.cpp +++ b/Source/DoxygenTranslator/DoxygenEntity.cpp @@ -24,7 +24,7 @@ string commandArray2[] = {"a", "addindex", "addtogroup", "anchor", "arg", "atten "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(1, 92), "&", "~", "<", ">", "#", "%"}; string findCommand(int commandNum){ @@ -56,7 +56,7 @@ DoxygenEntity::DoxygenEntity(string typeEnt, string param1){ /* Nonterminal node * contains */ -DoxygenEntity::DoxygenEntity(string typeEnt, list entList){ +DoxygenEntity::DoxygenEntity(string typeEnt, list &entList ){ typeOfEntity = typeEnt; data = ""; isLeaf = 0; @@ -65,18 +65,20 @@ DoxygenEntity::DoxygenEntity(string typeEnt, list entList){ void DoxygenEntity::printEntity(int level){ + int thisLevel = level; if (isLeaf) { - for (int i = 0; i < level; i++) {cout << "\t";} + for (int i = 0; i < thisLevel; i++) {cout << "\t";} cout << "Node Command: " << typeOfEntity << " "; if (data.compare("") != 0) cout << "Node Data: " << data; cout << endl; } else{ + for (int i = 0; i < thisLevel; i++) {cout << "\t";} cout << "Node Command : " << typeOfEntity << endl; list::iterator p = entityList.begin(); - level++; + thisLevel++; while (p != entityList.end()){ - (*p).printEntity(level); + (*p).printEntity(thisLevel); p++; } } diff --git a/Source/DoxygenTranslator/DoxygenEntity.h b/Source/DoxygenTranslator/DoxygenEntity.h index a0a99ed70..734d09c8e 100644 --- a/Source/DoxygenTranslator/DoxygenEntity.h +++ b/Source/DoxygenTranslator/DoxygenEntity.h @@ -11,7 +11,7 @@ class DoxygenEntity{ public: DoxygenEntity(string typeEnt); DoxygenEntity(string typeEnt, string param1); - DoxygenEntity(string typeEnt, list entList); + DoxygenEntity(string typeEnt, list &entList ); virtual ~DoxygenEntity(); void printEntity(int level); string typeOfEntity; diff --git a/Source/DoxygenTranslator/DoxygenTranslator.cpp b/Source/DoxygenTranslator/DoxygenTranslator.cpp index e2fdaef8a..13a3c56fe 100644 --- a/Source/DoxygenTranslator/DoxygenTranslator.cpp +++ b/Source/DoxygenTranslator/DoxygenTranslator.cpp @@ -24,7 +24,8 @@ to test. */ int testCodeCrawlingFunctions = 0; int demonstrateParsing = 1; -int noisy = 1; // set this to 1 for extra chatter from the parsing stage. +int runExamples = 1; +int noisy = 0; // set this to 1 for extra chatter from the parsing stage. int addCommand(string commandName, int &startInd, list &doxyList, string doxygenString); ////////////////////////////////////////// @@ -51,7 +52,7 @@ string commandArray[] = {"a", "addindex", "addtogroup", "anchor", "arg", "attent "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 sectionIndicators[] = { "attention", "author", "brief", "bug", "cond", "date", "deprecated", "details", @@ -60,7 +61,7 @@ string sectionIndicators[] = { "attention", "author", "brief", "bug", "cond", "d "version", "warning", "xrefitem" }; /* All of the doxygen commands divided up by how they are parsed */ -string simpleCommands[] = {"n", "$", "@", string(1, 92), string(1, '&'), "~", "<", ">", string(1, '#'), "%"}; +string simpleCommands[] = {"n", "$", "@", "//", "&", "~", "<", ">", "#", "%"}; string ignoredSimpleCommands[] = {"nothing at the moment"}; string commandWords[] = {"a", "b", "c", "e", "em", "p", "def", "enum", "example", "package", "relates", "namespace", "relatesalso","anchor", "dontinclude", "include", "includelineno"}; @@ -84,10 +85,8 @@ string commandErrorThrowings[] = {"annotatedclasslist", "classhierarchy", "defin string commandUniques[] = {"xrefitem", "ingroup", "par", "headerfile", "overload", "weakgroup", "ref", "subpage", "dotfile", "image", "addtogroup", "li"}; - int startIndex = 0; - int endIndex = 0; + //int startIndex = 0; int isNewLine = 0; - //string doxygenString = ""; int briefDescExists = 0; /* Entity list is the root list. @@ -186,8 +185,8 @@ string commandUniques[] = {"xrefitem", "ingroup", "par", "headerfile", "overload int isSectionIndicator(string smallString){ smallString = StringToLower(smallString); - for (int i = 0; i < sizeof(commandArray)/sizeof(*commandArray); i++){ - if( smallString.compare(commandArray[i]) == 0){ + for (int i = 0; i < sizeof( sectionIndicators)/sizeof(* sectionIndicators); i++){ + if( smallString.compare( sectionIndicators[i]) == 0){ return 1; } } @@ -207,7 +206,7 @@ string commandUniques[] = {"xrefitem", "ingroup", "par", "headerfile", "overload int amountRemoved = 0; while(doxygenString[startIndex] == '/'|| doxygenString[startIndex] == '!' || doxygenString[startIndex] == '*' - || doxygenString[startIndex] == '\n' || doxygenString[startIndex] == ' '){ + || doxygenString[startIndex] == '\n' || doxygenString[startIndex] == ' '|| doxygenString[startIndex] == '\t'){ startIndex++; amountRemoved++; } @@ -222,9 +221,9 @@ string commandUniques[] = {"xrefitem", "ingroup", "par", "headerfile", "overload string getNextWord(int &startInd, string doxygenString){ int startIndex = startInd; - string nextWord = ""; + string nextWord; while (startIndex < doxygenString.length() && (doxygenString[startIndex] == '/'|| doxygenString[startIndex] == ' ' - || doxygenString[startIndex] == '*' || doxygenString[startIndex]== '\n' + || doxygenString[startIndex] == '*' || doxygenString[startIndex]== '\n' || doxygenString[startIndex] == '\t' || doxygenString[startIndex] == '!')){ if(doxygenString[startIndex]== '\n'){ startInd = startIndex; return nextWord;} startIndex++; @@ -233,7 +232,7 @@ string commandUniques[] = {"xrefitem", "ingroup", "par", "headerfile", "overload //cout << doxygenString[startIndex] << endl; int endIndex = startIndex; - while (doxygenString[endIndex]!= '\n' && doxygenString[endIndex]!= ' '){ + while (endIndex < doxygenString.length() && (doxygenString[endIndex]!= '\n' && doxygenString[endIndex]!= ' ')){ endIndex++; //cout << "End Index " << endIndex << endl; } @@ -251,7 +250,7 @@ string commandUniques[] = {"xrefitem", "ingroup", "par", "headerfile", "overload int startIndex = startInd; while (doxygenString[startIndex] == '/'|| doxygenString[startIndex] == ' ' || doxygenString[startIndex] == '*' || doxygenString[startIndex]== '\n' - || doxygenString[startIndex] == '!'){ + || doxygenString[startIndex] == '!' || doxygenString[startIndex] == '\t'){ if(doxygenString[startIndex]== '\n') return ""; startIndex++; } @@ -274,7 +273,7 @@ string getStringTilCommand(int &startInd, string doxygenString){ if (startInd >= doxygenString.length()) return ""; int startIndex = startInd; int endIndex = startInd; - string description = ""; + string description; /* Find the End of the description */ int keepLooping = 1; int spareIndex = 0; @@ -293,7 +292,7 @@ string getStringTilCommand(int &startInd, string doxygenString){ //cout << "Counter :" << counter << endl; while(keepLooping && endIndex < doxygenString.length() && (doxygenString[counter] == ' ' || doxygenString[counter] == '*'|| doxygenString[counter] == '\n'|| doxygenString[counter] == '/' - || doxygenString[counter] == '!') ){ + || doxygenString[counter] == '!' || doxygenString[startIndex] == '\t') ){ if(doxygenString[counter] == '\n') { //cout << "Blank line found" << endl; keepLooping = 0; @@ -304,7 +303,7 @@ string getStringTilCommand(int &startInd, string doxygenString){ } //endIndex = counter; } - else if (doxygenString[endIndex] == 92 || doxygenString[endIndex] == '@'){ + else if (doxygenString[endIndex] == '\\' || doxygenString[endIndex] == '@'){ finalIndex = endIndex; keepLooping = 0; } @@ -321,13 +320,13 @@ string getStringTilCommand(int &startInd, string doxygenString){ } //cout << "Done with EndIndex" << endl; while(doxygenString[startIndex] == '!' || doxygenString[startIndex] == ' ' - || doxygenString[startIndex] == '/' || doxygenString[startIndex] == '*') startIndex++; + || doxygenString[startIndex] == '/' || doxygenString[startIndex] == '*' || doxygenString[startIndex] == '\t') startIndex++; for (int i = startIndex; i < endIndex; i++){ if (doxygenString[i] == '\n') { - while ((doxygenString[i] == '\n' || doxygenString[i] == ' ' + while ((doxygenString[i] == '\n' || doxygenString[startIndex] == '\t'|| doxygenString[i] == ' ' || doxygenString[i] == '*' || doxygenString[i] == '/')&& endIndex < doxygenString.length() - 1){ i++; } @@ -351,7 +350,7 @@ string getStringTilCommand(int &startInd, string doxygenString){ if (startInd >= doxygenString.length()) return ""; int startIndex = startInd; int endIndex = startInd; - string description = ""; + string description; /* Find the End of the description */ int keepLooping = 1; int spareIndex = 0; @@ -369,7 +368,7 @@ string getStringTilCommand(int &startInd, string doxygenString){ counter++; //cout << "Counter :" << counter << endl; while(keepLooping && endIndex < doxygenString.length() && (doxygenString[counter] == ' ' || - doxygenString[counter] == '*'|| doxygenString[counter] == '\n'|| doxygenString[counter] == '/' + doxygenString[counter] == '*'|| doxygenString[startIndex] == '\t' || doxygenString[counter] == '\n'|| doxygenString[counter] == '/' || doxygenString[counter] == '!') ){ if(doxygenString[counter] == '\n') { //cout << "Blank line found" << endl; @@ -381,30 +380,32 @@ string getStringTilCommand(int &startInd, string doxygenString){ } //endIndex = counter; } - else if (doxygenString[endIndex] == 92 || doxygenString[endIndex] == '@'){ - //cout << "2 "; - spareIndex = endIndex; - if (isSectionIndicator(getNextWord(spareIndex, doxygenString))) keepLooping = 0; + //todo this fix for not immediately exciting while parsing a paragraph seems somewhat cheap + else if (endIndex != startInd && doxygenString[endIndex] == '\\' || doxygenString[endIndex] == '@'){ + spareIndex = endIndex +1; + + if (isSectionIndicator(getNextWord(spareIndex, doxygenString))) { + keepLooping = 0; + finalIndex = endIndex;} } else if(endIndex < doxygenString.length() - 1 && string("*/").compare(doxygenString.substr(endIndex , endIndex + 1)) == 0){ - //cout << "3 "; keepLooping = 0; + finalIndex = endIndex; } if(keepLooping){ - //cout << "4 "; endIndex++; } } //cout << "Done with EndIndex" << endl; - while(doxygenString[startIndex] == '!' || doxygenString[startIndex] == ' ' + while(doxygenString[startIndex] == '!' || doxygenString[startIndex] == ' ' || doxygenString[startIndex] == '\t' || doxygenString[startIndex] == '/' || doxygenString[startIndex] == '*') startIndex++; for (int i = startIndex; i < endIndex; i++){ if (doxygenString[i] == '\n') { - while ((doxygenString[i] == '\n' || doxygenString[i] == ' ' + while ((doxygenString[i] == '\n' || doxygenString[startIndex] == '\t' || doxygenString[i] == ' ' ||doxygenString[startIndex] == '!' || doxygenString[i] == '*' || doxygenString[i] == '/')&& endIndex < doxygenString.length() - 1){ i++; } @@ -425,9 +426,9 @@ string getStringTilCommand(int &startInd, string doxygenString){ */ //TODO Make progressTilCommand return a formatted string int progressTilEndCommand(string theCommand, int &startInd, string doxygenString){ - endIndex = startInd; + int endIndex = startInd; while (endIndex < doxygenString.length()){ - if (doxygenString[endIndex] == 92 || doxygenString[endIndex] == '@'){ + if (doxygenString[endIndex] == '\\' || 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; @@ -440,34 +441,78 @@ string getStringTilCommand(int &startInd, string doxygenString){ return 0; } + /* A specialty method for commands such as \arg that end at the end of a paragraph OR when another \arg is encountered + */ + string getStringTilAnyCommand(string theCommand, int &startInd, string doxygenString){ - 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 (startInd >= 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){ + if(endIndex >= theCommand.length()){ + finalIndex = endIndex; + keepLooping = 0; + } + else 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] == '!' || doxygenString[startIndex] == '\t') ){ + if(doxygenString[counter] == '\n') { + //cout << "Blank line found" << endl; + keepLooping = 0; + finalIndex = counter;} + else{ counter++;} + } - if (doxygenString[i] == '\n') { + } + //endIndex = counter; + } + else if (doxygenString[endIndex] == '\\' || doxygenString[endIndex] == '@'){ + //cout << "2 "; + spareIndex = endIndex; + if (endIndex + theCommand.length() < theCommand.length() + && theCommand.compare(doxygenString.substr(endIndex, theCommand.length())) == 0) 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] == '*' || doxygenString[startIndex] == '\t') startIndex++; - 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; + for (int i = startIndex; i < endIndex; i++){ + + if (doxygenString[i] == '\n') { + + while ((doxygenString[i] == '\n' || doxygenString[i] == ' ' || doxygenString[startIndex] == '\t' + || doxygenString[i] == '*' || doxygenString[i] == '/')&& endIndex < doxygenString.length() - 1){ + i++; + } + description.append(" "); + } + description.push_back(doxygenString[i]); + //cout << doxygenString[i]; + } + startInd = finalIndex; + return description; } ///////////////TEST CLASSES AND MAIN BELOW///////////////// @@ -477,7 +522,7 @@ string getStringTilCommand(int &startInd, string doxygenString){ * differs wildly */ int testClearFluff(){ - string doxygenString = ""; + string doxygenString; string cases[] = {"/** WORD", "/*! WORD", "/******* WORD", "///// WORD", "//! WORD", "//! WORD", "///WORD", "/**\nWORD", "/**\n*WORD", "/** \n WORD"}; int testPassed = 1; @@ -498,10 +543,10 @@ string getStringTilCommand(int &startInd, string doxygenString){ }; int testGetNextWord(){ - string doxygenString = ""; + string doxygenString; string cases[] = {"/** WORD ", " * WORD ", "///!WORD ", " WORD ", "//! WORD ", " * WORD ", "*WORD "}; int testPassed = 1; - string testWord = ""; + string testWord; int placement = 0; int casesSize = sizeof(cases)/sizeof(*cases); for (int i = 0; i < casesSize; i++){ @@ -523,10 +568,10 @@ string getStringTilCommand(int &startInd, string doxygenString){ testPassed = 0;} //else cout << "GetNextWord passed for string :" << doxygenString << endl; testWord = " * "; - testWord.push_back(92); + testWord.push_back('\\'); testWord = testWord + "WORD "; - string commandWord = ""; - commandWord.push_back(92); + string commandWord; + commandWord.push_back('\\'); commandWord = commandWord + "WORD"; doxygenString = testWord; placement = 0; @@ -581,7 +626,7 @@ string getStringTilCommand(int &startInd, string doxygenString){ } int testGetOneLine(){ - string doxygenString = ""; + string doxygenString; string cases[] = {" * Crop this sentence after this period.\n", " * Crop this sentence after this period.\n", "Crop this sentence after this period.\n", @@ -589,7 +634,7 @@ string getStringTilCommand(int &startInd, string doxygenString){ " Crop this sentence after this period.\n" }; int testPassed = 1; - string testWord = ""; + string testWord; int placement = 0; int casesSize = sizeof(cases)/sizeof(*cases); for (int i = 0; i < casesSize; i++){ @@ -625,7 +670,7 @@ string getStringTilCommand(int &startInd, string doxygenString){ } //TODO Flesh testGetStringTilEndOfParagraph out, fix weird spacing problems int testGetStringTilEndOfParagraph(){ - string doxygenString = ""; + string doxygenString; int placement = 0; int testPassed = 1; string testParagraph; @@ -647,7 +692,7 @@ string getStringTilCommand(int &startInd, string doxygenString){ //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.push_back('//'); doxygenString += "author cheryl foil \n\n **/"; placement = 0; testParagraph = getStringTilEndOfParagraph(placement, doxygenString); @@ -662,7 +707,7 @@ string getStringTilCommand(int &startInd, string doxygenString){ } int testGetStringTilCommand(){ - string doxygenString = ""; + string doxygenString; int placement = 0; int testPassed = 1; string testParagraph; @@ -678,12 +723,12 @@ string getStringTilCommand(int &startInd, string doxygenString){ } int testProgressTilEndCommand(){ - string doxygenString = ""; + string doxygenString ; 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.push_back('\\'); doxygenString += "endcodeSTOP"; progressTilEndCommand("endcode", placement, doxygenString); //cout << "Placement : " << placement << endl; @@ -733,11 +778,11 @@ string getStringTilCommand(int &startInd, string doxygenString){ list parse(int startInd, string doxygenString){ - string currWord = ""; + string currWord; int startIndex = startInd; int savedIndex; list aNewList; - endIndex = doxygenString.length(); + int endIndex = doxygenString.length(); int currCommand; while (startIndex < endIndex){ savedIndex = startIndex; @@ -746,12 +791,12 @@ string getStringTilCommand(int &startInd, string doxygenString){ if(currWord == ""){ if (startIndex < endIndex) startIndex++; } - else if(currWord[0] == 92 || currWord[0] == '@'){ + else if(currWord[0] == '\\' || currWord[0] == '@'){ currWord = currWord.substr(1, currWord.length() - 1); currCommand = findCommand(currWord); - if (currCommand < 0 ){ cout << "BAD COMMAND: " << currWord << endl; exit(1);} + if (currCommand < 0 ){ if(noisy) cout << "BAD COMMAND: " << currWord << endl;} //cout << "Command: " << currWord << " " << currCommand << endl; - addCommand(currWord, startIndex, aNewList, doxygenString); + else addCommand(currWord, startIndex, aNewList, doxygenString); } else{ startIndex = savedIndex; @@ -783,7 +828,6 @@ string getStringTilCommand(int &startInd, string doxygenString){ if (noisy) cout << "Not Adding " << theCommand << endl; return 1; - //doxyList.push_back(DoxygenEntity(108)); } /* CommandWord @@ -1051,7 +1095,7 @@ string getStringTilCommand(int &startInd, string doxygenString){ int weirdTest(){ string doxygenString = "this is a test."; - string restOfParagraph = ""; + string restOfParagraph; int startIndex = 0; restOfParagraph = getStringTilEndOfParagraph(startIndex , doxygenString); cout << restOfParagraph<< " " << startIndex << endl; @@ -1061,16 +1105,42 @@ string getStringTilCommand(int &startInd, string doxygenString){ cout << restOfParagraph<< " " << startIndex << endl; } + + + int doRunExamples(){ + string line; + string filename; + string exampleNames[] = {"Examples/Example1","Examples/Example2", "Examples/Example3", "Examples/Example4", "Examples/Example5"}; + int placement; + string doxygenString; + ifstream doxCommentFile; + for (int i = 0; i < 5; i++){ + doxCommentFile.open(exampleNames[i].c_str()); + doxCommentFile >> doxygenString; + while(getline(doxCommentFile, line)){ + doxygenString += line + "\n";} + doxCommentFile.close(); + placement = 0; + cout << "---RAW CODE---" << endl << doxygenString << endl< Date: Sun, 13 Jul 2008 04:51:51 +0000 Subject: [PATCH 005/314] Small tokenizer-related classes git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2008-cherylfoil@10659 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Source/DoxygenTranslator/Token.cpp | 32 ++++++++ Source/DoxygenTranslator/Token.h | 21 +++++ Source/DoxygenTranslator/TokenList.cpp | 103 +++++++++++++++++++++++++ Source/DoxygenTranslator/TokenList.h | 24 ++++++ 4 files changed, 180 insertions(+) create mode 100644 Source/DoxygenTranslator/Token.cpp create mode 100644 Source/DoxygenTranslator/Token.h create mode 100644 Source/DoxygenTranslator/TokenList.cpp create mode 100644 Source/DoxygenTranslator/TokenList.h diff --git a/Source/DoxygenTranslator/Token.cpp b/Source/DoxygenTranslator/Token.cpp new file mode 100644 index 000000000..e85799546 --- /dev/null +++ b/Source/DoxygenTranslator/Token.cpp @@ -0,0 +1,32 @@ +#include "Token.h" +#include +#include +#include +#include +using namespace std; + + +Token::Token(int tType, string tString) +{ + tokenType = tType; + tokenString = tString; +} + +string Token::toString() +{ + if (tokenType == END_LINE){ + return "{END OF LINE}"; + } + if (tokenType == PARAGRAPH_END){ + return "{END OF PARAGRAPH}"; + } + if (tokenType == PLAINSTRING){ + return tokenString; + } + if (tokenType == COMMAND){ + return "{COMMAND : " + tokenString+ "}"; + } + return ""; +} + +Token:: ~Token(){} diff --git a/Source/DoxygenTranslator/Token.h b/Source/DoxygenTranslator/Token.h new file mode 100644 index 000000000..d569f5f7b --- /dev/null +++ b/Source/DoxygenTranslator/Token.h @@ -0,0 +1,21 @@ +#ifndef TOKEN_H_ +#define TOKEN_H_ +#include + +#define END_LINE 101 +#define PARAGRAPH_END 102 +#define PLAINSTRING 103 +#define COMMAND 104 +using namespace std; + +class Token +{ +public: + Token(int tType, string tString); + ~Token(); + int tokenType; + string tokenString; + string toString(); +}; + +#endif /*TOKEN_H_*/ diff --git a/Source/DoxygenTranslator/TokenList.cpp b/Source/DoxygenTranslator/TokenList.cpp new file mode 100644 index 000000000..6122328c4 --- /dev/null +++ b/Source/DoxygenTranslator/TokenList.cpp @@ -0,0 +1,103 @@ +#include "TokenList.h" +#include +#include +#include +#include +#include "Token.h" +#define TOKENSPERLINE 8; //change this to change the printing behaviour of the token list +#define END_LINE 101 +#define PARAGRAPH_END 102 //not used at the moment +#define PLAINSTRING 103 +#define COMMAND 104 +using namespace std; + + +list tokenList; +list::iterator tokenListIterator; +int noisy2 = 0; +/* The tokenizer*/ + +TokenList::TokenList(string doxygenString){ + int currentIndex = 0; + //Regex whitespace("[ \t]+"); + //Regex newLine("[\n]"); + //Regex command("[@|\\]{1}[^ \t \n]+"); //the cheap solution + //Regex doxygenFluff("[/*!]+"); + int nextIndex = 0; + int isFluff = 0; + string currentWord; + while (currentIndex < doxygenString.length()){ + if(doxygenString[currentIndex] == '\n'){ + tokenList.push_back(Token(END_LINE, currentWord)); + currentIndex++; + } + while(currentIndex < doxygenString.length() && (doxygenString[currentIndex] == ' ' + || doxygenString[currentIndex]== '\t')) currentIndex ++; + if (currentIndex == doxygenString.length()) {} //do nothing since end of string was reached + else {nextIndex = currentIndex; + while (nextIndex < doxygenString.length() && (doxygenString[nextIndex] != ' ' + && doxygenString[nextIndex]!= '\t' && doxygenString[nextIndex]!= '\n')) nextIndex++; + currentWord = doxygenString.substr(currentIndex, nextIndex-currentIndex); + if(noisy2) cout << "Current Word: " << currentWord << endl; + if (currentWord[0] == '@' || currentWord[0] == '\\'){ + currentWord = currentWord.substr(1, currentWord.length()-1); + tokenList.push_back(Token(COMMAND, currentWord)); + } + else if (currentWord[0] == '\n'){ + //if ((tokenList.back()).tokenType == END_LINE){} + tokenList.push_back(Token(END_LINE, currentWord)); + + } + else if (currentWord[0] == '*' || currentWord[0] == '/' ||currentWord[0] == '!'){ + if (currentWord.length() == 1) {isFluff = 1;} + else { isFluff = 1; + for(int i = 1; i < currentWord.length(); i++){ + if (currentWord[0] != '*' && currentWord[0] != '/' && currentWord[0] != '!') isFluff = 0; + } + + } + if(!isFluff) tokenList.push_back(Token(PLAINSTRING, currentWord)); + } + + else tokenList.push_back(Token(PLAINSTRING, currentWord)); + currentIndex = nextIndex; + } + } + tokenListIterator = tokenList.begin(); +} + +Token TokenList::peek(){ + list::iterator p = tokenList.begin(); + if(p != tokenList.end()){ + p++; + Token returnedToken = (*p); + p--; + return returnedToken; + } + else + return Token(0, ""); +} + +Token TokenList::next(){ + list::iterator p = tokenList.begin(); + if(p != tokenList.end()){ + p++; + return (*p); + } + else + return Token(0, ""); +} + +void TokenList::printList(){ + list::iterator p = tokenList.begin(); + int i = 1; + int b = 0; + while (p != tokenList.end()){ + cout << (*p).toString() << " "; + b = i%TOKENSPERLINE; + if (b == 0) cout << endl; + p++; i++; + } +} + +TokenList:: ~TokenList(){} \ No newline at end of file diff --git a/Source/DoxygenTranslator/TokenList.h b/Source/DoxygenTranslator/TokenList.h new file mode 100644 index 000000000..153c69163 --- /dev/null +++ b/Source/DoxygenTranslator/TokenList.h @@ -0,0 +1,24 @@ +#ifndef TOKENLIST_H_ +#define TOKENLIST_H_ +#include +#include +#include +#include +#include "Token.h" +using namespace std; + +/* a small class used to represent the sequence of tokens + * that can be derived from a formatted doxygen string + */ + +class TokenList{ +public: + /* constructor takes a blob of Doxygen comment */ + TokenList(string doxygenString); + ~TokenList(); + Token peek(); /* returns next token without advancing */ + Token next(); /* returns next token and advances */ + void printList(); /* prints out the sequence of tokens */ +}; + +#endif /*TOKENLIST_H_*/ From cc6db6eab60d0226ea47bb3caa16e915ce84a6ca Mon Sep 17 00:00:00 2001 From: Cheryl Foil Date: Wed, 16 Jul 2008 22:23:45 +0000 Subject: [PATCH 006/314] Reworking of DoxygenTranslator with the Tokenizer, more Doxygen commands implemented, beginning of the javaDoc convertor git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2008-cherylfoil@10670 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Source/DoxygenTranslator/DoxygenEntity.h | 5 +- .../DoxygenTranslator/DoxygenTranslator.cpp | 1470 +++++++---------- Source/DoxygenTranslator/JavaDocConverter.cpp | 104 ++ Source/DoxygenTranslator/JavaDocConverter.h | 17 + Source/DoxygenTranslator/Token.h | 4 +- Source/DoxygenTranslator/TokenList.cpp | 31 +- Source/DoxygenTranslator/TokenList.h | 7 +- 7 files changed, 716 insertions(+), 922 deletions(-) create mode 100644 Source/DoxygenTranslator/JavaDocConverter.cpp create mode 100644 Source/DoxygenTranslator/JavaDocConverter.h diff --git a/Source/DoxygenTranslator/DoxygenEntity.h b/Source/DoxygenTranslator/DoxygenEntity.h index 734d09c8e..0605b1cc9 100644 --- a/Source/DoxygenTranslator/DoxygenEntity.h +++ b/Source/DoxygenTranslator/DoxygenEntity.h @@ -1,3 +1,5 @@ +#ifndef DOXYGENENTITY_H_ +#define DOXYGENENTITY_H_ #include #include @@ -12,7 +14,7 @@ public: DoxygenEntity(string typeEnt); DoxygenEntity(string typeEnt, string param1); DoxygenEntity(string typeEnt, list &entList ); - virtual ~DoxygenEntity(); + ~DoxygenEntity(); void printEntity(int level); string typeOfEntity; list entityList; @@ -21,3 +23,4 @@ public: }; +#endif /*TOKENLIST_H_*/ diff --git a/Source/DoxygenTranslator/DoxygenTranslator.cpp b/Source/DoxygenTranslator/DoxygenTranslator.cpp index 13a3c56fe..d6129cda0 100644 --- a/Source/DoxygenTranslator/DoxygenTranslator.cpp +++ b/Source/DoxygenTranslator/DoxygenTranslator.cpp @@ -1,106 +1,112 @@ -/* 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" + + //THE TOKENIZER REWORK -using namespace std; - - -////////////////////////////////////////// -/*Set these to pick what internal functions -to test. */ - -//int testCommandParsingFunctions = 1;// not implemented - -int testCodeCrawlingFunctions = 0; -int demonstrateParsing = 1; -int runExamples = 1; -int noisy = 0; // set this to 1 for extra chatter from the parsing stage. -int addCommand(string commandName, int &startInd, list &doxyList, string doxygenString); -////////////////////////////////////////// - - - -/* 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 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" }; - -/* All of the doxygen commands divided up by how they are parsed */ -string simpleCommands[] = {"n", "$", "@", "//", "&", "~", "<", ">", "#", "%"}; -string ignoredSimpleCommands[] = {"nothing at the moment"}; -string commandWords[] = {"a", "b", "c", "e", "em", "p", "def", "enum", "example", "package", - "relates", "namespace", "relatesalso","anchor", "dontinclude", "include", "includelineno"}; -string ignoredCommandWords[] = {"copydoc", "copybrief", "copydetails", "verbinclude", "htmlinclude"}; -string commandLines[] = {"addindex", "fn", "name", "line", "var", "skipline", "typedef", "skip", "until", "property"}; -string ignoreCommandLines[] = {"nothing at the moment"}; -string commandParagraph[] = {"return", "remarks", "since", "test", "sa", "see", "pre", "post", "details", "invariant", - "deprecated", "date", "note", "warning", "version", "todo", "bug", "attention", "brief", "arg", "author"}; -string ignoreCommandParagraphs[] = {"nothing at the moment"}; -string commandEndCommands[] = {"code", "dot", "msc", "f$", "f[", "f{environment}{", "htmlonly", "latexonly", "manonly", - "verbatim", "xmlonly", "cond", "if", "ifnot", "link"}; -string commandWordParagraphs[] = {"param", "tparam", "throw", "retval", "exception"}; -string commandWordLines[] = {"page", "subsection", "subsubsection", "section", "paragraph", "defgroup"}; -string commandWordOWordOWords [] = {"category", "class", "protocol", "interface", "struct", "union"}; -string commandOWords[] = {"dir", "file", "cond"}; -string commandErrorThrowings[] = {"annotatedclasslist", "classhierarchy", "define", "functionindex", "header", - "headerfilelist", "inherit", "l", "postheader", "private", "privatesection", "protected", - "protectedsection", "public", "publicsection", "endcode", "enddot", "endmsc", "endhtmlonly", - "endlatexonly", "endmanonly", "endlink", "endverbatim", "endxmlonly", "f]", "f}", "endcond", - "endif"}; -string commandUniques[] = {"xrefitem", "ingroup", "par", "headerfile", "overload", "weakgroup", "ref", - "subpage", "dotfile", "image", "addtogroup", "li"}; - - //int startIndex = 0; - int isNewLine = 0; - 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. + /* 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 work in Brief descriptions, detailed descriptions for autobrief - list rootList; + #include + #include + #include + #include + #include + #include "DoxygenEntity.h" + #include "TokenList.h" + #include "JavaDocConverter.h" + #define SIMPLECOMMAND 1 + #define IGNOREDSIMPLECOMMAND 2 + #define COMMANDWORD 3 + #define IGNOREDCOMMANDWORD 4 + #define COMMANDLINE 5 + #define IGNOREDCOMMANDLINE 6 + #define COMMANDPARAGRAPH 7 + #define IGNORECOMMANDPARAGRAPH 8 + #define COMMANDENDCOMMAND 9 + #define COMMANDWORDPARAGRAPH 10 + #define COMMANDWORDLINE 11 + #define COMMANDWORDOWORDWORD 12 + #define COMMANDOWORD 13 + #define COMMANDERRORTHROW 14 + #define COMMANDUNIQUE 15 +#define END_LINE 101 +#define PARAGRAPH_END 102 +#define PLAINSTRING 103 +#define COMMAND 104 + using namespace std; -/* General (untested) assist methods */ + ////////////////////////////////////////// + /*Set these to pick what internal functions + to test. */ + //int testCommandParsingFunctions = 1;// not implemented + + + int noisy = 0; // set this to 1 for extra chatter from the parsing stage. + int addCommand(string currCommand, TokenList &tokList, list &aNewList); + list parse(list::iterator endParsingIndex, TokenList &tokList); + + ////////////////////////////////////////// + + + 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 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" }; + + /* All of the doxygen commands divided up by how they are parsed */ + string simpleCommands[] = {"n", "$", "@", "//", "&", "~", "<", ">", "#", "%"}; + string ignoredSimpleCommands[] = {"nothing at the moment"}; + string commandWords[] = {"a", "b", "c", "e", "em", "p", "def", "enum", "example", "package", + "relates", "namespace", "relatesalso","anchor", "dontinclude", "include", "includelineno"}; + string ignoredCommandWords[] = {"copydoc", "copybrief", "copydetails", "verbinclude", "htmlinclude"}; + string commandLines[] = {"addindex", "fn", "name", "line", "var", "skipline", "typedef", "skip", "until", "property"}; + string ignoreCommandLines[] = {"nothing at the moment"}; + string commandParagraph[] = {"return", "remarks", "since", "test", "sa", "see", "pre", "post", "details", "invariant", + "deprecated", "date", "note", "warning", "version", "todo", "bug", "attention", "brief", "author"}; + string ignoreCommandParagraphs[] = {"nothing at the moment"}; + string commandEndCommands[] = {"code", "dot", "msc", "f$", "f[", "f{environment}{", "htmlonly", "latexonly", "manonly", + "verbatim", "xmlonly", "cond", "if", "ifnot", "link"}; + string commandWordParagraphs[] = {"param", "tparam", "throw", "retval", "exception"}; + string commandWordLines[] = {"page", "subsection", "subsubsection", "section", "paragraph", "defgroup"}; + string commandWordOWordOWords [] = {"category", "class", "protocol", "interface", "struct", "union"}; + string commandOWords[] = {"dir", "file", "cond"}; + string commandErrorThrowings[] = {"annotatedclasslist", "classhierarchy", "define", "functionindex", "header", + "headerfilelist", "inherit", "l", "postheader", "private", "privatesection", "protected", + "protectedsection", "public", "publicsection", "endcode", "enddot", "endmsc", "endhtmlonly", + "endlatexonly", "endmanonly", "endlink", "endverbatim", "endxmlonly", "f]", "f}", "endcond", + "endif"}; + string commandUniques[] = {"xrefitem", "arg", "ingroup", "par", "headerfile", "overload", "weakgroup", "ref", + "subpage", "dotfile", "image", "addtogroup", "li"}; + + + /* Changes a string to all lower case*/ 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){ - if(endIndex >= doxygenString.length()){ - finalIndex = endIndex; - keepLooping = 0; - } - else 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] == '!' || doxygenString[startIndex] == '\t') ){ - if(doxygenString[counter] == '\n') { - //cout << "Blank line found" << endl; - keepLooping = 0; - finalIndex = counter;} - else{ counter++;} - } - - } - //endIndex = counter; - } - else if (doxygenString[endIndex] == '\\' || doxygenString[endIndex] == '@'){ - finalIndex = endIndex; - keepLooping = 0; - } - else if(endIndex < doxygenString.length() -2 - && string("**/").compare(doxygenString.substr(endIndex , endIndex + 2)) == 0){ - finalIndex = endIndex; - //cout << "3 "; - keepLooping = 0; - } - if(keepLooping){ - //cout << "4 "; - endIndex++; - } - } - //cout << "Done with EndIndex" << endl; - while(doxygenString[startIndex] == '!' || doxygenString[startIndex] == ' ' - || doxygenString[startIndex] == '/' || doxygenString[startIndex] == '*' || doxygenString[startIndex] == '\t') startIndex++; - - for (int i = startIndex; i < endIndex; i++){ - - if (doxygenString[i] == '\n') { - - while ((doxygenString[i] == '\n' || doxygenString[startIndex] == '\t'|| doxygenString[i] == ' ' - || doxygenString[i] == '*' || doxygenString[i] == '/')&& endIndex < doxygenString.length() - 1){ - i++; - } - description.append(" "); - } - description.push_back(doxygenString[i]); - //cout << doxygenString[i]; - } - //if(noisy) cout << "Final Index is: " << finalIndex << endl; - startInd = finalIndex; - return description; - } - -/* Returns a Paragraph- defined in Doxygen to be a paragraph of text - * seperate by either a structural command or a blank line - * This method is VERY messy currently - */ - //TODO fix getStringTilEndOfParagraph to be more forgiving, work on ' ' characters - string getStringTilEndOfParagraph(int &startInd, string doxygenString){ - if (startInd >= 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){ - if(endIndex >= doxygenString.length()){ - finalIndex = endIndex; - keepLooping = 0; - } - else 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[startIndex] == '\t' || doxygenString[counter] == '\n'|| doxygenString[counter] == '/' - || doxygenString[counter] == '!') ){ - if(doxygenString[counter] == '\n') { - //cout << "Blank line found" << endl; - keepLooping = 0; - finalIndex = counter;} - else{ counter++;} - } - - } - //endIndex = counter; - } - //todo this fix for not immediately exciting while parsing a paragraph seems somewhat cheap - else if (endIndex != startInd && doxygenString[endIndex] == '\\' || doxygenString[endIndex] == '@'){ - spareIndex = endIndex +1; - - if (isSectionIndicator(getNextWord(spareIndex, doxygenString))) { - keepLooping = 0; - finalIndex = endIndex;} - } - else if(endIndex < doxygenString.length() - 1 - && string("*/").compare(doxygenString.substr(endIndex , endIndex + 1)) == 0){ - keepLooping = 0; - finalIndex = endIndex; - } - if(keepLooping){ - endIndex++; - } - } - //cout << "Done with EndIndex" << endl; - while(doxygenString[startIndex] == '!' || doxygenString[startIndex] == ' ' || doxygenString[startIndex] == '\t' - || doxygenString[startIndex] == '/' || doxygenString[startIndex] == '*') startIndex++; - - for (int i = startIndex; i < endIndex; i++){ - - if (doxygenString[i] == '\n') { - - while ((doxygenString[i] == '\n' || doxygenString[startIndex] == '\t' || doxygenString[i] == ' ' ||doxygenString[startIndex] == '!' - || 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, string doxygenString){ - int endIndex = startInd; - while (endIndex < doxygenString.length()){ - if (doxygenString[endIndex] == '\\' || 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; - } - - /* A specialty method for commands such as \arg that end at the end of a paragraph OR when another \arg is encountered - */ - - string getStringTilAnyCommand(string theCommand, int &startInd, string doxygenString){ - if (startInd >= 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){ - if(endIndex >= theCommand.length()){ - finalIndex = endIndex; - keepLooping = 0; - } - else 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] == '!' || doxygenString[startIndex] == '\t') ){ - if(doxygenString[counter] == '\n') { - //cout << "Blank line found" << endl; - keepLooping = 0; - finalIndex = counter;} - else{ counter++;} - } - - } - //endIndex = counter; - } - else if (doxygenString[endIndex] == '\\' || doxygenString[endIndex] == '@'){ - //cout << "2 "; - spareIndex = endIndex; - if (endIndex + theCommand.length() < theCommand.length() - && theCommand.compare(doxygenString.substr(endIndex, theCommand.length())) == 0) 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] == '*' || doxygenString[startIndex] == '\t') startIndex++; - - for (int i = startIndex; i < endIndex; i++){ - - if (doxygenString[i] == '\n') { - - while ((doxygenString[i] == '\n' || doxygenString[i] == ' ' || doxygenString[startIndex] == '\t' - || doxygenString[i] == '*' || doxygenString[i] == '/')&& endIndex < doxygenString.length() - 1){ - i++; - } - description.append(" "); - } - description.push_back(doxygenString[i]); - //cout << doxygenString[i]; - } - startInd = finalIndex; - return description; - } - ///////////////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 doxygenString; - string cases[] = {"/** WORD", "/*! WORD", "/******* WORD", "///// WORD", "//! WORD", "//! WORD", "///WORD", - "/**\nWORD", "/**\n*WORD", "/** \n WORD"}; - int testPassed = 1; - int placement = 0; - int casesSize = sizeof(cases)/sizeof(*cases); - for (int i = 0; i < casesSize; i++){ - placement = 0; - doxygenString = cases[i]; - if(cases[i][clearFluff(placement, doxygenString)] != 'W'){ - cout << "ClearFluff failed for string :" << doxygenString << "\t Displayed :" << cases[i][clearFluff(placement = 0, doxygenString)] << ": Instead." << endl; - testPassed = 0; - } - } - if(testPassed) cout << "+++ClearFluff passed for all tests+++\n" << endl; - else cout << "+++ClearFluff FAILED.+++" << endl; - return testPassed; - - }; - - int testGetNextWord(){ - string doxygenString; - 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, doxygenString); - 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, doxygenString); - 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('\\'); - testWord = testWord + "WORD "; - string commandWord; - commandWord.push_back('\\'); - commandWord = commandWord + "WORD"; - doxygenString = testWord; - placement = 0; - testWord = getNextWord(placement, doxygenString); - 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, doxygenString); - 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, doxygenString); - 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, doxygenString); - 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, doxygenString); - 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, doxygenString); - 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, doxygenString); - 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 doxygenString; - 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, doxygenString); - 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, doxygenString); - if(testWord.compare("Get this line.") != 0){ - cout << "GetOneLine failed for string :" << doxygenString << "\t Displayed :" << testWord << ": Instead." << endl; - testPassed = 0; - } - testWord = getOneLine(placement, doxygenString); - if(testWord.compare("Now get this line.") != 0){ - cout << "GetOneLine failed for string :" << doxygenString << "\t Displayed :" << testWord << ": Instead." << endl; - testPassed = 0; - } - testWord = getOneLine(placement, doxygenString); - 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(){ - string doxygenString; - 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, doxygenString); - 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, doxygenString); - //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('//'); - doxygenString += "author cheryl foil \n\n **/"; - placement = 0; - testParagraph = getStringTilEndOfParagraph(placement, doxygenString); - 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 << "+++GetGetStringTilEndOfParagraph passed for all tests+++\n" << endl; - else cout << "+++GetGetStringTilEndOfParagraphFAILED+++\n" << endl; - return testPassed; - } - - int testGetStringTilCommand(){ - string doxygenString; - int placement = 0; - int testPassed = 1; - string testParagraph; - doxygenString = ("/* This is a description,\n * thus it continues on\n * for several @b lines.\n\n This Shouldn't be included.\n\n **/"); - testParagraph = getStringTilCommand(placement, doxygenString); - if( testParagraph.compare("This is a description, thus it continues on for several ") != 0){ - cout << "GetOneLine failed for string :" << doxygenString << "\t Displayed :" << testParagraph << ": Instead." << endl; - testPassed = 0; - } - if(testPassed) cout << "+++GetStringTilCommand passed for all tests+++\n" << endl; - else cout << "+++GetStringTilCommand FAILED+++\n" << endl; - return testPassed; - - } - int testProgressTilEndCommand(){ - string doxygenString ; - 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('\\'); - doxygenString += "endcodeSTOP"; - progressTilEndCommand("endcode", placement, doxygenString); - //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(); - - cout << "Testing GetStringTilCommand" << endl; - testGetStringTilCommand(); - return 1; - } - /* prints the parse tree * */ - void printTree(){ + void printTree( list &rootList){ list::iterator p = rootList.begin(); while (p != rootList.end()){ @@ -775,45 +160,217 @@ string getStringTilCommand(int &startInd, string doxygenString){ } - - - list parse(int startInd, string doxygenString){ - string currWord; - int startIndex = startInd; - int savedIndex; - list aNewList; - int endIndex = doxygenString.length(); - int currCommand; - while (startIndex < endIndex){ - savedIndex = startIndex; - currWord = getNextWord(startIndex, doxygenString); - if(noisy) cout << "Parsing for phrase starting in:" << currWord << endl; - if(currWord == ""){ - if (startIndex < endIndex) startIndex++; - } - else if(currWord[0] == '\\' || currWord[0] == '@'){ - currWord = currWord.substr(1, currWord.length() - 1); - currCommand = findCommand(currWord); - if (currCommand < 0 ){ if(noisy) cout << "BAD COMMAND: " << currWord << endl;} - //cout << "Command: " << currWord << " " << currCommand << endl; - else addCommand(currWord, startIndex, aNewList, doxygenString); - } - else{ - startIndex = savedIndex; - addCommand(string("plainstring"), startIndex, aNewList, doxygenString); + /* Determines how a command should be handled (what group it belongs to + * for parsing rules + */ + int commandBelongs(string theCommand){ + string smallString = StringToLower(theCommand ); + //cout << " Looking for command " << theCommand << endl; + int i = 0; + for ( i = 0; i < sizeof(simpleCommands)/sizeof(*simpleCommands); i++){ + if(smallString.compare(simpleCommands[i]) == 0){return SIMPLECOMMAND ;} + } + for ( i = 0; i < sizeof(ignoredSimpleCommands)/sizeof(*ignoredSimpleCommands); i++){ + if(smallString.compare(ignoredSimpleCommands[i]) == 0){return IGNOREDSIMPLECOMMAND;} + } + for ( i = 0; i < sizeof(commandWords)/sizeof(*commandWords); i++){ + if(smallString.compare( commandWords[i]) == 0){return COMMANDWORD;} + } + for ( i = 0; i < sizeof(ignoredCommandWords)/sizeof(*ignoredCommandWords); i++){ + if(smallString.compare( ignoredCommandWords[i]) == 0){return IGNOREDCOMMANDWORD;} + } + for ( i = 0; i < sizeof(commandLines)/sizeof(*commandLines); i++){ + if(smallString.compare( commandLines[i]) == 0){return COMMANDLINE;} + } + for ( i = 0; i < sizeof(ignoreCommandLines)/sizeof(*ignoreCommandLines); i++){ + if(smallString.compare( ignoreCommandLines[i]) == 0){return IGNOREDCOMMANDLINE;} + } + for ( i = 0; i < sizeof(commandParagraph)/sizeof(*commandParagraph); i++){ + if(smallString.compare( commandParagraph[i]) == 0){return COMMANDPARAGRAPH;} + } + /* IgnoreCommandParagraph */ + for ( i = 0; i < sizeof(ignoreCommandParagraphs)/sizeof(*ignoreCommandParagraphs); i++){ + if(smallString.compare( ignoreCommandParagraphs[i]) == 0){return IGNORECOMMANDPARAGRAPH;} + } + for ( i = 0; i < sizeof(commandEndCommands)/sizeof(*commandEndCommands); i++){ + if(smallString.compare( commandEndCommands[i]) == 0){return COMMANDENDCOMMAND ;} + } + for ( i = 0; i < sizeof(commandWordParagraphs)/sizeof(*commandWordParagraphs); i++){ + if(smallString.compare( commandWordParagraphs[i]) == 0){return COMMANDWORDPARAGRAPH;} + } + for ( i = 0; i < sizeof(commandWordLines)/sizeof(*commandWordLines); i++){ + if(smallString.compare( commandWordLines[i]) == 0){return COMMANDWORDLINE ;} + } + for ( i = 0; i < sizeof(commandWordOWordOWords)/sizeof(*commandWordOWordOWords); i++){ + if(smallString.compare( commandWordOWordOWords[i]) == 0){return COMMANDWORDOWORDWORD;} + } + for ( i = 0; i < sizeof(commandOWords)/sizeof(*commandOWords); i++){ + if(smallString.compare( commandOWords[i]) == 0){return COMMANDOWORD;} + } + for ( i = 0; i < sizeof(commandErrorThrowings)/sizeof(*commandErrorThrowings); i++){ + if(smallString.compare( commandErrorThrowings[i]) == 0){return COMMANDERRORTHROW;} + } + for ( i = 0; i < sizeof(commandUniques)/sizeof(*commandUniques); i++){ + if(smallString.compare( commandUniques[i]) == 0){return COMMANDUNIQUE;} + } + + return 0; + + } + /* Returns the next word ON THE CURRENT LINE ONLY + * if a new line is encountered, returns a blank string. + * Updates the index it is given if success. + */ + + string getNextWord(TokenList &tokList){ + Token nextToken = tokList.peek(); + if (nextToken.tokenType == PLAINSTRING ){ + nextToken = tokList.next(); + return nextToken.tokenString; + } + return ""; + } + + /* Returns the location of the end of the line as + * an iterator. + */ + list::iterator getOneLine(TokenList &tokList){ + list::iterator endOfParagraph = tokList.iteratorCopy(); + while(endOfParagraph != tokList.end()){ + if ((* endOfParagraph).tokenType == END_LINE){ + return endOfParagraph; + } + endOfParagraph++; + } + return tokList.end(); + } + + + +/* Returns a properly formatted string + * up til ANY command or end of paragraph is encountered. + */ +string getStringTilCommand(TokenList &tokList){ + string description; + if (tokList.peek().tokenType == 0) return ""; + while(tokList.peek().tokenType == PLAINSTRING || tokList.peek().tokenType == END_LINE ){ + Token currentToken = tokList.next(); + if(currentToken.tokenType == PLAINSTRING) { + description = description + currentToken.tokenString + " "; + } + else if (tokList.peek().tokenType == END_LINE) break; + } + + return description; + } + +/* Returns a properly formatted string + * up til the command specified is encountered + */ +//TODO check that this behaves properly for formulas + +string getStringTilEndCommand(string theCommand, TokenList &tokList){ + string description; + if (tokList.peek().tokenType == 0) return ""; + while(tokList.peek().tokenString.compare(theCommand) != 0 ){ + Token currentToken = tokList.next(); + description = description + currentToken.tokenString + " "; + + } + + return description; + } + +/* Returns the end of a Paragraph as an iterator- + * Paragraph is defined in Doxygen to be a paragraph of text + * seperate by either a structural command or a blank line + */ + +list::iterator getEndOfParagraph(TokenList &tokList){ + list::iterator endOfParagraph = tokList.iteratorCopy(); + while(endOfParagraph != tokList.end()){ + if ((* endOfParagraph).tokenType == COMMAND){ + if(isSectionIndicator((* endOfParagraph).tokenString)) return endOfParagraph; + else endOfParagraph++; + } + else if((* endOfParagraph).tokenType == PLAINSTRING) { + endOfParagraph++; + } + else if ((* endOfParagraph).tokenType == END_LINE){ + endOfParagraph++; + if ((* endOfParagraph).tokenType == END_LINE){ + endOfParagraph++; + return endOfParagraph; + } + } + + } + + return tokList.end(); + + } + +/* Returns the end of a section, defined as the first blank line OR first encounter of the same + * command. Example of this behaviour is \arg + */ + +list::iterator getEndOfSection(string theCommand, TokenList &tokList){ + list::iterator endOfParagraph = tokList.iteratorCopy(); + while(endOfParagraph != tokList.end()){ + if ((* endOfParagraph).tokenType == COMMAND){ + if(theCommand.compare((*endOfParagraph).tokenString) == 0) return endOfParagraph; + else endOfParagraph++; + } + else if((* endOfParagraph).tokenType == PLAINSTRING) { + endOfParagraph++; + } + else if ((* endOfParagraph).tokenType == END_LINE){ + endOfParagraph++; + if ((* endOfParagraph).tokenType == END_LINE){ + endOfParagraph++; + return endOfParagraph; + } + } + + } +} + /* This method is for returning the end of 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", tokenList); + */ +list::iterator getEndCommand(string theCommand, TokenList &tokList){ + list::iterator endOfCommand = tokList.iteratorCopy(); + while (endOfCommand!= tokList.end()){ + if ((*endOfCommand).tokenType == COMMAND){ + if (theCommand.compare((* endOfCommand).tokenString) == 0){ + return endOfCommand; + } + endOfCommand++; } } - - return aNewList; + //End command not found + return tokList.end(); } + + /* A specialty method for commands such as \arg that end at the end of a paragraph OR when another \arg is encountered + */ + +list::iterator getTilAnyCommand(string theCommand, TokenList &tokList){ + list::iterator anIterator; + return anIterator; + } + + + /* Method for Adding a Simple Command * Format: @command * Plain commands, such as newline etc, they contain no other data * \n \\ \@ \& \$ \# \< \> \% */ - int addSimpleCommand(string theCommand, int &startInd, list &doxyList, string doxygenString){ + int addSimpleCommand(string theCommand, list &doxyList){ if (noisy) cout << "Parsing " << theCommand << endl; doxyList.push_back(DoxygenEntity(theCommand)); @@ -824,7 +381,7 @@ string getStringTilCommand(int &startInd, string doxygenString){ * Format: @command * Plain commands, such as newline etc, they contain no other data */ - int ignoreSimpleCommand(string theCommand, int &startInd, list &doxyList, string doxygenString){ + int ignoreSimpleCommand(string theCommand, list &doxyList){ if (noisy) cout << "Not Adding " << theCommand << endl; return 1; @@ -836,9 +393,9 @@ string getStringTilCommand(int &startInd, string doxygenString){ * "a", "b", "c", "e", "em", "p", "def", "enum", "example", "package", * "relates", "namespace", "relatesalso","anchor", "dontinclude", "include", "includelineno" */ - int addCommandWord(string theCommand, int &startInd, list &doxyList, string doxygenString){ + int addCommandWord(string theCommand, TokenList &tokList, list &doxyList){ if (noisy) cout << "Parsing " << theCommand << endl; - string name = getNextWord(startInd, doxygenString); + string name = getNextWord(tokList); if (!name.empty()){ doxyList.push_back(DoxygenEntity(theCommand, name)); return 1; @@ -851,9 +408,9 @@ string getStringTilCommand(int &startInd, string doxygenString){ * Commands with a single WORD after then such as @b * "copydoc", "copybrief", "copydetails", "verbinclude", "htmlinclude" */ - int ignoreCommandWord(string theCommand, int &startInd, list &doxyList, string doxygenString){ + int ignoreCommandWord(string theCommand, TokenList &tokList, list &doxyList){ if (noisy) cout << "Not Adding " << theCommand << endl; - string name = getNextWord(startInd, doxygenString); + string name = getNextWord(tokList); if (!name.empty()){ return 1; } @@ -866,18 +423,14 @@ string getStringTilCommand(int &startInd, string doxygenString){ * Commands with a single LINE after then such as @var * "addindex", "fn", "name", "line", "var", "skipline", "typedef", "skip", "until", "property" */ - int addCommandLine(string theCommand, int &startInd, list &doxyList, string doxygenString){ + int addCommandLine(string theCommand, TokenList &tokList, list &doxyList){ if (noisy) cout << "Parsing " << theCommand << endl; - string line = getOneLine(startInd, doxygenString); - if(!line.empty()){ - int placement = 0; + list::iterator endOfLine = getOneLine(tokList); list aNewList; - aNewList = parse(placement, line); + aNewList = parse(endOfLine, tokList); doxyList.push_back( DoxygenEntity(theCommand, aNewList)); return 1; - } - else cout << "No line followed " << theCommand << " command. Not added" << endl; - return 0; + } /* NOT INCLUDED CommandLine @@ -885,14 +438,11 @@ string getStringTilCommand(int &startInd, string doxygenString){ * Commands with a single LINE after then such as @var * */ - int ignoreCommandLine(string theCommand, int &startInd, list &doxyList, string doxygenString){ + int ignoreCommandLine(string theCommand, TokenList &tokList, list &doxyList){ if (noisy) cout << "Not Adding " << theCommand << endl; - string line = getOneLine(startInd, doxygenString); - if(!line.empty()){ - return 1; - } - else cout << "WARNING: No line followed " << theCommand << " command." << endl; - return 0; + list::iterator endOfLine = getOneLine(tokList); + tokList.setIterator(endOfLine); + return 1; } /* CommandParagraph @@ -901,32 +451,28 @@ string getStringTilCommand(int &startInd, string doxygenString){ * "return", "remarks", "since", "test", "sa", "see", "pre", "post", "details", "invariant", * "deprecated", "date", "note", "warning", "version", "todo", "bug", "attention", "brief", "arg", "author" */ - int addCommandParagraph(string theCommand, int &startInd, list &doxyList, string doxygenString){ + int addCommandParagraph(string theCommand, TokenList &tokList, list &doxyList){ if (noisy) cout << "Parsing " << theCommand << endl; - string restOfParagraph = getStringTilEndOfParagraph(startInd, doxygenString); - if(!restOfParagraph.empty()){ - int placement = 0; - list aNewList; - aNewList = parse(placement, restOfParagraph); - doxyList.push_back( DoxygenEntity(theCommand, aNewList)); - return 1; - } - else cout << "No line followed " << theCommand << " command. Not added" << endl; - return 0; + list::iterator endOfParagraph = getEndOfParagraph(tokList); + //if(!restOfParagraph.empty()){ + list aNewList; + aNewList = parse(endOfParagraph, tokList); + doxyList.push_back( DoxygenEntity(theCommand, aNewList)); + return 1; + // } + //else cout << "No line followed " << theCommand << " command. Not added" << endl; } /* CommandParagraph * Format: @command {paragraph} * Commands with a single LINE after then such as @var * */ - int ignoreCommandParagraph(string theCommand, int &startInd, list &doxyList, string doxygenString){ + int ignoreCommandParagraph(string theCommand, TokenList &tokList, list &doxyList){ if (noisy) cout << "Not Adding " << theCommand << endl; - string restOfParagraph = getStringTilEndOfParagraph(startInd, doxygenString); - if(!restOfParagraph.empty()){ - return 1; - } - else cout << "WARNING: No line followed " << theCommand << " command." << endl; - return 0; + list::iterator endOfParagraph = getEndOfParagraph(tokList); + tokList.setIterator(endOfParagraph); + //else cout << "WARNING: No line followed " << theCommand << " command." << endl; + return 1; } /* Command EndCommand * Format: @command and ends at @endcommand @@ -936,10 +482,11 @@ string getStringTilCommand(int &startInd, string doxygenString){ * Returns 1 if success, 0 if the endcommand is never encountered. */ - int ignoreCommandEndCommand(string theCommand, int &startInd, list &doxyList, string doxygenString){ + int addCommandEndCommand(string theCommand, TokenList &tokList, list &doxyList){ if (noisy) cout << "Not Adding " << theCommand << endl; - return progressTilEndCommand( "end" + theCommand, startInd, doxygenString); - + string description = getStringTilEndCommand( "end" + theCommand, tokList); + doxyList.push_back(DoxygenEntity(theCommand, description)); + return 1; } /* CommandWordParagraph @@ -947,23 +494,19 @@ string getStringTilCommand(int &startInd, string doxygenString){ * Commands such as param * "param", "tparam", "throw", "retval", "exception" */ - int addCommandWordParagraph(string theCommand, int &startInd, list &doxyList, string doxygenString){ + int addCommandWordParagraph(string theCommand, TokenList &tokList, list &doxyList){ if (noisy) cout << "Parsing " << theCommand << endl; - string name = getNextWord(startInd, doxygenString); + string name = getNextWord(tokList); if (name.empty()){ cout << "No word followed " << theCommand << " command. Not added" << endl; return 0; } - string restOfParagraph = getStringTilEndOfParagraph(startInd, doxygenString); - int placement = 0; - if(!restOfParagraph.empty()){ + list::iterator endOfParagraph = getEndOfParagraph(tokList); + //if(!restOfParagraph.empty()){ list aNewList; - aNewList = parse(placement, restOfParagraph); + aNewList = parse(endOfParagraph, tokList); aNewList.push_front(DoxygenEntity("plainstring", name)); doxyList.push_back(DoxygenEntity(theCommand, aNewList)); - return 1; - } - else cout << "No paragraph followed " << theCommand << " command. Not added" << endl; return 0; } /* CommandWordLine @@ -971,40 +514,37 @@ string getStringTilCommand(int &startInd, string doxygenString){ * Commands such as param * "page", "subsection", "subsubsection", "section", "paragraph", "defgroup" */ - int addCommandWordLine(string theCommand, int &startInd, list &doxyList, string doxygenString){ + int addCommandWordLine(string theCommand, TokenList &tokList, list &doxyList){ if (noisy) cout << "Parsing " << theCommand << endl; - string name = getNextWord(startInd, doxygenString); + string name = getNextWord(tokList); if (name.empty()){ cout << "No word followed " << theCommand << " command. Not added" << endl; return 0; } - string restOfLine = getStringTilEndOfParagraph(startInd, doxygenString); - int placement = 0; - if(!restOfLine.empty()){ - list aNewList; - aNewList = parse(placement, restOfLine); - aNewList.push_front(DoxygenEntity("plainstring", name)); - doxyList.push_back(DoxygenEntity(theCommand, aNewList)); - return 1; - } - else cout << "No line followed " << theCommand << " command. Not added" << endl; - return 0; + list::iterator endOfLine = getOneLine(tokList); + list aNewList; + aNewList = parse(endOfLine, tokList); + aNewList.push_front(DoxygenEntity("plainstring", name)); + doxyList.push_back(DoxygenEntity(theCommand, aNewList)); + return 1; + + //else cout << "No line followed " << theCommand << " command. Not added" << endl; } - + /* Command Word Optional Word Optional Word * Format: @command [] [] * Commands such as class * "category", "class", "protocol", "interface", "struct", "union" */ - int addCommandWordOWordOWord(string theCommand, int &startInd, list &doxyList, string doxygenString){ + int addCommandWordOWordOWord(string theCommand, TokenList &tokList, list &doxyList){ if (noisy) cout << "Parsing " << theCommand << endl; - string name = getNextWord(startInd, doxygenString); + string name = getNextWord(tokList); if (name.empty()){ cout << "No word followed " << theCommand << " command. Not added" << endl; return 0; } - string headerfile = getNextWord(startInd, doxygenString); - string headername = getNextWord(startInd, doxygenString); + string headerfile = getNextWord(tokList); + string headername = getNextWord(tokList); list aNewList; aNewList.push_back(DoxygenEntity("plainstring", name)); if (!headerfile.empty()) aNewList.push_back(DoxygenEntity("plainstring", headerfile)); @@ -1018,12 +558,138 @@ string getStringTilCommand(int &startInd, string doxygenString){ * Commands such as dir * "dir", "file", "cond" */ - int addCommandOWord(string theCommand, int &startInd, list &doxyList, string doxygenString){ + int addCommandOWord(string theCommand, TokenList &tokList, list &doxyList){ if (noisy) cout << "Parsing " << theCommand << endl; - string name = getNextWord(startInd, doxygenString); + string name = getNextWord(tokList); doxyList.push_back(DoxygenEntity(theCommand, name)); return 1; } + + /* Commands that should not be encountered (such as PHP only) + */ + int addCommandErrorThrow(string theCommand, TokenList &tokList, list &doxyList){ + cout << "Encountered :" << theCommand << endl; + cout << "This command should not have been encountered. Behaviour past this may be unpredictable " << endl; + } + + + int addCommandUnique(string theCommand, TokenList &tokList, list &doxyList){ + list aNewList; + if (theCommand.compare("arg") == 0 || theCommand.compare("li") == 0){ + list::iterator endOfSection = getEndOfSection(theCommand, tokList); + list aNewList; + aNewList = parse(endOfSection, tokList); + doxyList.push_back( DoxygenEntity(theCommand, aNewList)); + } + + // \xrefitem "(heading)" "(list title)" {text} + else if (theCommand.compare("xrefitem") == 0){ + //TODO Implement xrefitem + if (noisy) cout << "Not Adding " << theCommand << endl; + list::iterator endOfParagraph = getEndOfParagraph(tokList); + tokList.setIterator(endOfParagraph); + return 1; + } + // \ingroup ( [ ]) + else if (theCommand.compare("ingroup") == 0){ + string name = getNextWord(tokList); + aNewList.push_back(DoxygenEntity("plainstring", name)); + name = getNextWord(tokList); + if(!name.empty()) aNewList.push_back(DoxygenEntity("plainstring", name)); + name = getNextWord(tokList); + if(!name.empty()) aNewList.push_back(DoxygenEntity("plainstring", name)); + doxyList.push_back(DoxygenEntity(theCommand, aNewList)); + return 1; + } + // \par [(paragraph title)] { paragraph } + else if (theCommand.compare("par") == 0){ + list::iterator endOfLine = getOneLine(tokList); + aNewList = parse(endOfLine, tokList); + list aNewList2; + aNewList2 = parse(endOfLine, tokList); + aNewList.splice(aNewList.end(), aNewList2); + doxyList.push_back(DoxygenEntity(theCommand, aNewList)); + return 1; + } + // \headerfile [] + else if (theCommand.compare("headerfile") == 0){ + list aNewList; + string name = getNextWord(tokList); + aNewList.push_back(DoxygenEntity("plainstring", name)); + name = getNextWord(tokList); + if(!name.empty()) aNewList.push_back(DoxygenEntity("plainstring", name)); + doxyList.push_back(DoxygenEntity(theCommand, aNewList)); + return 1; + } + // \overload [(function declaration)] + else if (theCommand.compare("overload") == 0){ + list::iterator endOfLine = getOneLine(tokList); + if (endOfLine != tokList.current()){ + list aNewList; + aNewList = parse(endOfLine, tokList); + doxyList.push_back(DoxygenEntity(theCommand, aNewList)); + } + else doxyList.push_back(DoxygenEntity(theCommand)); + } + // \weakgroup [(title)] + else if (theCommand.compare("weakgroup") == 0){ + if (noisy) cout << "Parsing " << theCommand << endl; + string name = getNextWord(tokList); + if (name.empty()){ + cout << "No word followed " << theCommand << " command. Not added" << endl; + return 0; + } + list aNewList; + list::iterator endOfLine = getOneLine(tokList); + if (endOfLine != tokList.current()) { + aNewList = parse(endOfLine, tokList); + } + aNewList.push_front(DoxygenEntity("plainstring", name)); + doxyList.push_back(DoxygenEntity(theCommand, aNewList)); + } + // \ref ["(text)"] + else if (theCommand.compare("ref") == 0){ + //TODO Implement ref + if (noisy) cout << "Not Adding " << theCommand << endl; + list::iterator endOfParagraph = getEndOfParagraph(tokList); + tokList.setIterator(endOfParagraph); + } + // \subpage ["(text)"] + else if (theCommand.compare("subpage") == 0){ + //TODO implement subpage + if (noisy) cout << "Not Adding " << theCommand << endl; + list::iterator endOfParagraph = getEndOfParagraph(tokList); + tokList.setIterator(endOfParagraph); + } + // \dotfile ["caption"] + else if (theCommand.compare("dotfile") == 0){ + //TODO implement dotfile + if (noisy) cout << "Not Adding " << theCommand << endl; + list::iterator endOfParagraph = getEndOfParagraph(tokList); + tokList.setIterator(endOfParagraph); + } + // \image ["caption"] [=] + else if (theCommand.compare("image") == 0){ + //todo implement image + } + // \addtogroup [(title)] + else if (theCommand.compare("addtogroup") == 0){ + if (noisy) cout << "Parsing " << theCommand << endl; + string name = getNextWord(tokList); + if (name.empty()){ + cout << "No word followed " << theCommand << " command. Not added" << endl; + return 0; + } + list aNewList; + list::iterator endOfLine = getOneLine(tokList); + if (endOfLine != tokList.current()) { + aNewList = parse(endOfLine, tokList); + } + aNewList.push_front(DoxygenEntity("plainstring", name)); + doxyList.push_back(DoxygenEntity(theCommand, aNewList)); + } + + } /* The actual "meat" of the doxygen parser. This is not yet fully implemented * with my current design- however the skeletal outline is contained in @@ -1031,121 +697,111 @@ string getStringTilCommand(int &startInd, string doxygenString){ */ - int addCommand(string commandString, int &startInd, list &doxyList, string doxygenString){ + int addCommand(string commandString, TokenList &tokList,list &doxyList){ string theCommand = StringToLower(commandString); - string voidArray[] = {""}; - /* @command */ - - + if (theCommand.compare("plainstring") == 0){ - string nextPhrase = getStringTilCommand(startInd, doxygenString); + string nextPhrase = getStringTilCommand( tokList); if (noisy) cout << "Parsing plain string :" << nextPhrase << endl; doxyList.push_back(DoxygenEntity("plainstring", nextPhrase )); return 1; } int commandNumber = commandBelongs(theCommand); - if (commandNumber == 1){ - return addSimpleCommand(theCommand, startInd,doxyList, doxygenString); + if (commandNumber == SIMPLECOMMAND){ + return addSimpleCommand(theCommand, doxyList); } - if (commandNumber == 2){ - return ignoreSimpleCommand(theCommand, startInd,doxyList, doxygenString); + if (commandNumber == IGNOREDSIMPLECOMMAND){ + return ignoreSimpleCommand(theCommand, doxyList); } - if (commandNumber == 3){ - return addCommandWord(theCommand, startInd,doxyList, doxygenString); + if (commandNumber == COMMANDWORD){ + return addCommandWord(theCommand, tokList, doxyList); } - if (commandNumber == 4){ - return ignoreCommandWord(theCommand, startInd,doxyList, doxygenString); + if (commandNumber == IGNOREDCOMMANDWORD){ + return ignoreCommandWord(theCommand, tokList, doxyList); } - if (commandNumber == 5){ - return addCommandLine(theCommand, startInd,doxyList, doxygenString); + if (commandNumber == COMMANDLINE ){ + return addCommandLine(theCommand, tokList, doxyList); } - if (commandNumber == 6){ - return ignoreCommandLine(theCommand, startInd,doxyList, doxygenString); + if (commandNumber == IGNOREDCOMMANDLINE ){ + return ignoreCommandLine(theCommand, tokList, doxyList); } - if (commandNumber == 7){ - return addCommandParagraph(theCommand, startInd,doxyList, doxygenString); + if (commandNumber == COMMANDPARAGRAPH){ + return addCommandParagraph(theCommand, tokList, doxyList); } - if (commandNumber == 8){ - return ignoreCommandParagraph(theCommand, startInd,doxyList, doxygenString); + if (commandNumber == IGNORECOMMANDPARAGRAPH){ + return ignoreCommandParagraph(theCommand, tokList, doxyList); } - if (commandNumber == 9){ - return ignoreCommandEndCommand(theCommand, startInd,doxyList, doxygenString); + if (commandNumber == COMMANDENDCOMMAND){ + return addCommandEndCommand(theCommand, tokList, doxyList); } - if (commandNumber == 10){ - return addCommandWordParagraph(theCommand, startInd,doxyList, doxygenString); + if (commandNumber == COMMANDWORDPARAGRAPH){ + return addCommandWordParagraph(theCommand, tokList, doxyList); } - if (commandNumber == 11){ - return addCommandWordLine(theCommand, startInd,doxyList, doxygenString); + if (commandNumber == COMMANDWORDLINE){ + return addCommandWordLine(theCommand, tokList, doxyList); } - if (commandNumber == 12){ - return addCommandWordOWordOWord(theCommand, startInd,doxyList, doxygenString); + if (commandNumber == COMMANDWORDOWORDWORD){ + return addCommandWordOWordOWord(theCommand, tokList, doxyList); } - if (commandNumber == 13){ - return addCommandOWord(theCommand, startInd,doxyList, doxygenString); + if (commandNumber == COMMANDOWORD){ + return addCommandOWord(theCommand, tokList, doxyList); } - if (commandNumber == 14){ - return 0; + if (commandNumber == COMMANDERRORTHROW){ + return addCommandErrorThrow(theCommand, tokList, doxyList); } - if (commandNumber == 15){ - return 0; + if (commandNumber == COMMANDUNIQUE){ + return addCommandUnique(theCommand, tokList, doxyList); } return 0; } - int weirdTest(){ - string doxygenString = "this is a test."; - string restOfParagraph; - int startIndex = 0; - restOfParagraph = getStringTilEndOfParagraph(startIndex , doxygenString); - cout << restOfParagraph<< " " << startIndex << endl; - - startIndex = 0; - restOfParagraph = getStringTilCommand(startIndex, doxygenString); - cout << restOfParagraph<< " " << startIndex << endl; - } - + list parse(list::iterator endParsingIndex, TokenList &tokList){ + list aNewList; + int currCommand; + while (tokList.current() != endParsingIndex){ + Token currToken = tokList.peek(); + if(noisy) cout << "Parsing for phrase starting in:" << currToken.toString() << endl; + if(currToken.tokenType == END_LINE ){ + tokList.next(); + } + else if(currToken.tokenType == COMMAND){ + currCommand = findCommand(currToken.tokenString); + tokList.next(); + if (currCommand < 0 ){ if(noisy) cout << "BAD COMMAND: " << currToken.tokenString << endl;} + //cout << "Command: " << currWord << " " << currCommand << endl; + else addCommand(currToken.tokenString, tokList, aNewList); + } + else if (currToken.tokenType == PLAINSTRING){ + addCommand(string("plainstring"), tokList, aNewList); + } - int doRunExamples(){ - string line; - string filename; - string exampleNames[] = {"Examples/Example1","Examples/Example2", "Examples/Example3", "Examples/Example4", "Examples/Example5"}; - int placement; - string doxygenString; - ifstream doxCommentFile; - for (int i = 0; i < 5; i++){ - doxCommentFile.open(exampleNames[i].c_str()); - doxCommentFile >> doxygenString; - while(getline(doxCommentFile, line)){ - doxygenString += line + "\n";} - doxCommentFile.close(); - placement = 0; - cout << "---RAW CODE---" << endl << doxygenString << endl< convert(string doxygenBlob){ + TokenList tokList = TokenList(doxygenBlob); + if(noisy) { + cout << "---TOKEN LIST---" << endl; + tokList.printList(); + } + list rootList; + rootList = parse( tokList.end(), tokList); + cout << "PARSED LIST" << endl; + printTree(rootList); + return rootList; + } + +int main(int argc, char *argv[]){ + string doxygenString1 = "//! A normal member taking two arguments and returning an integer value.\n/*!\n \\param a an \\b integer argument. \\param s a constant character pointer\n\n\n\n \\return The test results\n \\sa Test(), ~Test(), testMeToo() and publicVar()\n */"; + list rootList = convert(doxygenString1); + JavaDocConverter jDC = JavaDocConverter(); + jDC.convertToJavaDoc(rootList); + return 1; +} + + diff --git a/Source/DoxygenTranslator/JavaDocConverter.cpp b/Source/DoxygenTranslator/JavaDocConverter.cpp new file mode 100644 index 000000000..4e6fd93e6 --- /dev/null +++ b/Source/DoxygenTranslator/JavaDocConverter.cpp @@ -0,0 +1,104 @@ +#include "JavaDocConverter.h" +#include +#include +#include +#include + +int printTree = 1; +JavaDocConverter::JavaDocConverter() +{ +} + +JavaDocConverter::~JavaDocConverter() +{ +} + +/* Sorts entities by javaDoc standard order for commands + * NOTE: will not behave entirely properly until "First level" comments + * such as brief descriptions are TAGGED as such + */ +bool compare_DoxygenEntities(DoxygenEntity first, DoxygenEntity second){ + if(first.typeOfEntity.compare("plainstring") == 0) return true; + if(second.typeOfEntity.compare("plainstring") == 0) return false; + if(first.typeOfEntity.compare("param") == 0){ + if(second.typeOfEntity.compare("param")== 0) return true; + if(second.typeOfEntity.compare("return")== 0) return true; + if(second.typeOfEntity.compare("exception")== 0) return true; + if(second.typeOfEntity.compare("author")== 0) return true; + if(second.typeOfEntity.compare("version")== 0)return true; + if(second.typeOfEntity.compare("see")== 0)return true; + if(second.typeOfEntity.compare("since")== 0)return true; + if(second.typeOfEntity.compare("deprecated")== 0)return true; + return false; + } + if(first.typeOfEntity.compare("return")== 0){ + if(second.typeOfEntity.compare("return")== 0) return true; + if(second.typeOfEntity.compare("exception")== 0) return true; + if(second.typeOfEntity.compare("author")== 0) return true; + if(second.typeOfEntity.compare("version")== 0)return true; + if(second.typeOfEntity.compare("see")== 0)return true; + if(second.typeOfEntity.compare("since")== 0)return true; + if(second.typeOfEntity.compare("deprecated")== 0)return true; + return false; + + } + if(first.typeOfEntity.compare("exception")== 0){ + if(second.typeOfEntity.compare("exception")== 0) return true; + if(second.typeOfEntity.compare("author")== 0) return true; + if(second.typeOfEntity.compare("version")== 0)return true; + if(second.typeOfEntity.compare("see")== 0)return true; + if(second.typeOfEntity.compare("since")== 0)return true; + if(second.typeOfEntity.compare("deprecated")== 0)return true; + return false; + } + if(first.typeOfEntity.compare("author")== 0){ + if(first.typeOfEntity.compare("author")== 0) return true; + if(first.typeOfEntity.compare("version")== 0)return true; + if(first.typeOfEntity.compare("see")== 0)return true; + if(first.typeOfEntity.compare("since")== 0)return true; + if(first.typeOfEntity.compare("deprecated")== 0)return true; + return false; + } + if(first.typeOfEntity.compare("version")== 0){ + if(second.typeOfEntity.compare("version")== 0)return true; + if(second.typeOfEntity.compare("see")== 0)return true; + if(second.typeOfEntity.compare("since")== 0)return true; + if(second.typeOfEntity.compare("deprecated")== 0)return true; + return false; + } + if(first.typeOfEntity.compare("see")== 0){ + if(second.typeOfEntity.compare("see")== 0)return true; + if(second.typeOfEntity.compare("since")== 0)return true; + if(second.typeOfEntity.compare("deprecated")== 0)return true; + return false; + } + if(first.typeOfEntity.compare("since")== 0){ + if(second.typeOfEntity.compare("since")== 0) return true; + if(second.typeOfEntity.compare("deprecated")== 0)return true; + return false; + } + if(first.typeOfEntity.compare("deprecated")== 0){ + if(second.typeOfEntity.compare("deprecated")== 0)return true; + return false; + } + return true; +} + +string JavaDocConverter:: convertToJavaDoc(list entityList){ + + list::iterator entityIterator = entityList.begin(); + entityList.sort(compare_DoxygenEntities); + + cout << "---RESORTED LIST---" << endl; + if (printTree ){ + list::iterator p = entityList.begin(); + while (p != entityList.end()){ + (*p).printEntity(0); + p++; + } + } + string javaDocString = "/**\n"; + + javaDocString += "*/\n"; + return javaDocString; +} diff --git a/Source/DoxygenTranslator/JavaDocConverter.h b/Source/DoxygenTranslator/JavaDocConverter.h new file mode 100644 index 000000000..b1c76ef17 --- /dev/null +++ b/Source/DoxygenTranslator/JavaDocConverter.h @@ -0,0 +1,17 @@ + #include + #include + #include "DoxygenEntity.h" + +#ifndef JAVADOCCONVERTER_H_ +#define JAVADOCCONVERTER_H_ + +class JavaDocConverter +{ +public: + + JavaDocConverter(); + string convertToJavaDoc(list entityList); + ~JavaDocConverter(); +}; + +#endif /*JAVADOCCONVERTER_H_*/ diff --git a/Source/DoxygenTranslator/Token.h b/Source/DoxygenTranslator/Token.h index d569f5f7b..e98686c14 100644 --- a/Source/DoxygenTranslator/Token.h +++ b/Source/DoxygenTranslator/Token.h @@ -13,8 +13,8 @@ class Token public: Token(int tType, string tString); ~Token(); - int tokenType; - string tokenString; + int tokenType; /* currently can be END_LINE, PLAINSTRING, or COMMAND */ + string tokenString; /* the data , such as param for @param*/ string toString(); }; diff --git a/Source/DoxygenTranslator/TokenList.cpp b/Source/DoxygenTranslator/TokenList.cpp index 6122328c4..0ace41c34 100644 --- a/Source/DoxygenTranslator/TokenList.cpp +++ b/Source/DoxygenTranslator/TokenList.cpp @@ -67,11 +67,8 @@ TokenList::TokenList(string doxygenString){ } Token TokenList::peek(){ - list::iterator p = tokenList.begin(); - if(p != tokenList.end()){ - p++; - Token returnedToken = (*p); - p--; + if(tokenListIterator!= tokenList.end()){ + Token returnedToken = (*tokenListIterator); return returnedToken; } else @@ -79,15 +76,22 @@ Token TokenList::peek(){ } Token TokenList::next(){ - list::iterator p = tokenList.begin(); - if(p != tokenList.end()){ - p++; - return (*p); + if(tokenListIterator != tokenList.end()){ + Token returnedToken = (*tokenListIterator); + tokenListIterator++; + return (returnedToken); } else return Token(0, ""); } +list::iterator TokenList::end(){ + return tokenList.end(); +} + +list::iterator TokenList::current(){ + return tokenListIterator; +} void TokenList::printList(){ list::iterator p = tokenList.begin(); int i = 1; @@ -100,4 +104,11 @@ void TokenList::printList(){ } } -TokenList:: ~TokenList(){} \ No newline at end of file +list::iterator TokenList::iteratorCopy(){ + list::iterator p = tokenListIterator; + return p; +} +void TokenList::setIterator(list::iterator newPosition){ + tokenListIterator = newPosition; +} +TokenList:: ~TokenList(){} diff --git a/Source/DoxygenTranslator/TokenList.h b/Source/DoxygenTranslator/TokenList.h index 153c69163..cc61f56e4 100644 --- a/Source/DoxygenTranslator/TokenList.h +++ b/Source/DoxygenTranslator/TokenList.h @@ -13,12 +13,15 @@ using namespace std; class TokenList{ public: - /* constructor takes a blob of Doxygen comment */ - TokenList(string doxygenString); + TokenList(string doxygenString); /* constructor takes a blob of Doxygen comment */ ~TokenList(); Token peek(); /* returns next token without advancing */ Token next(); /* returns next token and advances */ + list::iterator end(); /* returns an end iterator */ + list::iterator current(); /* returns the current iterator */ void printList(); /* prints out the sequence of tokens */ + list::iterator iteratorCopy(); /* returns a copy of the current iterator */ + void setIterator(list::iterator newPosition); /*moves up the iterator*/ }; #endif /*TOKENLIST_H_*/ From 86b62e146bba6606fe39240faae3b7b15cd45d81 Mon Sep 17 00:00:00 2001 From: Cheryl Foil Date: Sun, 20 Jul 2008 05:20:17 +0000 Subject: [PATCH 007/314] javDocConvertor now functional for some simple commands such as author, param, returns, and b. Commands with a specific javaDoc order are sorted appropriately. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2008-cherylfoil@10686 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- .../DoxygenTranslator/DoxygenTranslator.cpp | 13 +- Source/DoxygenTranslator/JavaDocConverter.cpp | 140 +++++++++++++++--- Source/DoxygenTranslator/JavaDocConverter.h | 1 + 3 files changed, 132 insertions(+), 22 deletions(-) diff --git a/Source/DoxygenTranslator/DoxygenTranslator.cpp b/Source/DoxygenTranslator/DoxygenTranslator.cpp index d6129cda0..96fe6b2c5 100644 --- a/Source/DoxygenTranslator/DoxygenTranslator.cpp +++ b/Source/DoxygenTranslator/DoxygenTranslator.cpp @@ -69,7 +69,7 @@ "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 sectionIndicators[] = { "attention", "author", "brief", "bug", "cond", "date", "deprecated", "details", @@ -78,7 +78,7 @@ "version", "warning", "xrefitem" }; /* All of the doxygen commands divided up by how they are parsed */ - string simpleCommands[] = {"n", "$", "@", "//", "&", "~", "<", ">", "#", "%"}; + string simpleCommands[] = {"n", "$", "@", "\\", "&", "~", "<", ">", "#", "%"}; string ignoredSimpleCommands[] = {"nothing at the moment"}; string commandWords[] = {"a", "b", "c", "e", "em", "p", "def", "enum", "example", "package", "relates", "namespace", "relatesalso","anchor", "dontinclude", "include", "includelineno"}; @@ -791,13 +791,16 @@ list convert(string doxygenBlob){ } list rootList; rootList = parse( tokList.end(), tokList); - cout << "PARSED LIST" << endl; - printTree(rootList); + if(noisy) { + cout << "PARSED LIST" << endl; + printTree(rootList); + } return rootList; } int main(int argc, char *argv[]){ - string doxygenString1 = "//! A normal member taking two arguments and returning an integer value.\n/*!\n \\param a an \\b integer argument. \\param s a constant character pointer\n\n\n\n \\return The test results\n \\sa Test(), ~Test(), testMeToo() and publicVar()\n */"; + string doxygenString1 = "//! A normal member taking two arguments and returning an integer value. This is a very long description for the simple purpose of showing off formatting. Let's make it a bit longer just to be sure. \n/*!\n \\param a an \\b integer argument.\n \\return The test results\n \\param s a constant character pointer. Let's also make this a very long description! \n \\bug this command should, for now, be totally ignored\n \\author cheryl foil\n \\sa Test(), ~Test(), testMeToo() and publicVar()\n */"; + cout << "---ORIGINAL DOXYGEN--- " << endl << doxygenString1 << endl; list rootList = convert(doxygenString1); JavaDocConverter jDC = JavaDocConverter(); jDC.convertToJavaDoc(rootList); diff --git a/Source/DoxygenTranslator/JavaDocConverter.cpp b/Source/DoxygenTranslator/JavaDocConverter.cpp index 4e6fd93e6..91f52662f 100644 --- a/Source/DoxygenTranslator/JavaDocConverter.cpp +++ b/Source/DoxygenTranslator/JavaDocConverter.cpp @@ -3,8 +3,10 @@ #include #include #include - -int printTree = 1; +#define APPROX_LINE_LENGTH 64//characters per line allowed +#define TAB_SIZE 8//characters per line allowed +int printSortedTree2 = 0; +//TODO {@link} {@linkplain} {@docRoot}, and other useful doxy commands that are not a javadoc tag JavaDocConverter::JavaDocConverter() { } @@ -40,7 +42,7 @@ bool compare_DoxygenEntities(DoxygenEntity first, DoxygenEntity second){ if(second.typeOfEntity.compare("since")== 0)return true; if(second.typeOfEntity.compare("deprecated")== 0)return true; return false; - + } if(first.typeOfEntity.compare("exception")== 0){ if(second.typeOfEntity.compare("exception")== 0) return true; @@ -66,8 +68,9 @@ bool compare_DoxygenEntities(DoxygenEntity first, DoxygenEntity second){ if(second.typeOfEntity.compare("deprecated")== 0)return true; return false; } - if(first.typeOfEntity.compare("see")== 0){ + if(first.typeOfEntity.compare("see")== 0 || first.typeOfEntity.compare("sa")== 0){ if(second.typeOfEntity.compare("see")== 0)return true; + if(second.typeOfEntity.compare("sa")== 0)return true; if(second.typeOfEntity.compare("since")== 0)return true; if(second.typeOfEntity.compare("deprecated")== 0)return true; return false; @@ -84,21 +87,124 @@ bool compare_DoxygenEntities(DoxygenEntity first, DoxygenEntity second){ return true; } -string JavaDocConverter:: convertToJavaDoc(list entityList){ - - list::iterator entityIterator = entityList.begin(); - entityList.sort(compare_DoxygenEntities); +void JavaDocConverter::printSortedTree(list &entityList){ + list::iterator p = entityList.begin(); + while (p != entityList.end()){ + (*p).printEntity(0); + p++; + } +} +string formatCommand(string unformattedLine, int indent){ + string formattedLines = "\n * "; + int lastPosition = 0; + int i = 0; + int isFirstLine = 1; + while (i != -1 && i < unformattedLine.length()){ + lastPosition = i; + if (isFirstLine){ + i+=APPROX_LINE_LENGTH; + } + else i+=APPROX_LINE_LENGTH - indent*TAB_SIZE; + i = unformattedLine.find(" ", i); - cout << "---RESORTED LIST---" << endl; - if (printTree ){ - list::iterator p = entityList.begin(); - while (p != entityList.end()){ - (*p).printEntity(0); + if (i > 0 && i + 1 < unformattedLine.length()){ + if (!isFirstLine) for (int j = 0; j < indent; j++) { + formattedLines.append("\t"); + } + else { + isFirstLine = 0; + } + formattedLines.append(unformattedLine.substr(lastPosition, i - lastPosition + 1)); + formattedLines.append("\n *"); + + } + } + if (lastPosition < unformattedLine.length()){ + if (!isFirstLine) {for (int j = 0; j < indent; j++) {formattedLines.append("\t");}} + formattedLines.append(unformattedLine.substr(lastPosition, unformattedLine.length() - lastPosition)); + } + + return formattedLines; +} + +/* Contains the conversions for tags + * could probably be much more efficient... + */ +string javaDocFormat(DoxygenEntity &doxygenEntity){ + if (doxygenEntity.typeOfEntity.compare("plainstring") == 0){ + return doxygenEntity.data; + } + else if (doxygenEntity.typeOfEntity.compare("brief") == 0){ + return doxygenEntity.data; + } + if (doxygenEntity.typeOfEntity.compare("detailed") == 0){ + return doxygenEntity.data; + } + else if (doxygenEntity.typeOfEntity.compare("b") == 0){ + return "" + doxygenEntity.data + ""; + } + else if (doxygenEntity.typeOfEntity.compare("c") == 0){ + return "" + doxygenEntity.data + ""; + } + return ""; +} + + +string translateSubtree( DoxygenEntity &doxygenEntity){ + string returnedString; + if (doxygenEntity.isLeaf){ return javaDocFormat(doxygenEntity) + " ";} + else { + returnedString += javaDocFormat(doxygenEntity); + list::iterator p = doxygenEntity.entityList.begin(); + while (p != doxygenEntity.entityList.end()){ + returnedString+= translateSubtree(*p); p++; } } - string javaDocString = "/**\n"; - - javaDocString += "*/\n"; - return javaDocString; + return returnedString; } + +string translateEntity(DoxygenEntity &doxyEntity){ + if(doxyEntity.typeOfEntity.compare("plainstring")== 0 || doxyEntity.typeOfEntity.compare("deprecated")== 0 || doxyEntity.typeOfEntity.compare("brief")== 0) + return formatCommand(doxyEntity.data, 0) + "\n * "; + else if(doxyEntity.typeOfEntity.compare("see") == 0){ + return formatCommand(string("@" + doxyEntity.typeOfEntity + "\t\t" + translateSubtree(doxyEntity)), 2); + } + else if(doxyEntity.typeOfEntity.compare("return")== 0 + || doxyEntity.typeOfEntity.compare("author")== 0 + || doxyEntity.typeOfEntity.compare("param")== 0 + || doxyEntity.typeOfEntity.compare("since")== 0 + || doxyEntity.typeOfEntity.compare("version")== 0 + || doxyEntity.typeOfEntity.compare("exception") == 0 + || doxyEntity.typeOfEntity.compare("deprecated") == 0){ + return formatCommand(string("@" + doxyEntity.typeOfEntity + "\t" + translateSubtree(doxyEntity)), 2); + } + else if(doxyEntity.typeOfEntity.compare("sa")== 0){ + return formatCommand(string("@see\t\t" + translateSubtree(doxyEntity)), 2); + } + + return ""; +} + +string JavaDocConverter:: convertToJavaDoc(list entityList){ + + + entityList.sort(compare_DoxygenEntities); + if(printSortedTree2){ + cout << "---RESORTED LIST---" << endl; + printSortedTree(entityList); + } + + string javaDocString = "/**"; + + list::iterator entityIterator = entityList.begin(); + while (entityIterator != entityList.end()){ + javaDocString += translateEntity(*entityIterator); + entityIterator++; + } + + javaDocString += "\n */\n"; + cout << "\n---RESULT IN JAVADOC---" << endl; + cout << javaDocString; + return javaDocString; +} \ No newline at end of file diff --git a/Source/DoxygenTranslator/JavaDocConverter.h b/Source/DoxygenTranslator/JavaDocConverter.h index b1c76ef17..81122bc5f 100644 --- a/Source/DoxygenTranslator/JavaDocConverter.h +++ b/Source/DoxygenTranslator/JavaDocConverter.h @@ -12,6 +12,7 @@ public: JavaDocConverter(); string convertToJavaDoc(list entityList); ~JavaDocConverter(); + void printSortedTree(list &entityList); }; #endif /*JAVADOCCONVERTER_H_*/ From 32beba3cab2943988aad8642d4569a45a761e5ef Mon Sep 17 00:00:00 2001 From: Cheryl Foil Date: Fri, 25 Jul 2008 06:15:32 +0000 Subject: [PATCH 008/314] Modifications to pick up Doxygen Comments and "post doxygen comments" and place them with appropriate attachments in the parse tree. Also a prototype for how to deal with comments describing structures marked with tags such as \class git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2008-cherylfoil@10710 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Source/CParse/cscanner.c | 38 +++++++++------- Source/CParse/parser.y | 94 ++++++++++++++++++++++++++++++++++------ 2 files changed, 104 insertions(+), 28 deletions(-) diff --git a/Source/CParse/cscanner.c b/Source/CParse/cscanner.c index 140b7fedd..ff7d5343c 100644 --- a/Source/CParse/cscanner.c +++ b/Source/CParse/cscanner.c @@ -420,21 +420,29 @@ int yylook(void) { return HBLOCK; case SWIG_TOKEN_COMMENT: - { - String *cmt = Scanner_text(scan); - char *loc = Char(cmt); - if ((strncmp(loc,"/*@SWIG@",6) == 0) && (loc[Len(cmt)-3] == '@')) { - scanner_locator(cmt); - } - - if (strncmp(loc, "/**", 3) == 0 || strncmp(loc, "///", 3) == 0||strncmp(loc, "/*!", 3) == 0||strncmp(loc, "//!", 3) == 0) { - printf("Doxygen Comment: %s lines %d-%d [%s]\n", Char(Scanner_file(scan)), Scanner_start_line(scan), Scanner_line(scan), loc); - yylval.str = NewString(loc); - return DOXYGENSTRING; - } - - - } + { + String *cmt = Scanner_text(scan); + char *loc = Char(cmt); + if ((strncmp(loc,"/*@SWIG@",6) == 0) && (loc[Len(cmt)-3] == '@')) { + scanner_locator(cmt); + } + if (strncmp(loc, "/**<", 4) == 0 || strncmp(loc, "///<", 3) == 0||strncmp(loc, "/*!<", 3) == 0||strncmp(loc, "//!<", 3) == 0) { + printf("Doxygen Post Comment: %s lines %d-%d [%s]\n", Char(Scanner_file(scan)), Scanner_start_line(scan), Scanner_line(scan), loc); + yylval.str = NewString(loc); + return DOXYGENPOSTSTRING; + } + if (strncmp(loc, "/**", 3) == 0 || strncmp(loc, "///", 3) == 0||strncmp(loc, "/*!", 3) == 0||strncmp(loc, "//!", 3) == 0) { + printf("Doxygen Comment: %s lines %d-%d [%s]\n", Char(Scanner_file(scan)), Scanner_start_line(scan), Scanner_line(scan), loc); + yylval.str = NewString(loc); + return DOXYGENSTRING; + } + /*DOES NOT WORK PROPERLY AT THE MINUTE + if (strncmp(loc, "//", 2)== 0) { + printf("C style Comment: %s lines %d-%d [%s]\n", Char(Scanner_file(scan)), Scanner_start_line(scan), Scanner_line(scan), loc); + yylval.str = NewString(loc); + return C_COMMENT_STRING; + }*/ + } break; case SWIG_TOKEN_ENDLINE: break; diff --git a/Source/CParse/parser.y b/Source/CParse/parser.y index 6a835c7f3..954b4a327 100644 --- a/Source/CParse/parser.y +++ b/Source/CParse/parser.y @@ -56,12 +56,36 @@ static int class_level = 0; static Node **class_decl = NULL; /* ----------------------------------------------------------------------------- - * Doxygen Comment Globals + * Doxygen Comment Globals and Assist Functions * ----------------------------------------------------------------------------- */ +int parseComments = 1; /* set this to activate Doxygen uptake into the parse tree */ +String *currentComment; /* Location of the stored Doxygen Comment */ +String *currentPostComment; /* Location of the stored Doxygen Post-Comment */ +String *currentCComment; /* Location of the stored C Comment */ +static Node *previousNode = NULL; /* Pointer to the previous node (for post comments) */ -int isComment = 0; /* boolean for parsing Doxygen Comments */ -String *currentComment = 0; /* Location of the stored Doxygen Comment */ -static String *sideDoxComments = 0; +/* NOT a safe method at the moment */ +int isStructuralDoxygen(String *s){ + char *k = Char(s); + while (k[0] != '\0' && k[0] != '\\' && k[0] != '@'){ + k++; + } + if (k[0] == '\0') return 0; + k++; + if (strncmp(k, "addtogroup", 10) == 0 || strncmp(k, "callgraph", 9) == 0 || strncmp(k, "callergraph", 11) == 0 + || strncmp(k, "category", 8) == 0 || strncmp(k, "class", 5) == 0 || strncmp(k, "def", 3) == 0 + || strncmp(k, "defgroup", 8) == 0 || strncmp(k, "dir", 3) == 0 || strncmp(k, "enum", 4) == 0 + || strncmp(k, "example", 7) == 0 || strncmp(k, "file", 4) == 0 || strncmp(k, "fn", 2) == 0 + || strncmp(k, "headerfile", 9) == 0 || strncmp(k, "hideinitializer", 12) == 0 || strncmp(k, "ingroup", 7) == 0 + || strncmp(k, "interface", 9) == 0 || strncmp(k, "internal", 8) == 0 || strncmp(k, "mainpage", 8) == 0 + || strncmp(k, "name", 4) == 0 || strncmp(k, "namespace", 9) == 0 || strncmp(k, "nosubgrouping", 13) == 0 + || strncmp(k, "overload", 8) == 0 || strncmp(k, "package", 7) == 0 || strncmp(k, "page", 4) == 0 + || strncmp(k, "property", 8) == 0 || strncmp(k, "protocol", 8) == 0 || strncmp(k, "relates", 7) == 0 + || strncmp(k, "relatesalso", 5) == 0 || strncmp(k, "showinitializer", 5) == 0 || strncmp(k, "struct", 5) == 0 + || strncmp(k, "typedef", 7) == 0 || strncmp(k, "union", 5) == 0 || strncmp(k, "var", 3) == 0 + || strncmp(k, "weakgroup", 9) == 0){ return 1;} + return 0; +} /* ----------------------------------------------------------------------------- * Assist Functions @@ -79,12 +103,21 @@ static Node *new_node(const String_or_char *tag) { set_nodeType(n,tag); Setfile(n,cparse_file); Setline(n,cparse_line); - /* Sets Comment if a Comment is Availible */ - if(isComment){ - String *copyComment = Copy(currentComment); - Setattr(n,"comment",copyComment); - isComment = 0; - } + if(parseComments){ + /* Sets any post comments to the previous node */ + if(previousNode != NULL && currentPostComment != 0){ + String *copyPostComment = Copy(currentComment); + Setattr(previousNode,"DoxygenPostComment",copyPostComment); + currentPostComment = 0; + } + /* Sets Doxygen Comment if a Comment is Availible */ + if(currentComment != 0){ + String *copyComment = Copy(currentComment); + Setattr(n,"DoxygenComment",copyComment); + currentComment = 0; + } + previousNode = n; + } return n; } @@ -1455,6 +1488,8 @@ static void tag_nodes(Node *n, const String_or_char *attrname, DOH *value) { %token COPERATOR %token PARSETYPE PARSEPARM PARSEPARMS %token DOXYGENSTRING +%token DOXYGENPOSTSTRING +%token C_COMMENT_STRING %left CAST %left QUESTIONMARK @@ -1527,7 +1562,8 @@ static void tag_nodes(Node *n, const String_or_char *attrname, DOH *value) { %type fname stringtype; %type featattr; %type doxygen_comment; - +%type c_style_comment; +%type doxygen_post_comment; %% /* ====================================================================== @@ -1585,6 +1621,8 @@ declaration : swig_directive { $$ = $1; } | c_declaration { $$ = $1; } | cpp_declaration { $$ = $1; } | doxygen_comment { $$ = $1; } + | c_style_comment { $$ = $1; } + | doxygen_post_comment { $$ = $1; } | SEMI { $$ = 0; } | error { $$ = 0; @@ -3156,12 +3194,40 @@ c_constructor_decl : storage_class type LPAREN parms RPAREN ctor_end { doxygen_comment : DOXYGENSTRING { - currentComment = NewString($1); - isComment = 1; + if(isStructuralDoxygen($1)){ + $$ = new_node("doxycomm"); + Setattr($$,"DoxygenComment",$1); + } + else { + if(currentComment != 0){ + Append(currentComment, $1); + } + else currentComment = $1; + $$ = 0; + } + } + ; + + +doxygen_post_comment : DOXYGENPOSTSTRING + { + if(currentPostComment != 0){ + Append(currentPostComment, $1); + } + else currentPostComment = $1; $$ = 0; } ; +c_style_comment : C_COMMENT_STRING + { + if(currentCComment != 0){ + Append(currentCComment, $1); + } + else currentCComment = $1; + $$ = 0; + } + ; /* ====================================================================== @@ -6009,3 +6075,5 @@ ParmList *Swig_cparse_parms(String *s) { /* Printf(stdout,"typeparse: '%s' ---> '%s'\n", s, top); */ return top; } + + From 4f2a579d6d7cf5f8208c0cb2f3af7de99795ba6d Mon Sep 17 00:00:00 2001 From: Cheryl Foil Date: Fri, 15 Aug 2008 23:36:18 +0000 Subject: [PATCH 009/314] Now works end to end :) DoxygenTranslator restructured and placed into SWIG, Changes to java.cxx and lang.cxx to accomodate this git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2008-cherylfoil@10761 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Source/CParse/cscanner.c | 8 +- Source/CParse/parser.y | 44 +- Source/DoxygenTranslator/src/.deps/.dirstamp | 0 .../src/.deps/DoxygenEntity.Po | 380 +++++++ .../src/.deps/DoxygenParser.Po | 398 ++++++++ .../src/.deps/DoxygenTranslator.Po | 401 ++++++++ .../src/.deps/JavaDocConverter.Po | 385 ++++++++ Source/DoxygenTranslator/src/.deps/Token.Po | 379 +++++++ .../DoxygenTranslator/src/.deps/TokenList.Po | 382 ++++++++ Source/DoxygenTranslator/src/.dirstamp | 0 .../DoxygenTranslator/src/DoxygenEntity.cpp | 89 ++ Source/DoxygenTranslator/src/DoxygenEntity.h | 26 + .../DoxygenTranslator/src/DoxygenParser.cpp | 797 +++++++++++++++ Source/DoxygenTranslator/src/DoxygenParser.h | 19 + .../src/DoxygenTranslator.cpp | 41 + .../DoxygenTranslator/src/DoxygenTranslator.h | 10 + .../src/Examples/DoxygenTransWTokenizer.cpp | 924 ++++++++++++++++++ .../src/Examples/DoxygenTransWTokenizer.h | 11 + .../{ => src}/Examples/Example1 | 0 .../{ => src}/Examples/Example2 | 0 .../{ => src}/Examples/Example3 | 0 .../{ => src}/Examples/Example4 | 0 .../DoxygenTranslator/src/Examples/Example5 | 0 .../DoxygenTranslator/src/Examples/Example6 | 0 .../src/Examples/translator.h | 144 +++ .../src/JavaDocConverter.cpp | 210 ++++ .../DoxygenTranslator/src/JavaDocConverter.h | 18 + Source/DoxygenTranslator/src/Token.cpp | 32 + Source/DoxygenTranslator/src/Token.h | 21 + Source/DoxygenTranslator/src/TokenList.cpp | 116 +++ Source/DoxygenTranslator/src/TokenList.h | 27 + .../DoxygenTranslator/src/TranslatorTest.cpp | 68 ++ Source/DoxygenTranslator/src/TranslatorTest.h | 11 + Source/Makefile.am | 14 +- Source/Modules/java.cxx | 119 ++- Source/Modules/lang.cxx | 21 +- Source/Modules/swigmod.h | 6 + Tools/config/config.guess | 34 +- Tools/config/config.sub | 24 +- 39 files changed, 5101 insertions(+), 58 deletions(-) create mode 100644 Source/DoxygenTranslator/src/.deps/.dirstamp create mode 100644 Source/DoxygenTranslator/src/.deps/DoxygenEntity.Po create mode 100644 Source/DoxygenTranslator/src/.deps/DoxygenParser.Po create mode 100644 Source/DoxygenTranslator/src/.deps/DoxygenTranslator.Po create mode 100644 Source/DoxygenTranslator/src/.deps/JavaDocConverter.Po create mode 100644 Source/DoxygenTranslator/src/.deps/Token.Po create mode 100644 Source/DoxygenTranslator/src/.deps/TokenList.Po create mode 100644 Source/DoxygenTranslator/src/.dirstamp create mode 100644 Source/DoxygenTranslator/src/DoxygenEntity.cpp create mode 100644 Source/DoxygenTranslator/src/DoxygenEntity.h create mode 100644 Source/DoxygenTranslator/src/DoxygenParser.cpp create mode 100644 Source/DoxygenTranslator/src/DoxygenParser.h create mode 100644 Source/DoxygenTranslator/src/DoxygenTranslator.cpp create mode 100644 Source/DoxygenTranslator/src/DoxygenTranslator.h create mode 100644 Source/DoxygenTranslator/src/Examples/DoxygenTransWTokenizer.cpp create mode 100644 Source/DoxygenTranslator/src/Examples/DoxygenTransWTokenizer.h rename Source/DoxygenTranslator/{ => src}/Examples/Example1 (100%) rename Source/DoxygenTranslator/{ => src}/Examples/Example2 (100%) rename Source/DoxygenTranslator/{ => src}/Examples/Example3 (100%) rename Source/DoxygenTranslator/{ => src}/Examples/Example4 (100%) create mode 100644 Source/DoxygenTranslator/src/Examples/Example5 create mode 100644 Source/DoxygenTranslator/src/Examples/Example6 create mode 100644 Source/DoxygenTranslator/src/Examples/translator.h create mode 100644 Source/DoxygenTranslator/src/JavaDocConverter.cpp create mode 100644 Source/DoxygenTranslator/src/JavaDocConverter.h create mode 100644 Source/DoxygenTranslator/src/Token.cpp create mode 100644 Source/DoxygenTranslator/src/Token.h create mode 100644 Source/DoxygenTranslator/src/TokenList.cpp create mode 100644 Source/DoxygenTranslator/src/TokenList.h create mode 100644 Source/DoxygenTranslator/src/TranslatorTest.cpp create mode 100644 Source/DoxygenTranslator/src/TranslatorTest.h diff --git a/Source/CParse/cscanner.c b/Source/CParse/cscanner.c index ff7d5343c..13e976b95 100644 --- a/Source/CParse/cscanner.c +++ b/Source/CParse/cscanner.c @@ -426,7 +426,7 @@ int yylook(void) { if ((strncmp(loc,"/*@SWIG@",6) == 0) && (loc[Len(cmt)-3] == '@')) { scanner_locator(cmt); } - if (strncmp(loc, "/**<", 4) == 0 || strncmp(loc, "///<", 3) == 0||strncmp(loc, "/*!<", 3) == 0||strncmp(loc, "//!<", 3) == 0) { + if (strncmp(loc, "/**<", 4) == 0 || strncmp(loc, "///<", 4) == 0||strncmp(loc, "/*!<", 4) == 0||strncmp(loc, "//!<", 4) == 0) { printf("Doxygen Post Comment: %s lines %d-%d [%s]\n", Char(Scanner_file(scan)), Scanner_start_line(scan), Scanner_line(scan), loc); yylval.str = NewString(loc); return DOXYGENPOSTSTRING; @@ -436,12 +436,6 @@ int yylook(void) { yylval.str = NewString(loc); return DOXYGENSTRING; } - /*DOES NOT WORK PROPERLY AT THE MINUTE - if (strncmp(loc, "//", 2)== 0) { - printf("C style Comment: %s lines %d-%d [%s]\n", Char(Scanner_file(scan)), Scanner_start_line(scan), Scanner_line(scan), loc); - yylval.str = NewString(loc); - return C_COMMENT_STRING; - }*/ } break; case SWIG_TOKEN_ENDLINE: diff --git a/Source/CParse/parser.y b/Source/CParse/parser.y index 954b4a327..eaf53449b 100644 --- a/Source/CParse/parser.y +++ b/Source/CParse/parser.y @@ -64,26 +64,25 @@ String *currentPostComment; /* Location of the stored Doxygen Post-Comment */ String *currentCComment; /* Location of the stored C Comment */ static Node *previousNode = NULL; /* Pointer to the previous node (for post comments) */ -/* NOT a safe method at the moment */ int isStructuralDoxygen(String *s){ - char *k = Char(s); - while (k[0] != '\0' && k[0] != '\\' && k[0] != '@'){ - k++; - } - if (k[0] == '\0') return 0; - k++; - if (strncmp(k, "addtogroup", 10) == 0 || strncmp(k, "callgraph", 9) == 0 || strncmp(k, "callergraph", 11) == 0 - || strncmp(k, "category", 8) == 0 || strncmp(k, "class", 5) == 0 || strncmp(k, "def", 3) == 0 - || strncmp(k, "defgroup", 8) == 0 || strncmp(k, "dir", 3) == 0 || strncmp(k, "enum", 4) == 0 - || strncmp(k, "example", 7) == 0 || strncmp(k, "file", 4) == 0 || strncmp(k, "fn", 2) == 0 - || strncmp(k, "headerfile", 9) == 0 || strncmp(k, "hideinitializer", 12) == 0 || strncmp(k, "ingroup", 7) == 0 - || strncmp(k, "interface", 9) == 0 || strncmp(k, "internal", 8) == 0 || strncmp(k, "mainpage", 8) == 0 - || strncmp(k, "name", 4) == 0 || strncmp(k, "namespace", 9) == 0 || strncmp(k, "nosubgrouping", 13) == 0 - || strncmp(k, "overload", 8) == 0 || strncmp(k, "package", 7) == 0 || strncmp(k, "page", 4) == 0 - || strncmp(k, "property", 8) == 0 || strncmp(k, "protocol", 8) == 0 || strncmp(k, "relates", 7) == 0 - || strncmp(k, "relatesalso", 5) == 0 || strncmp(k, "showinitializer", 5) == 0 || strncmp(k, "struct", 5) == 0 - || strncmp(k, "typedef", 7) == 0 || strncmp(k, "union", 5) == 0 || strncmp(k, "var", 3) == 0 - || strncmp(k, "weakgroup", 9) == 0){ return 1;} + char *slashPointer = Strchr(s, '\\'); + char *atPointer = Strchr(s,'@'); + if (slashPointer == NULL && atPointer == NULL) return 0; + else if( slashPointer == NULL) slashPointer = atPointer; + /* Perhaps a better solution exists... */ + slashPointer++; + if (strncmp(slashPointer, "addtogroup", 10) == 0 || strncmp(slashPointer, "callgraph", 9) == 0 || strncmp(slashPointer, "callergraph", 11) == 0 + || strncmp(slashPointer, "category", 8) == 0 || strncmp(slashPointer, "class", 5) == 0 || strncmp(slashPointer, "def", 3) == 0 + || strncmp(slashPointer, "defgroup", 8) == 0 || strncmp(slashPointer, "dir", 3) == 0 || strncmp(slashPointer, "enum", 4) == 0 + || strncmp(slashPointer, "example", 7) == 0 || strncmp(slashPointer, "file", 4) == 0 || strncmp(slashPointer, "fn", 2) == 0 + || strncmp(slashPointer, "headerfile", 9) == 0 || strncmp(slashPointer, "hideinitializer", 12) == 0 || strncmp(slashPointer, "ingroup", 7) == 0 + || strncmp(slashPointer, "interface", 9) == 0 || strncmp(slashPointer, "internal", 8) == 0 || strncmp(slashPointer, "mainpage", 8) == 0 + || strncmp(slashPointer, "name", 4) == 0 || strncmp(slashPointer, "namespace", 9) == 0 || strncmp(slashPointer, "nosubgrouping", 13) == 0 + || strncmp(slashPointer, "overload", 8) == 0 || strncmp(slashPointer, "package", 7) == 0 || strncmp(slashPointer, "page", 4) == 0 + || strncmp(slashPointer, "property", 8) == 0 || strncmp(slashPointer, "protocol", 8) == 0 || strncmp(slashPointer, "relates", 7) == 0 + || strncmp(slashPointer, "relatesalso", 5) == 0 || strncmp(slashPointer, "showinitializer", 5) == 0 || strncmp(slashPointer, "struct", 5) == 0 + || strncmp(slashPointer, "typedef", 7) == 0 || strncmp(slashPointer, "union", 5) == 0 || strncmp(slashPointer, "var", 3) == 0 + || strncmp(slashPointer, "weakgroup", 9) == 0){ return 1;} return 0; } @@ -4091,8 +4090,8 @@ cpp_members : cpp_member cpp_members { appendChild($$,$4); set_nextSibling($$,$6); } - | include_directive { $$ = $1; } - | empty { $$ = 0;} + | include_directive { $$ = $1; } + | empty { $$ = 0;} | error { int start_line = cparse_line; skip_decl(); @@ -4136,6 +4135,9 @@ cpp_member : c_declaration { $$ = $1; } | storage_class idcolon SEMI { $$ = 0; } | cpp_using_decl { $$ = $1; } | cpp_template_decl { $$ = $1; } + | doxygen_comment{ $$ = $1; } + | c_style_comment{ $$ = $1; } + | doxygen_post_comment{ $$ = $1; } | cpp_catch_decl { $$ = 0; } | template_directive { $$ = $1; } | warn_directive { $$ = $1; } diff --git a/Source/DoxygenTranslator/src/.deps/.dirstamp b/Source/DoxygenTranslator/src/.deps/.dirstamp new file mode 100644 index 000000000..e69de29bb diff --git a/Source/DoxygenTranslator/src/.deps/DoxygenEntity.Po b/Source/DoxygenTranslator/src/.deps/DoxygenEntity.Po new file mode 100644 index 000000000..7d2d2e0db --- /dev/null +++ b/Source/DoxygenTranslator/src/.deps/DoxygenEntity.Po @@ -0,0 +1,380 @@ +DoxygenTranslator/src/DoxygenEntity.o \ + DoxygenTranslator/src/DoxygenEntity.o: \ + DoxygenTranslator/src/DoxygenEntity.cpp \ + DoxygenTranslator/src/DoxygenEntity.h /usr/include/c++/4.2/cstdlib \ + /usr/include/c++/4.2/i486-linux-gnu/bits/c++config.h \ + /usr/include/c++/4.2/i486-linux-gnu/bits/os_defines.h \ + /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/include/c++/4.2/i486-linux-gnu/bits/cpu_defines.h \ + /usr/include/c++/4.2/cstddef \ + /usr/lib/gcc/i486-linux-gnu/4.2.3/include/stddef.h \ + /usr/include/stdlib.h /usr/include/bits/waitflags.h \ + /usr/include/bits/waitstatus.h /usr/include/endian.h \ + /usr/include/bits/endian.h /usr/include/xlocale.h \ + /usr/include/sys/types.h /usr/include/bits/types.h \ + /usr/include/bits/typesizes.h /usr/include/time.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/c++/4.2/iostream \ + /usr/include/c++/4.2/ostream /usr/include/c++/4.2/ios \ + /usr/include/c++/4.2/iosfwd \ + /usr/include/c++/4.2/i486-linux-gnu/bits/c++locale.h \ + /usr/include/c++/4.2/cstring /usr/include/string.h \ + /usr/include/c++/4.2/cstdio /usr/include/stdio.h /usr/include/libio.h \ + /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/lib/gcc/i486-linux-gnu/4.2.3/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/c++/4.2/clocale /usr/include/locale.h \ + /usr/include/bits/locale.h /usr/include/langinfo.h \ + /usr/include/nl_types.h /usr/include/iconv.h /usr/include/libintl.h \ + /usr/include/c++/4.2/cstdarg \ + /usr/include/c++/4.2/i486-linux-gnu/bits/c++io.h \ + /usr/include/c++/4.2/i486-linux-gnu/bits/gthr.h \ + /usr/include/c++/4.2/i486-linux-gnu/bits/gthr-default.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/signal.h /usr/include/bits/setjmp.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/environments.h \ + /usr/include/bits/confname.h /usr/include/getopt.h \ + /usr/include/c++/4.2/cctype /usr/include/ctype.h \ + /usr/include/c++/4.2/bits/stringfwd.h \ + /usr/include/c++/4.2/bits/postypes.h /usr/include/c++/4.2/cwchar \ + /usr/include/c++/4.2/ctime /usr/include/bits/wchar.h \ + /usr/include/stdint.h /usr/include/c++/4.2/bits/functexcept.h \ + /usr/include/c++/4.2/exception_defines.h /usr/include/c++/4.2/exception \ + /usr/include/c++/4.2/bits/char_traits.h \ + /usr/include/c++/4.2/bits/stl_algobase.h /usr/include/c++/4.2/climits \ + /usr/lib/gcc/i486-linux-gnu/4.2.3/include/limits.h \ + /usr/lib/gcc/i486-linux-gnu/4.2.3/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/xopen_lim.h \ + /usr/include/c++/4.2/bits/stl_pair.h \ + /usr/include/c++/4.2/bits/cpp_type_traits.h \ + /usr/include/c++/4.2/ext/type_traits.h /usr/include/c++/4.2/utility \ + /usr/include/c++/4.2/bits/stl_relops.h \ + /usr/include/c++/4.2/bits/stl_iterator_base_types.h \ + /usr/include/c++/4.2/bits/stl_iterator_base_funcs.h \ + /usr/include/c++/4.2/bits/concept_check.h \ + /usr/include/c++/4.2/bits/stl_iterator.h \ + /usr/include/c++/4.2/debug/debug.h \ + /usr/include/c++/4.2/bits/localefwd.h \ + /usr/include/c++/4.2/bits/ios_base.h \ + /usr/include/c++/4.2/ext/atomicity.h \ + /usr/include/c++/4.2/i486-linux-gnu/bits/atomic_word.h \ + /usr/include/c++/4.2/bits/locale_classes.h /usr/include/c++/4.2/string \ + /usr/include/c++/4.2/memory /usr/include/c++/4.2/bits/allocator.h \ + /usr/include/c++/4.2/i486-linux-gnu/bits/c++allocator.h \ + /usr/include/c++/4.2/ext/new_allocator.h /usr/include/c++/4.2/new \ + /usr/include/c++/4.2/bits/stl_construct.h \ + /usr/include/c++/4.2/bits/stl_uninitialized.h \ + /usr/include/c++/4.2/bits/stl_raw_storage_iter.h \ + /usr/include/c++/4.2/limits /usr/include/c++/4.2/bits/ostream_insert.h \ + /usr/include/c++/4.2/bits/stl_function.h \ + /usr/include/c++/4.2/bits/basic_string.h /usr/include/c++/4.2/algorithm \ + /usr/include/c++/4.2/bits/stl_algo.h \ + /usr/include/c++/4.2/bits/stl_heap.h \ + /usr/include/c++/4.2/bits/stl_tempbuf.h \ + /usr/include/c++/4.2/bits/basic_string.tcc \ + /usr/include/c++/4.2/streambuf /usr/include/c++/4.2/bits/streambuf.tcc \ + /usr/include/c++/4.2/bits/basic_ios.h \ + /usr/include/c++/4.2/bits/streambuf_iterator.h \ + /usr/include/c++/4.2/bits/locale_facets.h /usr/include/c++/4.2/cwctype \ + /usr/include/wctype.h \ + /usr/include/c++/4.2/i486-linux-gnu/bits/ctype_base.h \ + /usr/include/c++/4.2/i486-linux-gnu/bits/ctype_inline.h \ + /usr/include/c++/4.2/bits/codecvt.h \ + /usr/include/c++/4.2/i486-linux-gnu/bits/time_members.h \ + /usr/include/c++/4.2/i486-linux-gnu/bits/messages_members.h \ + /usr/include/c++/4.2/bits/basic_ios.tcc \ + /usr/include/c++/4.2/bits/ostream.tcc /usr/include/c++/4.2/locale \ + /usr/include/c++/4.2/bits/locale_facets.tcc \ + /usr/include/c++/4.2/typeinfo /usr/include/c++/4.2/istream \ + /usr/include/c++/4.2/bits/istream.tcc /usr/include/c++/4.2/list \ + /usr/include/c++/4.2/bits/stl_list.h /usr/include/c++/4.2/bits/list.tcc + +DoxygenTranslator/src/DoxygenEntity.h: + +/usr/include/c++/4.2/cstdlib: + +/usr/include/c++/4.2/i486-linux-gnu/bits/c++config.h: + +/usr/include/c++/4.2/i486-linux-gnu/bits/os_defines.h: + +/usr/include/features.h: + +/usr/include/sys/cdefs.h: + +/usr/include/bits/wordsize.h: + +/usr/include/gnu/stubs.h: + +/usr/include/gnu/stubs-32.h: + +/usr/include/c++/4.2/i486-linux-gnu/bits/cpu_defines.h: + +/usr/include/c++/4.2/cstddef: + +/usr/lib/gcc/i486-linux-gnu/4.2.3/include/stddef.h: + +/usr/include/stdlib.h: + +/usr/include/bits/waitflags.h: + +/usr/include/bits/waitstatus.h: + +/usr/include/endian.h: + +/usr/include/bits/endian.h: + +/usr/include/xlocale.h: + +/usr/include/sys/types.h: + +/usr/include/bits/types.h: + +/usr/include/bits/typesizes.h: + +/usr/include/time.h: + +/usr/include/sys/select.h: + +/usr/include/bits/select.h: + +/usr/include/bits/sigset.h: + +/usr/include/bits/time.h: + +/usr/include/sys/sysmacros.h: + +/usr/include/bits/pthreadtypes.h: + +/usr/include/alloca.h: + +/usr/include/c++/4.2/iostream: + +/usr/include/c++/4.2/ostream: + +/usr/include/c++/4.2/ios: + +/usr/include/c++/4.2/iosfwd: + +/usr/include/c++/4.2/i486-linux-gnu/bits/c++locale.h: + +/usr/include/c++/4.2/cstring: + +/usr/include/string.h: + +/usr/include/c++/4.2/cstdio: + +/usr/include/stdio.h: + +/usr/include/libio.h: + +/usr/include/_G_config.h: + +/usr/include/wchar.h: + +/usr/lib/gcc/i486-linux-gnu/4.2.3/include/stdarg.h: + +/usr/include/bits/stdio_lim.h: + +/usr/include/bits/sys_errlist.h: + +/usr/include/c++/4.2/clocale: + +/usr/include/locale.h: + +/usr/include/bits/locale.h: + +/usr/include/langinfo.h: + +/usr/include/nl_types.h: + +/usr/include/iconv.h: + +/usr/include/libintl.h: + +/usr/include/c++/4.2/cstdarg: + +/usr/include/c++/4.2/i486-linux-gnu/bits/c++io.h: + +/usr/include/c++/4.2/i486-linux-gnu/bits/gthr.h: + +/usr/include/c++/4.2/i486-linux-gnu/bits/gthr-default.h: + +/usr/include/pthread.h: + +/usr/include/sched.h: + +/usr/include/bits/sched.h: + +/usr/include/signal.h: + +/usr/include/bits/setjmp.h: + +/usr/include/unistd.h: + +/usr/include/bits/posix_opt.h: + +/usr/include/bits/environments.h: + +/usr/include/bits/confname.h: + +/usr/include/getopt.h: + +/usr/include/c++/4.2/cctype: + +/usr/include/ctype.h: + +/usr/include/c++/4.2/bits/stringfwd.h: + +/usr/include/c++/4.2/bits/postypes.h: + +/usr/include/c++/4.2/cwchar: + +/usr/include/c++/4.2/ctime: + +/usr/include/bits/wchar.h: + +/usr/include/stdint.h: + +/usr/include/c++/4.2/bits/functexcept.h: + +/usr/include/c++/4.2/exception_defines.h: + +/usr/include/c++/4.2/exception: + +/usr/include/c++/4.2/bits/char_traits.h: + +/usr/include/c++/4.2/bits/stl_algobase.h: + +/usr/include/c++/4.2/climits: + +/usr/lib/gcc/i486-linux-gnu/4.2.3/include/limits.h: + +/usr/lib/gcc/i486-linux-gnu/4.2.3/include/syslimits.h: + +/usr/include/limits.h: + +/usr/include/bits/posix1_lim.h: + +/usr/include/bits/local_lim.h: + +/usr/include/linux/limits.h: + +/usr/include/bits/posix2_lim.h: + +/usr/include/bits/xopen_lim.h: + +/usr/include/c++/4.2/bits/stl_pair.h: + +/usr/include/c++/4.2/bits/cpp_type_traits.h: + +/usr/include/c++/4.2/ext/type_traits.h: + +/usr/include/c++/4.2/utility: + +/usr/include/c++/4.2/bits/stl_relops.h: + +/usr/include/c++/4.2/bits/stl_iterator_base_types.h: + +/usr/include/c++/4.2/bits/stl_iterator_base_funcs.h: + +/usr/include/c++/4.2/bits/concept_check.h: + +/usr/include/c++/4.2/bits/stl_iterator.h: + +/usr/include/c++/4.2/debug/debug.h: + +/usr/include/c++/4.2/bits/localefwd.h: + +/usr/include/c++/4.2/bits/ios_base.h: + +/usr/include/c++/4.2/ext/atomicity.h: + +/usr/include/c++/4.2/i486-linux-gnu/bits/atomic_word.h: + +/usr/include/c++/4.2/bits/locale_classes.h: + +/usr/include/c++/4.2/string: + +/usr/include/c++/4.2/memory: + +/usr/include/c++/4.2/bits/allocator.h: + +/usr/include/c++/4.2/i486-linux-gnu/bits/c++allocator.h: + +/usr/include/c++/4.2/ext/new_allocator.h: + +/usr/include/c++/4.2/new: + +/usr/include/c++/4.2/bits/stl_construct.h: + +/usr/include/c++/4.2/bits/stl_uninitialized.h: + +/usr/include/c++/4.2/bits/stl_raw_storage_iter.h: + +/usr/include/c++/4.2/limits: + +/usr/include/c++/4.2/bits/ostream_insert.h: + +/usr/include/c++/4.2/bits/stl_function.h: + +/usr/include/c++/4.2/bits/basic_string.h: + +/usr/include/c++/4.2/algorithm: + +/usr/include/c++/4.2/bits/stl_algo.h: + +/usr/include/c++/4.2/bits/stl_heap.h: + +/usr/include/c++/4.2/bits/stl_tempbuf.h: + +/usr/include/c++/4.2/bits/basic_string.tcc: + +/usr/include/c++/4.2/streambuf: + +/usr/include/c++/4.2/bits/streambuf.tcc: + +/usr/include/c++/4.2/bits/basic_ios.h: + +/usr/include/c++/4.2/bits/streambuf_iterator.h: + +/usr/include/c++/4.2/bits/locale_facets.h: + +/usr/include/c++/4.2/cwctype: + +/usr/include/wctype.h: + +/usr/include/c++/4.2/i486-linux-gnu/bits/ctype_base.h: + +/usr/include/c++/4.2/i486-linux-gnu/bits/ctype_inline.h: + +/usr/include/c++/4.2/bits/codecvt.h: + +/usr/include/c++/4.2/i486-linux-gnu/bits/time_members.h: + +/usr/include/c++/4.2/i486-linux-gnu/bits/messages_members.h: + +/usr/include/c++/4.2/bits/basic_ios.tcc: + +/usr/include/c++/4.2/bits/ostream.tcc: + +/usr/include/c++/4.2/locale: + +/usr/include/c++/4.2/bits/locale_facets.tcc: + +/usr/include/c++/4.2/typeinfo: + +/usr/include/c++/4.2/istream: + +/usr/include/c++/4.2/bits/istream.tcc: + +/usr/include/c++/4.2/list: + +/usr/include/c++/4.2/bits/stl_list.h: + +/usr/include/c++/4.2/bits/list.tcc: diff --git a/Source/DoxygenTranslator/src/.deps/DoxygenParser.Po b/Source/DoxygenTranslator/src/.deps/DoxygenParser.Po new file mode 100644 index 000000000..3a023d6b9 --- /dev/null +++ b/Source/DoxygenTranslator/src/.deps/DoxygenParser.Po @@ -0,0 +1,398 @@ +DoxygenTranslator/src/DoxygenParser.o \ + DoxygenTranslator/src/DoxygenParser.o: \ + DoxygenTranslator/src/DoxygenParser.cpp \ + DoxygenTranslator/src/DoxygenParser.h /usr/include/c++/4.2/cstdlib \ + /usr/include/c++/4.2/i486-linux-gnu/bits/c++config.h \ + /usr/include/c++/4.2/i486-linux-gnu/bits/os_defines.h \ + /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/include/c++/4.2/i486-linux-gnu/bits/cpu_defines.h \ + /usr/include/c++/4.2/cstddef \ + /usr/lib/gcc/i486-linux-gnu/4.2.3/include/stddef.h \ + /usr/include/stdlib.h /usr/include/bits/waitflags.h \ + /usr/include/bits/waitstatus.h /usr/include/endian.h \ + /usr/include/bits/endian.h /usr/include/xlocale.h \ + /usr/include/sys/types.h /usr/include/bits/types.h \ + /usr/include/bits/typesizes.h /usr/include/time.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/c++/4.2/iostream \ + /usr/include/c++/4.2/ostream /usr/include/c++/4.2/ios \ + /usr/include/c++/4.2/iosfwd \ + /usr/include/c++/4.2/i486-linux-gnu/bits/c++locale.h \ + /usr/include/c++/4.2/cstring /usr/include/string.h \ + /usr/include/c++/4.2/cstdio /usr/include/stdio.h /usr/include/libio.h \ + /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/lib/gcc/i486-linux-gnu/4.2.3/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/c++/4.2/clocale /usr/include/locale.h \ + /usr/include/bits/locale.h /usr/include/langinfo.h \ + /usr/include/nl_types.h /usr/include/iconv.h /usr/include/libintl.h \ + /usr/include/c++/4.2/cstdarg \ + /usr/include/c++/4.2/i486-linux-gnu/bits/c++io.h \ + /usr/include/c++/4.2/i486-linux-gnu/bits/gthr.h \ + /usr/include/c++/4.2/i486-linux-gnu/bits/gthr-default.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/signal.h /usr/include/bits/setjmp.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/environments.h \ + /usr/include/bits/confname.h /usr/include/getopt.h \ + /usr/include/c++/4.2/cctype /usr/include/ctype.h \ + /usr/include/c++/4.2/bits/stringfwd.h \ + /usr/include/c++/4.2/bits/postypes.h /usr/include/c++/4.2/cwchar \ + /usr/include/c++/4.2/ctime /usr/include/bits/wchar.h \ + /usr/include/stdint.h /usr/include/c++/4.2/bits/functexcept.h \ + /usr/include/c++/4.2/exception_defines.h /usr/include/c++/4.2/exception \ + /usr/include/c++/4.2/bits/char_traits.h \ + /usr/include/c++/4.2/bits/stl_algobase.h /usr/include/c++/4.2/climits \ + /usr/lib/gcc/i486-linux-gnu/4.2.3/include/limits.h \ + /usr/lib/gcc/i486-linux-gnu/4.2.3/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/xopen_lim.h \ + /usr/include/c++/4.2/bits/stl_pair.h \ + /usr/include/c++/4.2/bits/cpp_type_traits.h \ + /usr/include/c++/4.2/ext/type_traits.h /usr/include/c++/4.2/utility \ + /usr/include/c++/4.2/bits/stl_relops.h \ + /usr/include/c++/4.2/bits/stl_iterator_base_types.h \ + /usr/include/c++/4.2/bits/stl_iterator_base_funcs.h \ + /usr/include/c++/4.2/bits/concept_check.h \ + /usr/include/c++/4.2/bits/stl_iterator.h \ + /usr/include/c++/4.2/debug/debug.h \ + /usr/include/c++/4.2/bits/localefwd.h \ + /usr/include/c++/4.2/bits/ios_base.h \ + /usr/include/c++/4.2/ext/atomicity.h \ + /usr/include/c++/4.2/i486-linux-gnu/bits/atomic_word.h \ + /usr/include/c++/4.2/bits/locale_classes.h /usr/include/c++/4.2/string \ + /usr/include/c++/4.2/memory /usr/include/c++/4.2/bits/allocator.h \ + /usr/include/c++/4.2/i486-linux-gnu/bits/c++allocator.h \ + /usr/include/c++/4.2/ext/new_allocator.h /usr/include/c++/4.2/new \ + /usr/include/c++/4.2/bits/stl_construct.h \ + /usr/include/c++/4.2/bits/stl_uninitialized.h \ + /usr/include/c++/4.2/bits/stl_raw_storage_iter.h \ + /usr/include/c++/4.2/limits /usr/include/c++/4.2/bits/ostream_insert.h \ + /usr/include/c++/4.2/bits/stl_function.h \ + /usr/include/c++/4.2/bits/basic_string.h /usr/include/c++/4.2/algorithm \ + /usr/include/c++/4.2/bits/stl_algo.h \ + /usr/include/c++/4.2/bits/stl_heap.h \ + /usr/include/c++/4.2/bits/stl_tempbuf.h \ + /usr/include/c++/4.2/bits/basic_string.tcc \ + /usr/include/c++/4.2/streambuf /usr/include/c++/4.2/bits/streambuf.tcc \ + /usr/include/c++/4.2/bits/basic_ios.h \ + /usr/include/c++/4.2/bits/streambuf_iterator.h \ + /usr/include/c++/4.2/bits/locale_facets.h /usr/include/c++/4.2/cwctype \ + /usr/include/wctype.h \ + /usr/include/c++/4.2/i486-linux-gnu/bits/ctype_base.h \ + /usr/include/c++/4.2/i486-linux-gnu/bits/ctype_inline.h \ + /usr/include/c++/4.2/bits/codecvt.h \ + /usr/include/c++/4.2/i486-linux-gnu/bits/time_members.h \ + /usr/include/c++/4.2/i486-linux-gnu/bits/messages_members.h \ + /usr/include/c++/4.2/bits/basic_ios.tcc \ + /usr/include/c++/4.2/bits/ostream.tcc /usr/include/c++/4.2/locale \ + /usr/include/c++/4.2/bits/locale_facets.tcc \ + /usr/include/c++/4.2/typeinfo /usr/include/c++/4.2/istream \ + /usr/include/c++/4.2/bits/istream.tcc /usr/include/c++/4.2/fstream \ + /usr/include/c++/4.2/i486-linux-gnu/bits/basic_file.h \ + /usr/include/c++/4.2/bits/fstream.tcc /usr/include/c++/4.2/list \ + /usr/include/c++/4.2/bits/stl_list.h /usr/include/c++/4.2/bits/list.tcc \ + DoxygenTranslator/src/DoxygenEntity.h DoxygenTranslator/src/TokenList.h \ + DoxygenTranslator/src/Token.h DoxygenTranslator/src/JavaDocConverter.h + +DoxygenTranslator/src/DoxygenParser.h: + +/usr/include/c++/4.2/cstdlib: + +/usr/include/c++/4.2/i486-linux-gnu/bits/c++config.h: + +/usr/include/c++/4.2/i486-linux-gnu/bits/os_defines.h: + +/usr/include/features.h: + +/usr/include/sys/cdefs.h: + +/usr/include/bits/wordsize.h: + +/usr/include/gnu/stubs.h: + +/usr/include/gnu/stubs-32.h: + +/usr/include/c++/4.2/i486-linux-gnu/bits/cpu_defines.h: + +/usr/include/c++/4.2/cstddef: + +/usr/lib/gcc/i486-linux-gnu/4.2.3/include/stddef.h: + +/usr/include/stdlib.h: + +/usr/include/bits/waitflags.h: + +/usr/include/bits/waitstatus.h: + +/usr/include/endian.h: + +/usr/include/bits/endian.h: + +/usr/include/xlocale.h: + +/usr/include/sys/types.h: + +/usr/include/bits/types.h: + +/usr/include/bits/typesizes.h: + +/usr/include/time.h: + +/usr/include/sys/select.h: + +/usr/include/bits/select.h: + +/usr/include/bits/sigset.h: + +/usr/include/bits/time.h: + +/usr/include/sys/sysmacros.h: + +/usr/include/bits/pthreadtypes.h: + +/usr/include/alloca.h: + +/usr/include/c++/4.2/iostream: + +/usr/include/c++/4.2/ostream: + +/usr/include/c++/4.2/ios: + +/usr/include/c++/4.2/iosfwd: + +/usr/include/c++/4.2/i486-linux-gnu/bits/c++locale.h: + +/usr/include/c++/4.2/cstring: + +/usr/include/string.h: + +/usr/include/c++/4.2/cstdio: + +/usr/include/stdio.h: + +/usr/include/libio.h: + +/usr/include/_G_config.h: + +/usr/include/wchar.h: + +/usr/lib/gcc/i486-linux-gnu/4.2.3/include/stdarg.h: + +/usr/include/bits/stdio_lim.h: + +/usr/include/bits/sys_errlist.h: + +/usr/include/c++/4.2/clocale: + +/usr/include/locale.h: + +/usr/include/bits/locale.h: + +/usr/include/langinfo.h: + +/usr/include/nl_types.h: + +/usr/include/iconv.h: + +/usr/include/libintl.h: + +/usr/include/c++/4.2/cstdarg: + +/usr/include/c++/4.2/i486-linux-gnu/bits/c++io.h: + +/usr/include/c++/4.2/i486-linux-gnu/bits/gthr.h: + +/usr/include/c++/4.2/i486-linux-gnu/bits/gthr-default.h: + +/usr/include/pthread.h: + +/usr/include/sched.h: + +/usr/include/bits/sched.h: + +/usr/include/signal.h: + +/usr/include/bits/setjmp.h: + +/usr/include/unistd.h: + +/usr/include/bits/posix_opt.h: + +/usr/include/bits/environments.h: + +/usr/include/bits/confname.h: + +/usr/include/getopt.h: + +/usr/include/c++/4.2/cctype: + +/usr/include/ctype.h: + +/usr/include/c++/4.2/bits/stringfwd.h: + +/usr/include/c++/4.2/bits/postypes.h: + +/usr/include/c++/4.2/cwchar: + +/usr/include/c++/4.2/ctime: + +/usr/include/bits/wchar.h: + +/usr/include/stdint.h: + +/usr/include/c++/4.2/bits/functexcept.h: + +/usr/include/c++/4.2/exception_defines.h: + +/usr/include/c++/4.2/exception: + +/usr/include/c++/4.2/bits/char_traits.h: + +/usr/include/c++/4.2/bits/stl_algobase.h: + +/usr/include/c++/4.2/climits: + +/usr/lib/gcc/i486-linux-gnu/4.2.3/include/limits.h: + +/usr/lib/gcc/i486-linux-gnu/4.2.3/include/syslimits.h: + +/usr/include/limits.h: + +/usr/include/bits/posix1_lim.h: + +/usr/include/bits/local_lim.h: + +/usr/include/linux/limits.h: + +/usr/include/bits/posix2_lim.h: + +/usr/include/bits/xopen_lim.h: + +/usr/include/c++/4.2/bits/stl_pair.h: + +/usr/include/c++/4.2/bits/cpp_type_traits.h: + +/usr/include/c++/4.2/ext/type_traits.h: + +/usr/include/c++/4.2/utility: + +/usr/include/c++/4.2/bits/stl_relops.h: + +/usr/include/c++/4.2/bits/stl_iterator_base_types.h: + +/usr/include/c++/4.2/bits/stl_iterator_base_funcs.h: + +/usr/include/c++/4.2/bits/concept_check.h: + +/usr/include/c++/4.2/bits/stl_iterator.h: + +/usr/include/c++/4.2/debug/debug.h: + +/usr/include/c++/4.2/bits/localefwd.h: + +/usr/include/c++/4.2/bits/ios_base.h: + +/usr/include/c++/4.2/ext/atomicity.h: + +/usr/include/c++/4.2/i486-linux-gnu/bits/atomic_word.h: + +/usr/include/c++/4.2/bits/locale_classes.h: + +/usr/include/c++/4.2/string: + +/usr/include/c++/4.2/memory: + +/usr/include/c++/4.2/bits/allocator.h: + +/usr/include/c++/4.2/i486-linux-gnu/bits/c++allocator.h: + +/usr/include/c++/4.2/ext/new_allocator.h: + +/usr/include/c++/4.2/new: + +/usr/include/c++/4.2/bits/stl_construct.h: + +/usr/include/c++/4.2/bits/stl_uninitialized.h: + +/usr/include/c++/4.2/bits/stl_raw_storage_iter.h: + +/usr/include/c++/4.2/limits: + +/usr/include/c++/4.2/bits/ostream_insert.h: + +/usr/include/c++/4.2/bits/stl_function.h: + +/usr/include/c++/4.2/bits/basic_string.h: + +/usr/include/c++/4.2/algorithm: + +/usr/include/c++/4.2/bits/stl_algo.h: + +/usr/include/c++/4.2/bits/stl_heap.h: + +/usr/include/c++/4.2/bits/stl_tempbuf.h: + +/usr/include/c++/4.2/bits/basic_string.tcc: + +/usr/include/c++/4.2/streambuf: + +/usr/include/c++/4.2/bits/streambuf.tcc: + +/usr/include/c++/4.2/bits/basic_ios.h: + +/usr/include/c++/4.2/bits/streambuf_iterator.h: + +/usr/include/c++/4.2/bits/locale_facets.h: + +/usr/include/c++/4.2/cwctype: + +/usr/include/wctype.h: + +/usr/include/c++/4.2/i486-linux-gnu/bits/ctype_base.h: + +/usr/include/c++/4.2/i486-linux-gnu/bits/ctype_inline.h: + +/usr/include/c++/4.2/bits/codecvt.h: + +/usr/include/c++/4.2/i486-linux-gnu/bits/time_members.h: + +/usr/include/c++/4.2/i486-linux-gnu/bits/messages_members.h: + +/usr/include/c++/4.2/bits/basic_ios.tcc: + +/usr/include/c++/4.2/bits/ostream.tcc: + +/usr/include/c++/4.2/locale: + +/usr/include/c++/4.2/bits/locale_facets.tcc: + +/usr/include/c++/4.2/typeinfo: + +/usr/include/c++/4.2/istream: + +/usr/include/c++/4.2/bits/istream.tcc: + +/usr/include/c++/4.2/fstream: + +/usr/include/c++/4.2/i486-linux-gnu/bits/basic_file.h: + +/usr/include/c++/4.2/bits/fstream.tcc: + +/usr/include/c++/4.2/list: + +/usr/include/c++/4.2/bits/stl_list.h: + +/usr/include/c++/4.2/bits/list.tcc: + +DoxygenTranslator/src/DoxygenEntity.h: + +DoxygenTranslator/src/TokenList.h: + +DoxygenTranslator/src/Token.h: + +DoxygenTranslator/src/JavaDocConverter.h: diff --git a/Source/DoxygenTranslator/src/.deps/DoxygenTranslator.Po b/Source/DoxygenTranslator/src/.deps/DoxygenTranslator.Po new file mode 100644 index 000000000..d71e23830 --- /dev/null +++ b/Source/DoxygenTranslator/src/.deps/DoxygenTranslator.Po @@ -0,0 +1,401 @@ +DoxygenTranslator/src/DoxygenTranslator.o \ + DoxygenTranslator/src/DoxygenTranslator.o: \ + DoxygenTranslator/src/DoxygenTranslator.cpp \ + DoxygenTranslator/src/DoxygenParser.h /usr/include/c++/4.2/cstdlib \ + /usr/include/c++/4.2/i486-linux-gnu/bits/c++config.h \ + /usr/include/c++/4.2/i486-linux-gnu/bits/os_defines.h \ + /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/include/c++/4.2/i486-linux-gnu/bits/cpu_defines.h \ + /usr/include/c++/4.2/cstddef \ + /usr/lib/gcc/i486-linux-gnu/4.2.3/include/stddef.h \ + /usr/include/stdlib.h /usr/include/bits/waitflags.h \ + /usr/include/bits/waitstatus.h /usr/include/endian.h \ + /usr/include/bits/endian.h /usr/include/xlocale.h \ + /usr/include/sys/types.h /usr/include/bits/types.h \ + /usr/include/bits/typesizes.h /usr/include/time.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/c++/4.2/iostream \ + /usr/include/c++/4.2/ostream /usr/include/c++/4.2/ios \ + /usr/include/c++/4.2/iosfwd \ + /usr/include/c++/4.2/i486-linux-gnu/bits/c++locale.h \ + /usr/include/c++/4.2/cstring /usr/include/string.h \ + /usr/include/c++/4.2/cstdio /usr/include/stdio.h /usr/include/libio.h \ + /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/lib/gcc/i486-linux-gnu/4.2.3/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/c++/4.2/clocale /usr/include/locale.h \ + /usr/include/bits/locale.h /usr/include/langinfo.h \ + /usr/include/nl_types.h /usr/include/iconv.h /usr/include/libintl.h \ + /usr/include/c++/4.2/cstdarg \ + /usr/include/c++/4.2/i486-linux-gnu/bits/c++io.h \ + /usr/include/c++/4.2/i486-linux-gnu/bits/gthr.h \ + /usr/include/c++/4.2/i486-linux-gnu/bits/gthr-default.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/signal.h /usr/include/bits/setjmp.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/environments.h \ + /usr/include/bits/confname.h /usr/include/getopt.h \ + /usr/include/c++/4.2/cctype /usr/include/ctype.h \ + /usr/include/c++/4.2/bits/stringfwd.h \ + /usr/include/c++/4.2/bits/postypes.h /usr/include/c++/4.2/cwchar \ + /usr/include/c++/4.2/ctime /usr/include/bits/wchar.h \ + /usr/include/stdint.h /usr/include/c++/4.2/bits/functexcept.h \ + /usr/include/c++/4.2/exception_defines.h /usr/include/c++/4.2/exception \ + /usr/include/c++/4.2/bits/char_traits.h \ + /usr/include/c++/4.2/bits/stl_algobase.h /usr/include/c++/4.2/climits \ + /usr/lib/gcc/i486-linux-gnu/4.2.3/include/limits.h \ + /usr/lib/gcc/i486-linux-gnu/4.2.3/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/xopen_lim.h \ + /usr/include/c++/4.2/bits/stl_pair.h \ + /usr/include/c++/4.2/bits/cpp_type_traits.h \ + /usr/include/c++/4.2/ext/type_traits.h /usr/include/c++/4.2/utility \ + /usr/include/c++/4.2/bits/stl_relops.h \ + /usr/include/c++/4.2/bits/stl_iterator_base_types.h \ + /usr/include/c++/4.2/bits/stl_iterator_base_funcs.h \ + /usr/include/c++/4.2/bits/concept_check.h \ + /usr/include/c++/4.2/bits/stl_iterator.h \ + /usr/include/c++/4.2/debug/debug.h \ + /usr/include/c++/4.2/bits/localefwd.h \ + /usr/include/c++/4.2/bits/ios_base.h \ + /usr/include/c++/4.2/ext/atomicity.h \ + /usr/include/c++/4.2/i486-linux-gnu/bits/atomic_word.h \ + /usr/include/c++/4.2/bits/locale_classes.h /usr/include/c++/4.2/string \ + /usr/include/c++/4.2/memory /usr/include/c++/4.2/bits/allocator.h \ + /usr/include/c++/4.2/i486-linux-gnu/bits/c++allocator.h \ + /usr/include/c++/4.2/ext/new_allocator.h /usr/include/c++/4.2/new \ + /usr/include/c++/4.2/bits/stl_construct.h \ + /usr/include/c++/4.2/bits/stl_uninitialized.h \ + /usr/include/c++/4.2/bits/stl_raw_storage_iter.h \ + /usr/include/c++/4.2/limits /usr/include/c++/4.2/bits/ostream_insert.h \ + /usr/include/c++/4.2/bits/stl_function.h \ + /usr/include/c++/4.2/bits/basic_string.h /usr/include/c++/4.2/algorithm \ + /usr/include/c++/4.2/bits/stl_algo.h \ + /usr/include/c++/4.2/bits/stl_heap.h \ + /usr/include/c++/4.2/bits/stl_tempbuf.h \ + /usr/include/c++/4.2/bits/basic_string.tcc \ + /usr/include/c++/4.2/streambuf /usr/include/c++/4.2/bits/streambuf.tcc \ + /usr/include/c++/4.2/bits/basic_ios.h \ + /usr/include/c++/4.2/bits/streambuf_iterator.h \ + /usr/include/c++/4.2/bits/locale_facets.h /usr/include/c++/4.2/cwctype \ + /usr/include/wctype.h \ + /usr/include/c++/4.2/i486-linux-gnu/bits/ctype_base.h \ + /usr/include/c++/4.2/i486-linux-gnu/bits/ctype_inline.h \ + /usr/include/c++/4.2/bits/codecvt.h \ + /usr/include/c++/4.2/i486-linux-gnu/bits/time_members.h \ + /usr/include/c++/4.2/i486-linux-gnu/bits/messages_members.h \ + /usr/include/c++/4.2/bits/basic_ios.tcc \ + /usr/include/c++/4.2/bits/ostream.tcc /usr/include/c++/4.2/locale \ + /usr/include/c++/4.2/bits/locale_facets.tcc \ + /usr/include/c++/4.2/typeinfo /usr/include/c++/4.2/istream \ + /usr/include/c++/4.2/bits/istream.tcc /usr/include/c++/4.2/fstream \ + /usr/include/c++/4.2/i486-linux-gnu/bits/basic_file.h \ + /usr/include/c++/4.2/bits/fstream.tcc /usr/include/c++/4.2/list \ + /usr/include/c++/4.2/bits/stl_list.h /usr/include/c++/4.2/bits/list.tcc \ + DoxygenTranslator/src/DoxygenEntity.h DoxygenTranslator/src/TokenList.h \ + DoxygenTranslator/src/Token.h DoxygenTranslator/src/JavaDocConverter.h \ + DoxygenTranslator/src/DoxygenTranslator.h + +DoxygenTranslator/src/DoxygenParser.h: + +/usr/include/c++/4.2/cstdlib: + +/usr/include/c++/4.2/i486-linux-gnu/bits/c++config.h: + +/usr/include/c++/4.2/i486-linux-gnu/bits/os_defines.h: + +/usr/include/features.h: + +/usr/include/sys/cdefs.h: + +/usr/include/bits/wordsize.h: + +/usr/include/gnu/stubs.h: + +/usr/include/gnu/stubs-32.h: + +/usr/include/c++/4.2/i486-linux-gnu/bits/cpu_defines.h: + +/usr/include/c++/4.2/cstddef: + +/usr/lib/gcc/i486-linux-gnu/4.2.3/include/stddef.h: + +/usr/include/stdlib.h: + +/usr/include/bits/waitflags.h: + +/usr/include/bits/waitstatus.h: + +/usr/include/endian.h: + +/usr/include/bits/endian.h: + +/usr/include/xlocale.h: + +/usr/include/sys/types.h: + +/usr/include/bits/types.h: + +/usr/include/bits/typesizes.h: + +/usr/include/time.h: + +/usr/include/sys/select.h: + +/usr/include/bits/select.h: + +/usr/include/bits/sigset.h: + +/usr/include/bits/time.h: + +/usr/include/sys/sysmacros.h: + +/usr/include/bits/pthreadtypes.h: + +/usr/include/alloca.h: + +/usr/include/c++/4.2/iostream: + +/usr/include/c++/4.2/ostream: + +/usr/include/c++/4.2/ios: + +/usr/include/c++/4.2/iosfwd: + +/usr/include/c++/4.2/i486-linux-gnu/bits/c++locale.h: + +/usr/include/c++/4.2/cstring: + +/usr/include/string.h: + +/usr/include/c++/4.2/cstdio: + +/usr/include/stdio.h: + +/usr/include/libio.h: + +/usr/include/_G_config.h: + +/usr/include/wchar.h: + +/usr/lib/gcc/i486-linux-gnu/4.2.3/include/stdarg.h: + +/usr/include/bits/stdio_lim.h: + +/usr/include/bits/sys_errlist.h: + +/usr/include/c++/4.2/clocale: + +/usr/include/locale.h: + +/usr/include/bits/locale.h: + +/usr/include/langinfo.h: + +/usr/include/nl_types.h: + +/usr/include/iconv.h: + +/usr/include/libintl.h: + +/usr/include/c++/4.2/cstdarg: + +/usr/include/c++/4.2/i486-linux-gnu/bits/c++io.h: + +/usr/include/c++/4.2/i486-linux-gnu/bits/gthr.h: + +/usr/include/c++/4.2/i486-linux-gnu/bits/gthr-default.h: + +/usr/include/pthread.h: + +/usr/include/sched.h: + +/usr/include/bits/sched.h: + +/usr/include/signal.h: + +/usr/include/bits/setjmp.h: + +/usr/include/unistd.h: + +/usr/include/bits/posix_opt.h: + +/usr/include/bits/environments.h: + +/usr/include/bits/confname.h: + +/usr/include/getopt.h: + +/usr/include/c++/4.2/cctype: + +/usr/include/ctype.h: + +/usr/include/c++/4.2/bits/stringfwd.h: + +/usr/include/c++/4.2/bits/postypes.h: + +/usr/include/c++/4.2/cwchar: + +/usr/include/c++/4.2/ctime: + +/usr/include/bits/wchar.h: + +/usr/include/stdint.h: + +/usr/include/c++/4.2/bits/functexcept.h: + +/usr/include/c++/4.2/exception_defines.h: + +/usr/include/c++/4.2/exception: + +/usr/include/c++/4.2/bits/char_traits.h: + +/usr/include/c++/4.2/bits/stl_algobase.h: + +/usr/include/c++/4.2/climits: + +/usr/lib/gcc/i486-linux-gnu/4.2.3/include/limits.h: + +/usr/lib/gcc/i486-linux-gnu/4.2.3/include/syslimits.h: + +/usr/include/limits.h: + +/usr/include/bits/posix1_lim.h: + +/usr/include/bits/local_lim.h: + +/usr/include/linux/limits.h: + +/usr/include/bits/posix2_lim.h: + +/usr/include/bits/xopen_lim.h: + +/usr/include/c++/4.2/bits/stl_pair.h: + +/usr/include/c++/4.2/bits/cpp_type_traits.h: + +/usr/include/c++/4.2/ext/type_traits.h: + +/usr/include/c++/4.2/utility: + +/usr/include/c++/4.2/bits/stl_relops.h: + +/usr/include/c++/4.2/bits/stl_iterator_base_types.h: + +/usr/include/c++/4.2/bits/stl_iterator_base_funcs.h: + +/usr/include/c++/4.2/bits/concept_check.h: + +/usr/include/c++/4.2/bits/stl_iterator.h: + +/usr/include/c++/4.2/debug/debug.h: + +/usr/include/c++/4.2/bits/localefwd.h: + +/usr/include/c++/4.2/bits/ios_base.h: + +/usr/include/c++/4.2/ext/atomicity.h: + +/usr/include/c++/4.2/i486-linux-gnu/bits/atomic_word.h: + +/usr/include/c++/4.2/bits/locale_classes.h: + +/usr/include/c++/4.2/string: + +/usr/include/c++/4.2/memory: + +/usr/include/c++/4.2/bits/allocator.h: + +/usr/include/c++/4.2/i486-linux-gnu/bits/c++allocator.h: + +/usr/include/c++/4.2/ext/new_allocator.h: + +/usr/include/c++/4.2/new: + +/usr/include/c++/4.2/bits/stl_construct.h: + +/usr/include/c++/4.2/bits/stl_uninitialized.h: + +/usr/include/c++/4.2/bits/stl_raw_storage_iter.h: + +/usr/include/c++/4.2/limits: + +/usr/include/c++/4.2/bits/ostream_insert.h: + +/usr/include/c++/4.2/bits/stl_function.h: + +/usr/include/c++/4.2/bits/basic_string.h: + +/usr/include/c++/4.2/algorithm: + +/usr/include/c++/4.2/bits/stl_algo.h: + +/usr/include/c++/4.2/bits/stl_heap.h: + +/usr/include/c++/4.2/bits/stl_tempbuf.h: + +/usr/include/c++/4.2/bits/basic_string.tcc: + +/usr/include/c++/4.2/streambuf: + +/usr/include/c++/4.2/bits/streambuf.tcc: + +/usr/include/c++/4.2/bits/basic_ios.h: + +/usr/include/c++/4.2/bits/streambuf_iterator.h: + +/usr/include/c++/4.2/bits/locale_facets.h: + +/usr/include/c++/4.2/cwctype: + +/usr/include/wctype.h: + +/usr/include/c++/4.2/i486-linux-gnu/bits/ctype_base.h: + +/usr/include/c++/4.2/i486-linux-gnu/bits/ctype_inline.h: + +/usr/include/c++/4.2/bits/codecvt.h: + +/usr/include/c++/4.2/i486-linux-gnu/bits/time_members.h: + +/usr/include/c++/4.2/i486-linux-gnu/bits/messages_members.h: + +/usr/include/c++/4.2/bits/basic_ios.tcc: + +/usr/include/c++/4.2/bits/ostream.tcc: + +/usr/include/c++/4.2/locale: + +/usr/include/c++/4.2/bits/locale_facets.tcc: + +/usr/include/c++/4.2/typeinfo: + +/usr/include/c++/4.2/istream: + +/usr/include/c++/4.2/bits/istream.tcc: + +/usr/include/c++/4.2/fstream: + +/usr/include/c++/4.2/i486-linux-gnu/bits/basic_file.h: + +/usr/include/c++/4.2/bits/fstream.tcc: + +/usr/include/c++/4.2/list: + +/usr/include/c++/4.2/bits/stl_list.h: + +/usr/include/c++/4.2/bits/list.tcc: + +DoxygenTranslator/src/DoxygenEntity.h: + +DoxygenTranslator/src/TokenList.h: + +DoxygenTranslator/src/Token.h: + +DoxygenTranslator/src/JavaDocConverter.h: + +DoxygenTranslator/src/DoxygenTranslator.h: diff --git a/Source/DoxygenTranslator/src/.deps/JavaDocConverter.Po b/Source/DoxygenTranslator/src/.deps/JavaDocConverter.Po new file mode 100644 index 000000000..79a3133a3 --- /dev/null +++ b/Source/DoxygenTranslator/src/.deps/JavaDocConverter.Po @@ -0,0 +1,385 @@ +DoxygenTranslator/src/JavaDocConverter.o \ + DoxygenTranslator/src/JavaDocConverter.o: \ + DoxygenTranslator/src/JavaDocConverter.cpp \ + DoxygenTranslator/src/JavaDocConverter.h /usr/include/c++/4.2/list \ + /usr/include/c++/4.2/bits/functexcept.h \ + /usr/include/c++/4.2/i486-linux-gnu/bits/c++config.h \ + /usr/include/c++/4.2/i486-linux-gnu/bits/os_defines.h \ + /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/include/c++/4.2/i486-linux-gnu/bits/cpu_defines.h \ + /usr/include/c++/4.2/exception_defines.h \ + /usr/include/c++/4.2/bits/stl_algobase.h /usr/include/c++/4.2/cstring \ + /usr/include/c++/4.2/cstddef \ + /usr/lib/gcc/i486-linux-gnu/4.2.3/include/stddef.h \ + /usr/include/string.h /usr/include/xlocale.h \ + /usr/include/c++/4.2/climits \ + /usr/lib/gcc/i486-linux-gnu/4.2.3/include/limits.h \ + /usr/lib/gcc/i486-linux-gnu/4.2.3/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/xopen_lim.h \ + /usr/include/bits/stdio_lim.h /usr/include/c++/4.2/cstdlib \ + /usr/include/stdlib.h /usr/include/bits/waitflags.h \ + /usr/include/bits/waitstatus.h /usr/include/endian.h \ + /usr/include/bits/endian.h /usr/include/sys/types.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/time.h /usr/include/sys/select.h \ + /usr/include/bits/select.h /usr/include/bits/sigset.h \ + /usr/include/bits/time.h /usr/include/sys/sysmacros.h \ + /usr/include/bits/pthreadtypes.h /usr/include/alloca.h \ + /usr/include/c++/4.2/iosfwd \ + /usr/include/c++/4.2/i486-linux-gnu/bits/c++locale.h \ + /usr/include/c++/4.2/cstdio /usr/include/stdio.h /usr/include/libio.h \ + /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/lib/gcc/i486-linux-gnu/4.2.3/include/stdarg.h \ + /usr/include/bits/sys_errlist.h /usr/include/c++/4.2/clocale \ + /usr/include/locale.h /usr/include/bits/locale.h \ + /usr/include/langinfo.h /usr/include/nl_types.h /usr/include/iconv.h \ + /usr/include/libintl.h /usr/include/c++/4.2/cstdarg \ + /usr/include/c++/4.2/i486-linux-gnu/bits/c++io.h \ + /usr/include/c++/4.2/i486-linux-gnu/bits/gthr.h \ + /usr/include/c++/4.2/i486-linux-gnu/bits/gthr-default.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/signal.h /usr/include/bits/setjmp.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/environments.h \ + /usr/include/bits/confname.h /usr/include/getopt.h \ + /usr/include/c++/4.2/cctype /usr/include/ctype.h \ + /usr/include/c++/4.2/bits/stringfwd.h \ + /usr/include/c++/4.2/bits/postypes.h /usr/include/c++/4.2/cwchar \ + /usr/include/c++/4.2/ctime /usr/include/bits/wchar.h \ + /usr/include/stdint.h /usr/include/c++/4.2/bits/stl_pair.h \ + /usr/include/c++/4.2/bits/cpp_type_traits.h \ + /usr/include/c++/4.2/ext/type_traits.h /usr/include/c++/4.2/utility \ + /usr/include/c++/4.2/bits/stl_relops.h \ + /usr/include/c++/4.2/bits/stl_iterator_base_types.h \ + /usr/include/c++/4.2/bits/stl_iterator_base_funcs.h \ + /usr/include/c++/4.2/bits/concept_check.h \ + /usr/include/c++/4.2/bits/stl_iterator.h \ + /usr/include/c++/4.2/debug/debug.h \ + /usr/include/c++/4.2/bits/allocator.h \ + /usr/include/c++/4.2/i486-linux-gnu/bits/c++allocator.h \ + /usr/include/c++/4.2/ext/new_allocator.h /usr/include/c++/4.2/new \ + /usr/include/c++/4.2/exception \ + /usr/include/c++/4.2/bits/stl_construct.h \ + /usr/include/c++/4.2/bits/stl_uninitialized.h \ + /usr/include/c++/4.2/bits/stl_list.h /usr/include/c++/4.2/bits/list.tcc \ + /usr/include/c++/4.2/string /usr/include/c++/4.2/bits/char_traits.h \ + /usr/include/c++/4.2/memory \ + /usr/include/c++/4.2/bits/stl_raw_storage_iter.h \ + /usr/include/c++/4.2/limits /usr/include/c++/4.2/bits/ostream_insert.h \ + /usr/include/c++/4.2/bits/stl_function.h \ + /usr/include/c++/4.2/bits/basic_string.h \ + /usr/include/c++/4.2/ext/atomicity.h \ + /usr/include/c++/4.2/i486-linux-gnu/bits/atomic_word.h \ + /usr/include/c++/4.2/algorithm /usr/include/c++/4.2/bits/stl_algo.h \ + /usr/include/c++/4.2/bits/stl_heap.h \ + /usr/include/c++/4.2/bits/stl_tempbuf.h \ + /usr/include/c++/4.2/bits/basic_string.tcc \ + DoxygenTranslator/src/DoxygenEntity.h /usr/include/c++/4.2/iostream \ + /usr/include/c++/4.2/ostream /usr/include/c++/4.2/ios \ + /usr/include/c++/4.2/bits/localefwd.h \ + /usr/include/c++/4.2/bits/ios_base.h \ + /usr/include/c++/4.2/bits/locale_classes.h \ + /usr/include/c++/4.2/streambuf /usr/include/c++/4.2/bits/streambuf.tcc \ + /usr/include/c++/4.2/bits/basic_ios.h \ + /usr/include/c++/4.2/bits/streambuf_iterator.h \ + /usr/include/c++/4.2/bits/locale_facets.h /usr/include/c++/4.2/cwctype \ + /usr/include/wctype.h \ + /usr/include/c++/4.2/i486-linux-gnu/bits/ctype_base.h \ + /usr/include/c++/4.2/i486-linux-gnu/bits/ctype_inline.h \ + /usr/include/c++/4.2/bits/codecvt.h \ + /usr/include/c++/4.2/i486-linux-gnu/bits/time_members.h \ + /usr/include/c++/4.2/i486-linux-gnu/bits/messages_members.h \ + /usr/include/c++/4.2/bits/basic_ios.tcc \ + /usr/include/c++/4.2/bits/ostream.tcc /usr/include/c++/4.2/locale \ + /usr/include/c++/4.2/bits/locale_facets.tcc \ + /usr/include/c++/4.2/typeinfo /usr/include/c++/4.2/istream \ + /usr/include/c++/4.2/bits/istream.tcc + +DoxygenTranslator/src/JavaDocConverter.h: + +/usr/include/c++/4.2/list: + +/usr/include/c++/4.2/bits/functexcept.h: + +/usr/include/c++/4.2/i486-linux-gnu/bits/c++config.h: + +/usr/include/c++/4.2/i486-linux-gnu/bits/os_defines.h: + +/usr/include/features.h: + +/usr/include/sys/cdefs.h: + +/usr/include/bits/wordsize.h: + +/usr/include/gnu/stubs.h: + +/usr/include/gnu/stubs-32.h: + +/usr/include/c++/4.2/i486-linux-gnu/bits/cpu_defines.h: + +/usr/include/c++/4.2/exception_defines.h: + +/usr/include/c++/4.2/bits/stl_algobase.h: + +/usr/include/c++/4.2/cstring: + +/usr/include/c++/4.2/cstddef: + +/usr/lib/gcc/i486-linux-gnu/4.2.3/include/stddef.h: + +/usr/include/string.h: + +/usr/include/xlocale.h: + +/usr/include/c++/4.2/climits: + +/usr/lib/gcc/i486-linux-gnu/4.2.3/include/limits.h: + +/usr/lib/gcc/i486-linux-gnu/4.2.3/include/syslimits.h: + +/usr/include/limits.h: + +/usr/include/bits/posix1_lim.h: + +/usr/include/bits/local_lim.h: + +/usr/include/linux/limits.h: + +/usr/include/bits/posix2_lim.h: + +/usr/include/bits/xopen_lim.h: + +/usr/include/bits/stdio_lim.h: + +/usr/include/c++/4.2/cstdlib: + +/usr/include/stdlib.h: + +/usr/include/bits/waitflags.h: + +/usr/include/bits/waitstatus.h: + +/usr/include/endian.h: + +/usr/include/bits/endian.h: + +/usr/include/sys/types.h: + +/usr/include/bits/types.h: + +/usr/include/bits/typesizes.h: + +/usr/include/time.h: + +/usr/include/sys/select.h: + +/usr/include/bits/select.h: + +/usr/include/bits/sigset.h: + +/usr/include/bits/time.h: + +/usr/include/sys/sysmacros.h: + +/usr/include/bits/pthreadtypes.h: + +/usr/include/alloca.h: + +/usr/include/c++/4.2/iosfwd: + +/usr/include/c++/4.2/i486-linux-gnu/bits/c++locale.h: + +/usr/include/c++/4.2/cstdio: + +/usr/include/stdio.h: + +/usr/include/libio.h: + +/usr/include/_G_config.h: + +/usr/include/wchar.h: + +/usr/lib/gcc/i486-linux-gnu/4.2.3/include/stdarg.h: + +/usr/include/bits/sys_errlist.h: + +/usr/include/c++/4.2/clocale: + +/usr/include/locale.h: + +/usr/include/bits/locale.h: + +/usr/include/langinfo.h: + +/usr/include/nl_types.h: + +/usr/include/iconv.h: + +/usr/include/libintl.h: + +/usr/include/c++/4.2/cstdarg: + +/usr/include/c++/4.2/i486-linux-gnu/bits/c++io.h: + +/usr/include/c++/4.2/i486-linux-gnu/bits/gthr.h: + +/usr/include/c++/4.2/i486-linux-gnu/bits/gthr-default.h: + +/usr/include/pthread.h: + +/usr/include/sched.h: + +/usr/include/bits/sched.h: + +/usr/include/signal.h: + +/usr/include/bits/setjmp.h: + +/usr/include/unistd.h: + +/usr/include/bits/posix_opt.h: + +/usr/include/bits/environments.h: + +/usr/include/bits/confname.h: + +/usr/include/getopt.h: + +/usr/include/c++/4.2/cctype: + +/usr/include/ctype.h: + +/usr/include/c++/4.2/bits/stringfwd.h: + +/usr/include/c++/4.2/bits/postypes.h: + +/usr/include/c++/4.2/cwchar: + +/usr/include/c++/4.2/ctime: + +/usr/include/bits/wchar.h: + +/usr/include/stdint.h: + +/usr/include/c++/4.2/bits/stl_pair.h: + +/usr/include/c++/4.2/bits/cpp_type_traits.h: + +/usr/include/c++/4.2/ext/type_traits.h: + +/usr/include/c++/4.2/utility: + +/usr/include/c++/4.2/bits/stl_relops.h: + +/usr/include/c++/4.2/bits/stl_iterator_base_types.h: + +/usr/include/c++/4.2/bits/stl_iterator_base_funcs.h: + +/usr/include/c++/4.2/bits/concept_check.h: + +/usr/include/c++/4.2/bits/stl_iterator.h: + +/usr/include/c++/4.2/debug/debug.h: + +/usr/include/c++/4.2/bits/allocator.h: + +/usr/include/c++/4.2/i486-linux-gnu/bits/c++allocator.h: + +/usr/include/c++/4.2/ext/new_allocator.h: + +/usr/include/c++/4.2/new: + +/usr/include/c++/4.2/exception: + +/usr/include/c++/4.2/bits/stl_construct.h: + +/usr/include/c++/4.2/bits/stl_uninitialized.h: + +/usr/include/c++/4.2/bits/stl_list.h: + +/usr/include/c++/4.2/bits/list.tcc: + +/usr/include/c++/4.2/string: + +/usr/include/c++/4.2/bits/char_traits.h: + +/usr/include/c++/4.2/memory: + +/usr/include/c++/4.2/bits/stl_raw_storage_iter.h: + +/usr/include/c++/4.2/limits: + +/usr/include/c++/4.2/bits/ostream_insert.h: + +/usr/include/c++/4.2/bits/stl_function.h: + +/usr/include/c++/4.2/bits/basic_string.h: + +/usr/include/c++/4.2/ext/atomicity.h: + +/usr/include/c++/4.2/i486-linux-gnu/bits/atomic_word.h: + +/usr/include/c++/4.2/algorithm: + +/usr/include/c++/4.2/bits/stl_algo.h: + +/usr/include/c++/4.2/bits/stl_heap.h: + +/usr/include/c++/4.2/bits/stl_tempbuf.h: + +/usr/include/c++/4.2/bits/basic_string.tcc: + +DoxygenTranslator/src/DoxygenEntity.h: + +/usr/include/c++/4.2/iostream: + +/usr/include/c++/4.2/ostream: + +/usr/include/c++/4.2/ios: + +/usr/include/c++/4.2/bits/localefwd.h: + +/usr/include/c++/4.2/bits/ios_base.h: + +/usr/include/c++/4.2/bits/locale_classes.h: + +/usr/include/c++/4.2/streambuf: + +/usr/include/c++/4.2/bits/streambuf.tcc: + +/usr/include/c++/4.2/bits/basic_ios.h: + +/usr/include/c++/4.2/bits/streambuf_iterator.h: + +/usr/include/c++/4.2/bits/locale_facets.h: + +/usr/include/c++/4.2/cwctype: + +/usr/include/wctype.h: + +/usr/include/c++/4.2/i486-linux-gnu/bits/ctype_base.h: + +/usr/include/c++/4.2/i486-linux-gnu/bits/ctype_inline.h: + +/usr/include/c++/4.2/bits/codecvt.h: + +/usr/include/c++/4.2/i486-linux-gnu/bits/time_members.h: + +/usr/include/c++/4.2/i486-linux-gnu/bits/messages_members.h: + +/usr/include/c++/4.2/bits/basic_ios.tcc: + +/usr/include/c++/4.2/bits/ostream.tcc: + +/usr/include/c++/4.2/locale: + +/usr/include/c++/4.2/bits/locale_facets.tcc: + +/usr/include/c++/4.2/typeinfo: + +/usr/include/c++/4.2/istream: + +/usr/include/c++/4.2/bits/istream.tcc: diff --git a/Source/DoxygenTranslator/src/.deps/Token.Po b/Source/DoxygenTranslator/src/.deps/Token.Po new file mode 100644 index 000000000..9a4bb90f5 --- /dev/null +++ b/Source/DoxygenTranslator/src/.deps/Token.Po @@ -0,0 +1,379 @@ +DoxygenTranslator/src/Token.o DoxygenTranslator/src/Token.o: \ + DoxygenTranslator/src/Token.cpp DoxygenTranslator/src/Token.h \ + /usr/include/c++/4.2/string \ + /usr/include/c++/4.2/i486-linux-gnu/bits/c++config.h \ + /usr/include/c++/4.2/i486-linux-gnu/bits/os_defines.h \ + /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/include/c++/4.2/i486-linux-gnu/bits/cpu_defines.h \ + /usr/include/c++/4.2/bits/stringfwd.h \ + /usr/include/c++/4.2/bits/char_traits.h /usr/include/c++/4.2/cstring \ + /usr/include/c++/4.2/cstddef \ + /usr/lib/gcc/i486-linux-gnu/4.2.3/include/stddef.h \ + /usr/include/string.h /usr/include/xlocale.h \ + /usr/include/c++/4.2/bits/stl_algobase.h /usr/include/c++/4.2/climits \ + /usr/lib/gcc/i486-linux-gnu/4.2.3/include/limits.h \ + /usr/lib/gcc/i486-linux-gnu/4.2.3/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/xopen_lim.h \ + /usr/include/bits/stdio_lim.h /usr/include/c++/4.2/cstdlib \ + /usr/include/stdlib.h /usr/include/bits/waitflags.h \ + /usr/include/bits/waitstatus.h /usr/include/endian.h \ + /usr/include/bits/endian.h /usr/include/sys/types.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/time.h /usr/include/sys/select.h \ + /usr/include/bits/select.h /usr/include/bits/sigset.h \ + /usr/include/bits/time.h /usr/include/sys/sysmacros.h \ + /usr/include/bits/pthreadtypes.h /usr/include/alloca.h \ + /usr/include/c++/4.2/iosfwd \ + /usr/include/c++/4.2/i486-linux-gnu/bits/c++locale.h \ + /usr/include/c++/4.2/cstdio /usr/include/stdio.h /usr/include/libio.h \ + /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/lib/gcc/i486-linux-gnu/4.2.3/include/stdarg.h \ + /usr/include/bits/sys_errlist.h /usr/include/c++/4.2/clocale \ + /usr/include/locale.h /usr/include/bits/locale.h \ + /usr/include/langinfo.h /usr/include/nl_types.h /usr/include/iconv.h \ + /usr/include/libintl.h /usr/include/c++/4.2/cstdarg \ + /usr/include/c++/4.2/i486-linux-gnu/bits/c++io.h \ + /usr/include/c++/4.2/i486-linux-gnu/bits/gthr.h \ + /usr/include/c++/4.2/i486-linux-gnu/bits/gthr-default.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/signal.h /usr/include/bits/setjmp.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/environments.h \ + /usr/include/bits/confname.h /usr/include/getopt.h \ + /usr/include/c++/4.2/cctype /usr/include/ctype.h \ + /usr/include/c++/4.2/bits/postypes.h /usr/include/c++/4.2/cwchar \ + /usr/include/c++/4.2/ctime /usr/include/bits/wchar.h \ + /usr/include/stdint.h /usr/include/c++/4.2/bits/functexcept.h \ + /usr/include/c++/4.2/exception_defines.h \ + /usr/include/c++/4.2/bits/stl_pair.h \ + /usr/include/c++/4.2/bits/cpp_type_traits.h \ + /usr/include/c++/4.2/ext/type_traits.h /usr/include/c++/4.2/utility \ + /usr/include/c++/4.2/bits/stl_relops.h \ + /usr/include/c++/4.2/bits/stl_iterator_base_types.h \ + /usr/include/c++/4.2/bits/stl_iterator_base_funcs.h \ + /usr/include/c++/4.2/bits/concept_check.h \ + /usr/include/c++/4.2/bits/stl_iterator.h \ + /usr/include/c++/4.2/debug/debug.h /usr/include/c++/4.2/memory \ + /usr/include/c++/4.2/bits/allocator.h \ + /usr/include/c++/4.2/i486-linux-gnu/bits/c++allocator.h \ + /usr/include/c++/4.2/ext/new_allocator.h /usr/include/c++/4.2/new \ + /usr/include/c++/4.2/exception \ + /usr/include/c++/4.2/bits/stl_construct.h \ + /usr/include/c++/4.2/bits/stl_uninitialized.h \ + /usr/include/c++/4.2/bits/stl_raw_storage_iter.h \ + /usr/include/c++/4.2/limits /usr/include/c++/4.2/bits/ostream_insert.h \ + /usr/include/c++/4.2/bits/stl_function.h \ + /usr/include/c++/4.2/bits/basic_string.h \ + /usr/include/c++/4.2/ext/atomicity.h \ + /usr/include/c++/4.2/i486-linux-gnu/bits/atomic_word.h \ + /usr/include/c++/4.2/algorithm /usr/include/c++/4.2/bits/stl_algo.h \ + /usr/include/c++/4.2/bits/stl_heap.h \ + /usr/include/c++/4.2/bits/stl_tempbuf.h \ + /usr/include/c++/4.2/bits/basic_string.tcc \ + /usr/include/c++/4.2/iostream /usr/include/c++/4.2/ostream \ + /usr/include/c++/4.2/ios /usr/include/c++/4.2/bits/localefwd.h \ + /usr/include/c++/4.2/bits/ios_base.h \ + /usr/include/c++/4.2/bits/locale_classes.h \ + /usr/include/c++/4.2/streambuf /usr/include/c++/4.2/bits/streambuf.tcc \ + /usr/include/c++/4.2/bits/basic_ios.h \ + /usr/include/c++/4.2/bits/streambuf_iterator.h \ + /usr/include/c++/4.2/bits/locale_facets.h /usr/include/c++/4.2/cwctype \ + /usr/include/wctype.h \ + /usr/include/c++/4.2/i486-linux-gnu/bits/ctype_base.h \ + /usr/include/c++/4.2/i486-linux-gnu/bits/ctype_inline.h \ + /usr/include/c++/4.2/bits/codecvt.h \ + /usr/include/c++/4.2/i486-linux-gnu/bits/time_members.h \ + /usr/include/c++/4.2/i486-linux-gnu/bits/messages_members.h \ + /usr/include/c++/4.2/bits/basic_ios.tcc \ + /usr/include/c++/4.2/bits/ostream.tcc /usr/include/c++/4.2/locale \ + /usr/include/c++/4.2/bits/locale_facets.tcc \ + /usr/include/c++/4.2/typeinfo /usr/include/c++/4.2/istream \ + /usr/include/c++/4.2/bits/istream.tcc /usr/include/c++/4.2/list \ + /usr/include/c++/4.2/bits/stl_list.h /usr/include/c++/4.2/bits/list.tcc + +DoxygenTranslator/src/Token.h: + +/usr/include/c++/4.2/string: + +/usr/include/c++/4.2/i486-linux-gnu/bits/c++config.h: + +/usr/include/c++/4.2/i486-linux-gnu/bits/os_defines.h: + +/usr/include/features.h: + +/usr/include/sys/cdefs.h: + +/usr/include/bits/wordsize.h: + +/usr/include/gnu/stubs.h: + +/usr/include/gnu/stubs-32.h: + +/usr/include/c++/4.2/i486-linux-gnu/bits/cpu_defines.h: + +/usr/include/c++/4.2/bits/stringfwd.h: + +/usr/include/c++/4.2/bits/char_traits.h: + +/usr/include/c++/4.2/cstring: + +/usr/include/c++/4.2/cstddef: + +/usr/lib/gcc/i486-linux-gnu/4.2.3/include/stddef.h: + +/usr/include/string.h: + +/usr/include/xlocale.h: + +/usr/include/c++/4.2/bits/stl_algobase.h: + +/usr/include/c++/4.2/climits: + +/usr/lib/gcc/i486-linux-gnu/4.2.3/include/limits.h: + +/usr/lib/gcc/i486-linux-gnu/4.2.3/include/syslimits.h: + +/usr/include/limits.h: + +/usr/include/bits/posix1_lim.h: + +/usr/include/bits/local_lim.h: + +/usr/include/linux/limits.h: + +/usr/include/bits/posix2_lim.h: + +/usr/include/bits/xopen_lim.h: + +/usr/include/bits/stdio_lim.h: + +/usr/include/c++/4.2/cstdlib: + +/usr/include/stdlib.h: + +/usr/include/bits/waitflags.h: + +/usr/include/bits/waitstatus.h: + +/usr/include/endian.h: + +/usr/include/bits/endian.h: + +/usr/include/sys/types.h: + +/usr/include/bits/types.h: + +/usr/include/bits/typesizes.h: + +/usr/include/time.h: + +/usr/include/sys/select.h: + +/usr/include/bits/select.h: + +/usr/include/bits/sigset.h: + +/usr/include/bits/time.h: + +/usr/include/sys/sysmacros.h: + +/usr/include/bits/pthreadtypes.h: + +/usr/include/alloca.h: + +/usr/include/c++/4.2/iosfwd: + +/usr/include/c++/4.2/i486-linux-gnu/bits/c++locale.h: + +/usr/include/c++/4.2/cstdio: + +/usr/include/stdio.h: + +/usr/include/libio.h: + +/usr/include/_G_config.h: + +/usr/include/wchar.h: + +/usr/lib/gcc/i486-linux-gnu/4.2.3/include/stdarg.h: + +/usr/include/bits/sys_errlist.h: + +/usr/include/c++/4.2/clocale: + +/usr/include/locale.h: + +/usr/include/bits/locale.h: + +/usr/include/langinfo.h: + +/usr/include/nl_types.h: + +/usr/include/iconv.h: + +/usr/include/libintl.h: + +/usr/include/c++/4.2/cstdarg: + +/usr/include/c++/4.2/i486-linux-gnu/bits/c++io.h: + +/usr/include/c++/4.2/i486-linux-gnu/bits/gthr.h: + +/usr/include/c++/4.2/i486-linux-gnu/bits/gthr-default.h: + +/usr/include/pthread.h: + +/usr/include/sched.h: + +/usr/include/bits/sched.h: + +/usr/include/signal.h: + +/usr/include/bits/setjmp.h: + +/usr/include/unistd.h: + +/usr/include/bits/posix_opt.h: + +/usr/include/bits/environments.h: + +/usr/include/bits/confname.h: + +/usr/include/getopt.h: + +/usr/include/c++/4.2/cctype: + +/usr/include/ctype.h: + +/usr/include/c++/4.2/bits/postypes.h: + +/usr/include/c++/4.2/cwchar: + +/usr/include/c++/4.2/ctime: + +/usr/include/bits/wchar.h: + +/usr/include/stdint.h: + +/usr/include/c++/4.2/bits/functexcept.h: + +/usr/include/c++/4.2/exception_defines.h: + +/usr/include/c++/4.2/bits/stl_pair.h: + +/usr/include/c++/4.2/bits/cpp_type_traits.h: + +/usr/include/c++/4.2/ext/type_traits.h: + +/usr/include/c++/4.2/utility: + +/usr/include/c++/4.2/bits/stl_relops.h: + +/usr/include/c++/4.2/bits/stl_iterator_base_types.h: + +/usr/include/c++/4.2/bits/stl_iterator_base_funcs.h: + +/usr/include/c++/4.2/bits/concept_check.h: + +/usr/include/c++/4.2/bits/stl_iterator.h: + +/usr/include/c++/4.2/debug/debug.h: + +/usr/include/c++/4.2/memory: + +/usr/include/c++/4.2/bits/allocator.h: + +/usr/include/c++/4.2/i486-linux-gnu/bits/c++allocator.h: + +/usr/include/c++/4.2/ext/new_allocator.h: + +/usr/include/c++/4.2/new: + +/usr/include/c++/4.2/exception: + +/usr/include/c++/4.2/bits/stl_construct.h: + +/usr/include/c++/4.2/bits/stl_uninitialized.h: + +/usr/include/c++/4.2/bits/stl_raw_storage_iter.h: + +/usr/include/c++/4.2/limits: + +/usr/include/c++/4.2/bits/ostream_insert.h: + +/usr/include/c++/4.2/bits/stl_function.h: + +/usr/include/c++/4.2/bits/basic_string.h: + +/usr/include/c++/4.2/ext/atomicity.h: + +/usr/include/c++/4.2/i486-linux-gnu/bits/atomic_word.h: + +/usr/include/c++/4.2/algorithm: + +/usr/include/c++/4.2/bits/stl_algo.h: + +/usr/include/c++/4.2/bits/stl_heap.h: + +/usr/include/c++/4.2/bits/stl_tempbuf.h: + +/usr/include/c++/4.2/bits/basic_string.tcc: + +/usr/include/c++/4.2/iostream: + +/usr/include/c++/4.2/ostream: + +/usr/include/c++/4.2/ios: + +/usr/include/c++/4.2/bits/localefwd.h: + +/usr/include/c++/4.2/bits/ios_base.h: + +/usr/include/c++/4.2/bits/locale_classes.h: + +/usr/include/c++/4.2/streambuf: + +/usr/include/c++/4.2/bits/streambuf.tcc: + +/usr/include/c++/4.2/bits/basic_ios.h: + +/usr/include/c++/4.2/bits/streambuf_iterator.h: + +/usr/include/c++/4.2/bits/locale_facets.h: + +/usr/include/c++/4.2/cwctype: + +/usr/include/wctype.h: + +/usr/include/c++/4.2/i486-linux-gnu/bits/ctype_base.h: + +/usr/include/c++/4.2/i486-linux-gnu/bits/ctype_inline.h: + +/usr/include/c++/4.2/bits/codecvt.h: + +/usr/include/c++/4.2/i486-linux-gnu/bits/time_members.h: + +/usr/include/c++/4.2/i486-linux-gnu/bits/messages_members.h: + +/usr/include/c++/4.2/bits/basic_ios.tcc: + +/usr/include/c++/4.2/bits/ostream.tcc: + +/usr/include/c++/4.2/locale: + +/usr/include/c++/4.2/bits/locale_facets.tcc: + +/usr/include/c++/4.2/typeinfo: + +/usr/include/c++/4.2/istream: + +/usr/include/c++/4.2/bits/istream.tcc: + +/usr/include/c++/4.2/list: + +/usr/include/c++/4.2/bits/stl_list.h: + +/usr/include/c++/4.2/bits/list.tcc: diff --git a/Source/DoxygenTranslator/src/.deps/TokenList.Po b/Source/DoxygenTranslator/src/.deps/TokenList.Po new file mode 100644 index 000000000..74d0e1c79 --- /dev/null +++ b/Source/DoxygenTranslator/src/.deps/TokenList.Po @@ -0,0 +1,382 @@ +DoxygenTranslator/src/TokenList.o DoxygenTranslator/src/TokenList.o: \ + DoxygenTranslator/src/TokenList.cpp DoxygenTranslator/src/TokenList.h \ + /usr/include/c++/4.2/cstdlib \ + /usr/include/c++/4.2/i486-linux-gnu/bits/c++config.h \ + /usr/include/c++/4.2/i486-linux-gnu/bits/os_defines.h \ + /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/include/c++/4.2/i486-linux-gnu/bits/cpu_defines.h \ + /usr/include/c++/4.2/cstddef \ + /usr/lib/gcc/i486-linux-gnu/4.2.3/include/stddef.h \ + /usr/include/stdlib.h /usr/include/bits/waitflags.h \ + /usr/include/bits/waitstatus.h /usr/include/endian.h \ + /usr/include/bits/endian.h /usr/include/xlocale.h \ + /usr/include/sys/types.h /usr/include/bits/types.h \ + /usr/include/bits/typesizes.h /usr/include/time.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/alloca.h /usr/include/c++/4.2/iostream \ + /usr/include/c++/4.2/ostream /usr/include/c++/4.2/ios \ + /usr/include/c++/4.2/iosfwd \ + /usr/include/c++/4.2/i486-linux-gnu/bits/c++locale.h \ + /usr/include/c++/4.2/cstring /usr/include/string.h \ + /usr/include/c++/4.2/cstdio /usr/include/stdio.h /usr/include/libio.h \ + /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/lib/gcc/i486-linux-gnu/4.2.3/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/c++/4.2/clocale /usr/include/locale.h \ + /usr/include/bits/locale.h /usr/include/langinfo.h \ + /usr/include/nl_types.h /usr/include/iconv.h /usr/include/libintl.h \ + /usr/include/c++/4.2/cstdarg \ + /usr/include/c++/4.2/i486-linux-gnu/bits/c++io.h \ + /usr/include/c++/4.2/i486-linux-gnu/bits/gthr.h \ + /usr/include/c++/4.2/i486-linux-gnu/bits/gthr-default.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/signal.h /usr/include/bits/setjmp.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/environments.h \ + /usr/include/bits/confname.h /usr/include/getopt.h \ + /usr/include/c++/4.2/cctype /usr/include/ctype.h \ + /usr/include/c++/4.2/bits/stringfwd.h \ + /usr/include/c++/4.2/bits/postypes.h /usr/include/c++/4.2/cwchar \ + /usr/include/c++/4.2/ctime /usr/include/bits/wchar.h \ + /usr/include/stdint.h /usr/include/c++/4.2/bits/functexcept.h \ + /usr/include/c++/4.2/exception_defines.h /usr/include/c++/4.2/exception \ + /usr/include/c++/4.2/bits/char_traits.h \ + /usr/include/c++/4.2/bits/stl_algobase.h /usr/include/c++/4.2/climits \ + /usr/lib/gcc/i486-linux-gnu/4.2.3/include/limits.h \ + /usr/lib/gcc/i486-linux-gnu/4.2.3/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/xopen_lim.h \ + /usr/include/c++/4.2/bits/stl_pair.h \ + /usr/include/c++/4.2/bits/cpp_type_traits.h \ + /usr/include/c++/4.2/ext/type_traits.h /usr/include/c++/4.2/utility \ + /usr/include/c++/4.2/bits/stl_relops.h \ + /usr/include/c++/4.2/bits/stl_iterator_base_types.h \ + /usr/include/c++/4.2/bits/stl_iterator_base_funcs.h \ + /usr/include/c++/4.2/bits/concept_check.h \ + /usr/include/c++/4.2/bits/stl_iterator.h \ + /usr/include/c++/4.2/debug/debug.h \ + /usr/include/c++/4.2/bits/localefwd.h \ + /usr/include/c++/4.2/bits/ios_base.h \ + /usr/include/c++/4.2/ext/atomicity.h \ + /usr/include/c++/4.2/i486-linux-gnu/bits/atomic_word.h \ + /usr/include/c++/4.2/bits/locale_classes.h /usr/include/c++/4.2/string \ + /usr/include/c++/4.2/memory /usr/include/c++/4.2/bits/allocator.h \ + /usr/include/c++/4.2/i486-linux-gnu/bits/c++allocator.h \ + /usr/include/c++/4.2/ext/new_allocator.h /usr/include/c++/4.2/new \ + /usr/include/c++/4.2/bits/stl_construct.h \ + /usr/include/c++/4.2/bits/stl_uninitialized.h \ + /usr/include/c++/4.2/bits/stl_raw_storage_iter.h \ + /usr/include/c++/4.2/limits /usr/include/c++/4.2/bits/ostream_insert.h \ + /usr/include/c++/4.2/bits/stl_function.h \ + /usr/include/c++/4.2/bits/basic_string.h /usr/include/c++/4.2/algorithm \ + /usr/include/c++/4.2/bits/stl_algo.h \ + /usr/include/c++/4.2/bits/stl_heap.h \ + /usr/include/c++/4.2/bits/stl_tempbuf.h \ + /usr/include/c++/4.2/bits/basic_string.tcc \ + /usr/include/c++/4.2/streambuf /usr/include/c++/4.2/bits/streambuf.tcc \ + /usr/include/c++/4.2/bits/basic_ios.h \ + /usr/include/c++/4.2/bits/streambuf_iterator.h \ + /usr/include/c++/4.2/bits/locale_facets.h /usr/include/c++/4.2/cwctype \ + /usr/include/wctype.h \ + /usr/include/c++/4.2/i486-linux-gnu/bits/ctype_base.h \ + /usr/include/c++/4.2/i486-linux-gnu/bits/ctype_inline.h \ + /usr/include/c++/4.2/bits/codecvt.h \ + /usr/include/c++/4.2/i486-linux-gnu/bits/time_members.h \ + /usr/include/c++/4.2/i486-linux-gnu/bits/messages_members.h \ + /usr/include/c++/4.2/bits/basic_ios.tcc \ + /usr/include/c++/4.2/bits/ostream.tcc /usr/include/c++/4.2/locale \ + /usr/include/c++/4.2/bits/locale_facets.tcc \ + /usr/include/c++/4.2/typeinfo /usr/include/c++/4.2/istream \ + /usr/include/c++/4.2/bits/istream.tcc /usr/include/c++/4.2/list \ + /usr/include/c++/4.2/bits/stl_list.h /usr/include/c++/4.2/bits/list.tcc \ + DoxygenTranslator/src/Token.h + +DoxygenTranslator/src/TokenList.h: + +/usr/include/c++/4.2/cstdlib: + +/usr/include/c++/4.2/i486-linux-gnu/bits/c++config.h: + +/usr/include/c++/4.2/i486-linux-gnu/bits/os_defines.h: + +/usr/include/features.h: + +/usr/include/sys/cdefs.h: + +/usr/include/bits/wordsize.h: + +/usr/include/gnu/stubs.h: + +/usr/include/gnu/stubs-32.h: + +/usr/include/c++/4.2/i486-linux-gnu/bits/cpu_defines.h: + +/usr/include/c++/4.2/cstddef: + +/usr/lib/gcc/i486-linux-gnu/4.2.3/include/stddef.h: + +/usr/include/stdlib.h: + +/usr/include/bits/waitflags.h: + +/usr/include/bits/waitstatus.h: + +/usr/include/endian.h: + +/usr/include/bits/endian.h: + +/usr/include/xlocale.h: + +/usr/include/sys/types.h: + +/usr/include/bits/types.h: + +/usr/include/bits/typesizes.h: + +/usr/include/time.h: + +/usr/include/sys/select.h: + +/usr/include/bits/select.h: + +/usr/include/bits/sigset.h: + +/usr/include/bits/time.h: + +/usr/include/sys/sysmacros.h: + +/usr/include/bits/pthreadtypes.h: + +/usr/include/alloca.h: + +/usr/include/c++/4.2/iostream: + +/usr/include/c++/4.2/ostream: + +/usr/include/c++/4.2/ios: + +/usr/include/c++/4.2/iosfwd: + +/usr/include/c++/4.2/i486-linux-gnu/bits/c++locale.h: + +/usr/include/c++/4.2/cstring: + +/usr/include/string.h: + +/usr/include/c++/4.2/cstdio: + +/usr/include/stdio.h: + +/usr/include/libio.h: + +/usr/include/_G_config.h: + +/usr/include/wchar.h: + +/usr/lib/gcc/i486-linux-gnu/4.2.3/include/stdarg.h: + +/usr/include/bits/stdio_lim.h: + +/usr/include/bits/sys_errlist.h: + +/usr/include/c++/4.2/clocale: + +/usr/include/locale.h: + +/usr/include/bits/locale.h: + +/usr/include/langinfo.h: + +/usr/include/nl_types.h: + +/usr/include/iconv.h: + +/usr/include/libintl.h: + +/usr/include/c++/4.2/cstdarg: + +/usr/include/c++/4.2/i486-linux-gnu/bits/c++io.h: + +/usr/include/c++/4.2/i486-linux-gnu/bits/gthr.h: + +/usr/include/c++/4.2/i486-linux-gnu/bits/gthr-default.h: + +/usr/include/pthread.h: + +/usr/include/sched.h: + +/usr/include/bits/sched.h: + +/usr/include/signal.h: + +/usr/include/bits/setjmp.h: + +/usr/include/unistd.h: + +/usr/include/bits/posix_opt.h: + +/usr/include/bits/environments.h: + +/usr/include/bits/confname.h: + +/usr/include/getopt.h: + +/usr/include/c++/4.2/cctype: + +/usr/include/ctype.h: + +/usr/include/c++/4.2/bits/stringfwd.h: + +/usr/include/c++/4.2/bits/postypes.h: + +/usr/include/c++/4.2/cwchar: + +/usr/include/c++/4.2/ctime: + +/usr/include/bits/wchar.h: + +/usr/include/stdint.h: + +/usr/include/c++/4.2/bits/functexcept.h: + +/usr/include/c++/4.2/exception_defines.h: + +/usr/include/c++/4.2/exception: + +/usr/include/c++/4.2/bits/char_traits.h: + +/usr/include/c++/4.2/bits/stl_algobase.h: + +/usr/include/c++/4.2/climits: + +/usr/lib/gcc/i486-linux-gnu/4.2.3/include/limits.h: + +/usr/lib/gcc/i486-linux-gnu/4.2.3/include/syslimits.h: + +/usr/include/limits.h: + +/usr/include/bits/posix1_lim.h: + +/usr/include/bits/local_lim.h: + +/usr/include/linux/limits.h: + +/usr/include/bits/posix2_lim.h: + +/usr/include/bits/xopen_lim.h: + +/usr/include/c++/4.2/bits/stl_pair.h: + +/usr/include/c++/4.2/bits/cpp_type_traits.h: + +/usr/include/c++/4.2/ext/type_traits.h: + +/usr/include/c++/4.2/utility: + +/usr/include/c++/4.2/bits/stl_relops.h: + +/usr/include/c++/4.2/bits/stl_iterator_base_types.h: + +/usr/include/c++/4.2/bits/stl_iterator_base_funcs.h: + +/usr/include/c++/4.2/bits/concept_check.h: + +/usr/include/c++/4.2/bits/stl_iterator.h: + +/usr/include/c++/4.2/debug/debug.h: + +/usr/include/c++/4.2/bits/localefwd.h: + +/usr/include/c++/4.2/bits/ios_base.h: + +/usr/include/c++/4.2/ext/atomicity.h: + +/usr/include/c++/4.2/i486-linux-gnu/bits/atomic_word.h: + +/usr/include/c++/4.2/bits/locale_classes.h: + +/usr/include/c++/4.2/string: + +/usr/include/c++/4.2/memory: + +/usr/include/c++/4.2/bits/allocator.h: + +/usr/include/c++/4.2/i486-linux-gnu/bits/c++allocator.h: + +/usr/include/c++/4.2/ext/new_allocator.h: + +/usr/include/c++/4.2/new: + +/usr/include/c++/4.2/bits/stl_construct.h: + +/usr/include/c++/4.2/bits/stl_uninitialized.h: + +/usr/include/c++/4.2/bits/stl_raw_storage_iter.h: + +/usr/include/c++/4.2/limits: + +/usr/include/c++/4.2/bits/ostream_insert.h: + +/usr/include/c++/4.2/bits/stl_function.h: + +/usr/include/c++/4.2/bits/basic_string.h: + +/usr/include/c++/4.2/algorithm: + +/usr/include/c++/4.2/bits/stl_algo.h: + +/usr/include/c++/4.2/bits/stl_heap.h: + +/usr/include/c++/4.2/bits/stl_tempbuf.h: + +/usr/include/c++/4.2/bits/basic_string.tcc: + +/usr/include/c++/4.2/streambuf: + +/usr/include/c++/4.2/bits/streambuf.tcc: + +/usr/include/c++/4.2/bits/basic_ios.h: + +/usr/include/c++/4.2/bits/streambuf_iterator.h: + +/usr/include/c++/4.2/bits/locale_facets.h: + +/usr/include/c++/4.2/cwctype: + +/usr/include/wctype.h: + +/usr/include/c++/4.2/i486-linux-gnu/bits/ctype_base.h: + +/usr/include/c++/4.2/i486-linux-gnu/bits/ctype_inline.h: + +/usr/include/c++/4.2/bits/codecvt.h: + +/usr/include/c++/4.2/i486-linux-gnu/bits/time_members.h: + +/usr/include/c++/4.2/i486-linux-gnu/bits/messages_members.h: + +/usr/include/c++/4.2/bits/basic_ios.tcc: + +/usr/include/c++/4.2/bits/ostream.tcc: + +/usr/include/c++/4.2/locale: + +/usr/include/c++/4.2/bits/locale_facets.tcc: + +/usr/include/c++/4.2/typeinfo: + +/usr/include/c++/4.2/istream: + +/usr/include/c++/4.2/bits/istream.tcc: + +/usr/include/c++/4.2/list: + +/usr/include/c++/4.2/bits/stl_list.h: + +/usr/include/c++/4.2/bits/list.tcc: + +DoxygenTranslator/src/Token.h: diff --git a/Source/DoxygenTranslator/src/.dirstamp b/Source/DoxygenTranslator/src/.dirstamp new file mode 100644 index 000000000..e69de29bb diff --git a/Source/DoxygenTranslator/src/DoxygenEntity.cpp b/Source/DoxygenTranslator/src/DoxygenEntity.cpp new file mode 100644 index 000000000..6b8755592 --- /dev/null +++ b/Source/DoxygenTranslator/src/DoxygenEntity.cpp @@ -0,0 +1,89 @@ +#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 findCommand(int commandNum){ + + int arraySize = sizeof(commandArray2)/sizeof(*commandArray2); + if (commandNum - 101 >= 0 && commandNum - 101 < arraySize){ + return commandArray2[commandNum - 101]; + } + + return "" ; +} + +DoxygenEntity::DoxygenEntity(string 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(string typeEnt, string param1){ + typeOfEntity = typeEnt; + data = param1; + isLeaf = 1; +} + +/* Nonterminal node + * contains + */ +DoxygenEntity::DoxygenEntity(string typeEnt, list &entList ){ + typeOfEntity = typeEnt; + data = ""; + isLeaf = 0; + entityList = entList; +} + + +void DoxygenEntity::printEntity(int level){ + int thisLevel = level; + if (isLeaf) { + for (int i = 0; i < thisLevel; i++) {cout << "\t";} + cout << "Node Command: " << typeOfEntity << " "; + if (data.compare("") != 0) cout << "Node Data: " << data; + cout << endl; + } + else{ + for (int i = 0; i < thisLevel; i++) {cout << "\t";} + cout << "Node Command : " << typeOfEntity << endl; + list::iterator p = entityList.begin(); + thisLevel++; + while (p != entityList.end()){ + (*p).printEntity(thisLevel); + p++; + } + } +} + +DoxygenEntity::~DoxygenEntity() +{ +} diff --git a/Source/DoxygenTranslator/src/DoxygenEntity.h b/Source/DoxygenTranslator/src/DoxygenEntity.h new file mode 100644 index 000000000..0605b1cc9 --- /dev/null +++ b/Source/DoxygenTranslator/src/DoxygenEntity.h @@ -0,0 +1,26 @@ +#ifndef DOXYGENENTITY_H_ +#define DOXYGENENTITY_H_ + +#include +#include +#include +#include + +using namespace std; + +class DoxygenEntity{ + +public: + DoxygenEntity(string typeEnt); + DoxygenEntity(string typeEnt, string param1); + DoxygenEntity(string typeEnt, list &entList ); + ~DoxygenEntity(); + void printEntity(int level); + string typeOfEntity; + list entityList; + string data; + int isLeaf; +}; + + +#endif /*TOKENLIST_H_*/ diff --git a/Source/DoxygenTranslator/src/DoxygenParser.cpp b/Source/DoxygenTranslator/src/DoxygenParser.cpp new file mode 100644 index 000000000..226c60720 --- /dev/null +++ b/Source/DoxygenTranslator/src/DoxygenParser.cpp @@ -0,0 +1,797 @@ +#include "DoxygenParser.h" + +#include +#include +#include +#include +#include +#include "DoxygenEntity.h" +#include "TokenList.h" +#include "JavaDocConverter.h" +#define SIMPLECOMMAND 1 +#define IGNOREDSIMPLECOMMAND 2 +#define COMMANDWORD 3 +#define IGNOREDCOMMANDWORD 4 +#define COMMANDLINE 5 +#define IGNOREDCOMMANDLINE 6 +#define COMMANDPARAGRAPH 7 +#define IGNORECOMMANDPARAGRAPH 8 +#define COMMANDENDCOMMAND 9 +#define COMMANDWORDPARAGRAPH 10 +#define COMMANDWORDLINE 11 +#define COMMANDWORDOWORDWORD 12 +#define COMMANDOWORD 13 +#define COMMANDERRORTHROW 14 +#define COMMANDUNIQUE 15 +#define END_LINE 101 +#define PARAGRAPH_END 102 +#define PLAINSTRING 103 +#define COMMAND 104 +using namespace std; + +////////////////////////////////////////// +/*Set these to pick what internal functions +to test. */ + +//int testCommandParsingFunctions = 1;// not implemented + + +DoxygenParser::DoxygenParser() +{ +} + +DoxygenParser::~DoxygenParser() +{ +} + +int noisy = 0; // set this to 1 for extra chatter from the parsing stage. +int addCommand(string currCommand, TokenList &tokList, list &aNewList); +list parse(list::iterator endParsingIndex, TokenList &tokList); + +////////////////////////////////////////// + + +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 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" }; + +/* All of the doxygen commands divided up by how they are parsed */ +string simpleCommands[] = {"n", "$", "@", "\\", "&", "~", "<", ">", "#", "%"}; +string ignoredSimpleCommands[] = {"nothing at the moment"}; +string commandWords[] = {"a", "b", "c", "e", "em", "p", "def", "enum", "example", "package", + "relates", "namespace", "relatesalso","anchor", "dontinclude", "include", "includelineno"}; +string ignoredCommandWords[] = {"copydoc", "copybrief", "copydetails", "verbinclude", "htmlinclude"}; +string commandLines[] = {"addindex", "fn", "name", "line", "var", "skipline", "typedef", "skip", "until", "property"}; +string ignoreCommandLines[] = {"nothing at the moment"}; +string commandParagraph[] = {"return", "remarks", "since", "test", "sa", "see", "pre", "post", "details", "invariant", + "deprecated", "date", "note", "warning", "version", "todo", "bug", "attention", "brief", "author"}; +string ignoreCommandParagraphs[] = {"nothing at the moment"}; +string commandEndCommands[] = {"code", "dot", "msc", "f$", "f[", "f{environment}{", "htmlonly", "latexonly", "manonly", + "verbatim", "xmlonly", "cond", "if", "ifnot", "link"}; +string commandWordParagraphs[] = {"param", "tparam", "throw", "retval", "exception"}; +string commandWordLines[] = {"page", "subsection", "subsubsection", "section", "paragraph", "defgroup"}; +string commandWordOWordOWords [] = {"category", "class", "protocol", "interface", "struct", "union"}; +string commandOWords[] = {"dir", "file", "cond"}; +string commandErrorThrowings[] = {"annotatedclasslist", "classhierarchy", "define", "functionindex", "header", + "headerfilelist", "inherit", "l", "postheader", "private", "privatesection", "protected", + "protectedsection", "public", "publicsection", "endcode", "enddot", "endmsc", "endhtmlonly", + "endlatexonly", "endmanonly", "endlink", "endverbatim", "endxmlonly", "f]", "f}", "endcond", + "endif"}; +string commandUniques[] = {"xrefitem", "arg", "ingroup", "par", "headerfile", "overload", "weakgroup", "ref", + "subpage", "dotfile", "image", "addtogroup", "li"}; + + +/* Changes a string to all lower case*/ +string StringToLower(string stringToConvert) + +{ + + for(unsigned int i=0;i &rootList){ + + list::iterator p = rootList.begin(); + while (p != rootList.end()){ + (*p).printEntity(0); + p++; + } + +} + +/* Determines how a command should be handled (what group it belongs to + * for parsing rules + */ + +int commandBelongs(string theCommand){ + string smallString = StringToLower(theCommand ); + //cout << " Looking for command " << theCommand << endl; + int i = 0; + for ( i = 0; i < sizeof(simpleCommands)/sizeof(*simpleCommands); i++){ + if(smallString.compare(simpleCommands[i]) == 0){return SIMPLECOMMAND ;} + } + for ( i = 0; i < sizeof(ignoredSimpleCommands)/sizeof(*ignoredSimpleCommands); i++){ + if(smallString.compare(ignoredSimpleCommands[i]) == 0){return IGNOREDSIMPLECOMMAND;} + } + for ( i = 0; i < sizeof(commandWords)/sizeof(*commandWords); i++){ + if(smallString.compare( commandWords[i]) == 0){return COMMANDWORD;} + } + for ( i = 0; i < sizeof(ignoredCommandWords)/sizeof(*ignoredCommandWords); i++){ + if(smallString.compare( ignoredCommandWords[i]) == 0){return IGNOREDCOMMANDWORD;} + } + for ( i = 0; i < sizeof(commandLines)/sizeof(*commandLines); i++){ + if(smallString.compare( commandLines[i]) == 0){return COMMANDLINE;} + } + for ( i = 0; i < sizeof(ignoreCommandLines)/sizeof(*ignoreCommandLines); i++){ + if(smallString.compare( ignoreCommandLines[i]) == 0){return IGNOREDCOMMANDLINE;} + } + for ( i = 0; i < sizeof(commandParagraph)/sizeof(*commandParagraph); i++){ + if(smallString.compare( commandParagraph[i]) == 0){return COMMANDPARAGRAPH;} + } + /* IgnoreCommandParagraph */ + for ( i = 0; i < sizeof(ignoreCommandParagraphs)/sizeof(*ignoreCommandParagraphs); i++){ + if(smallString.compare( ignoreCommandParagraphs[i]) == 0){return IGNORECOMMANDPARAGRAPH;} + } + for ( i = 0; i < sizeof(commandEndCommands)/sizeof(*commandEndCommands); i++){ + if(smallString.compare( commandEndCommands[i]) == 0){return COMMANDENDCOMMAND ;} + } + for ( i = 0; i < sizeof(commandWordParagraphs)/sizeof(*commandWordParagraphs); i++){ + if(smallString.compare( commandWordParagraphs[i]) == 0){return COMMANDWORDPARAGRAPH;} + } + for ( i = 0; i < sizeof(commandWordLines)/sizeof(*commandWordLines); i++){ + if(smallString.compare( commandWordLines[i]) == 0){return COMMANDWORDLINE ;} + } + for ( i = 0; i < sizeof(commandWordOWordOWords)/sizeof(*commandWordOWordOWords); i++){ + if(smallString.compare( commandWordOWordOWords[i]) == 0){return COMMANDWORDOWORDWORD;} + } + for ( i = 0; i < sizeof(commandOWords)/sizeof(*commandOWords); i++){ + if(smallString.compare( commandOWords[i]) == 0){return COMMANDOWORD;} + } + for ( i = 0; i < sizeof(commandErrorThrowings)/sizeof(*commandErrorThrowings); i++){ + if(smallString.compare( commandErrorThrowings[i]) == 0){return COMMANDERRORTHROW;} + } + for ( i = 0; i < sizeof(commandUniques)/sizeof(*commandUniques); i++){ + if(smallString.compare( commandUniques[i]) == 0){return COMMANDUNIQUE;} + } + + return 0; + +} +/* Returns the next word ON THE CURRENT LINE ONLY + * if a new line is encountered, returns a blank string. + * Updates the index it is given if success. + */ + +string getNextWord(TokenList &tokList){ + Token nextToken = tokList.peek(); + if (nextToken.tokenType == PLAINSTRING ){ + nextToken = tokList.next(); + return nextToken.tokenString; + } + return ""; +} + +/* Returns the location of the end of the line as + * an iterator. + */ +list::iterator getOneLine(TokenList &tokList){ + list::iterator endOfParagraph = tokList.iteratorCopy(); + while(endOfParagraph != tokList.end()){ + if ((* endOfParagraph).tokenType == END_LINE){ + return endOfParagraph; + } + endOfParagraph++; + } + return tokList.end(); +} + + + +/* Returns a properly formatted string +* up til ANY command or end of paragraph is encountered. +*/ +string getStringTilCommand(TokenList &tokList){ + string description; + if (tokList.peek().tokenType == 0) return ""; + while(tokList.peek().tokenType == PLAINSTRING || tokList.peek().tokenType == END_LINE ){ + Token currentToken = tokList.next(); + if(currentToken.tokenType == PLAINSTRING) { + description = description + currentToken.tokenString + " "; + } + else if (tokList.peek().tokenType == END_LINE) break; + } + + return description; +} + +/* Returns a properly formatted string +* up til the command specified is encountered +*/ +//TODO check that this behaves properly for formulas + +string getStringTilEndCommand(string theCommand, TokenList &tokList){ + string description; + if (tokList.peek().tokenType == 0) return ""; + while(tokList.peek().tokenString.compare(theCommand) != 0 ){ + Token currentToken = tokList.next(); + description = description + currentToken.tokenString + " "; + + } + + return description; +} + +/* Returns the end of a Paragraph as an iterator- +* Paragraph is defined in Doxygen to be a paragraph of text +* seperate by either a structural command or a blank line +*/ + +list::iterator getEndOfParagraph(TokenList &tokList){ + list::iterator endOfParagraph = tokList.iteratorCopy(); + while(endOfParagraph != tokList.end()){ + if ((* endOfParagraph).tokenType == COMMAND){ + if(isSectionIndicator((* endOfParagraph).tokenString)) return endOfParagraph; + else endOfParagraph++; + } + else if((* endOfParagraph).tokenType == PLAINSTRING) { + endOfParagraph++; + } + else if ((* endOfParagraph).tokenType == END_LINE){ + endOfParagraph++; + if ((* endOfParagraph).tokenType == END_LINE){ + endOfParagraph++; + return endOfParagraph; + } + } + + } + + return tokList.end(); + +} + +/* Returns the end of a section, defined as the first blank line OR first encounter of the same +* command. Example of this behaviour is \arg +*/ + +list::iterator getEndOfSection(string theCommand, TokenList &tokList){ + list::iterator endOfParagraph = tokList.iteratorCopy(); + while(endOfParagraph != tokList.end()){ + if ((* endOfParagraph).tokenType == COMMAND){ + if(theCommand.compare((*endOfParagraph).tokenString) == 0) return endOfParagraph; + else endOfParagraph++; + } + else if((* endOfParagraph).tokenType == PLAINSTRING) { + endOfParagraph++; + } + else if ((* endOfParagraph).tokenType == END_LINE){ + endOfParagraph++; + if ((* endOfParagraph).tokenType == END_LINE){ + endOfParagraph++; + return endOfParagraph; + } + } + + } +} +/* This method is for returning the end of 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", tokenList); + */ +list::iterator getEndCommand(string theCommand, TokenList &tokList){ + list::iterator endOfCommand = tokList.iteratorCopy(); + while (endOfCommand!= tokList.end()){ + if ((*endOfCommand).tokenType == COMMAND){ + if (theCommand.compare((* endOfCommand).tokenString) == 0){ + return endOfCommand; + } + endOfCommand++; + } + } + //End command not found + return tokList.end(); +} + +/* A specialty method for commands such as \arg that end at the end of a paragraph OR when another \arg is encountered + */ + +list::iterator getTilAnyCommand(string theCommand, TokenList &tokList){ + list::iterator anIterator; + return anIterator; +} + + + + +/* Method for Adding a Simple Command + * Format: @command + * Plain commands, such as newline etc, they contain no other data + * \n \\ \@ \& \$ \# \< \> \% + */ + int addSimpleCommand(string theCommand, list &doxyList){ + + if (noisy) cout << "Parsing " << theCommand << endl; + doxyList.push_back(DoxygenEntity(theCommand)); + return 1; +} + + /* NOT INCLUDED Simple Commands + * Format: @command + * Plain commands, such as newline etc, they contain no other data + */ + int ignoreSimpleCommand(string theCommand, list &doxyList){ + + if (noisy) cout << "Not Adding " << theCommand << endl; + return 1; +} + + /* CommandWord + * Format: @command + * Commands with a single WORD after then such as @b + * "a", "b", "c", "e", "em", "p", "def", "enum", "example", "package", + * "relates", "namespace", "relatesalso","anchor", "dontinclude", "include", "includelineno" + */ + int addCommandWord(string theCommand, TokenList &tokList, list &doxyList){ + if (noisy) cout << "Parsing " << theCommand << endl; + string name = getNextWord(tokList); + if (!name.empty()){ + doxyList.push_back(DoxygenEntity(theCommand, name)); + return 1; + } + else cout << "No word followed " << theCommand << " command. Not added" << endl; + return 0; +} + /* NOT INCLUDED CommandWord + * Format: @command + * Commands with a single WORD after then such as @b + * "copydoc", "copybrief", "copydetails", "verbinclude", "htmlinclude" + */ + int ignoreCommandWord(string theCommand, TokenList &tokList, list &doxyList){ + if (noisy) cout << "Not Adding " << theCommand << endl; + string name = getNextWord(tokList); + if (!name.empty()){ + return 1; + } + else cout << "WARNING: No word followed " << theCommand << " command." << endl; + return 0; +} + + /* CommandLine + * Format: @command (line) + * Commands with a single LINE after then such as @var + * "addindex", "fn", "name", "line", "var", "skipline", "typedef", "skip", "until", "property" + */ + int addCommandLine(string theCommand, TokenList &tokList, list &doxyList){ + if (noisy) cout << "Parsing " << theCommand << endl; + list::iterator endOfLine = getOneLine(tokList); + list aNewList; + aNewList = parse(endOfLine, tokList); + doxyList.push_back( DoxygenEntity(theCommand, aNewList)); + return 1; + +} + + /* NOT INCLUDED CommandLine + * Format: @command (line) + * Commands with a single LINE after then such as @var + * + */ + int ignoreCommandLine(string theCommand, TokenList &tokList, list &doxyList){ + if (noisy) cout << "Not Adding " << theCommand << endl; + list::iterator endOfLine = getOneLine(tokList); + tokList.setIterator(endOfLine); + return 1; +} + + /* CommandParagraph + * Format: @command {paragraph} + * Commands with a single paragraph after then such as @return + * "return", "remarks", "since", "test", "sa", "see", "pre", "post", "details", "invariant", + * "deprecated", "date", "note", "warning", "version", "todo", "bug", "attention", "brief", "arg", "author" + */ + int addCommandParagraph(string theCommand, TokenList &tokList, list &doxyList){ + if (noisy) cout << "Parsing " << theCommand << endl; + list::iterator endOfParagraph = getEndOfParagraph(tokList); + //if(!restOfParagraph.empty()){ + list aNewList; + aNewList = parse(endOfParagraph, tokList); + doxyList.push_back( DoxygenEntity(theCommand, aNewList)); + return 1; + // } + //else cout << "No line followed " << theCommand << " command. Not added" << endl; +} + /* CommandParagraph + * Format: @command {paragraph} + * Commands with a single LINE after then such as @var + * + */ + int ignoreCommandParagraph(string theCommand, TokenList &tokList, list &doxyList){ + if (noisy) cout << "Not Adding " << theCommand << endl; + list::iterator endOfParagraph = getEndOfParagraph(tokList); + tokList.setIterator(endOfParagraph); + //else cout << "WARNING: No line followed " << theCommand << " command." << endl; + return 1; +} + /* Command EndCommand + * Format: @command and ends at @endcommand + * Commands that take in a block of text such as @code + * "code", "dot", "msc", "f$", "f[", "f{environment}{", "htmlonly", "latexonly", "manonly", + * "verbatim", "xmlonly", "cond", "if", "ifnot", "link" + * Returns 1 if success, 0 if the endcommand is never encountered. + */ + + int addCommandEndCommand(string theCommand, TokenList &tokList, list &doxyList){ + if (noisy) cout << "Not Adding " << theCommand << endl; + string description = getStringTilEndCommand( "end" + theCommand, tokList); + doxyList.push_back(DoxygenEntity(theCommand, description)); + return 1; + } + + /* CommandWordParagraph + * Format: @command {paragraph} + * Commands such as param + * "param", "tparam", "throw", "retval", "exception" + */ + int addCommandWordParagraph(string theCommand, TokenList &tokList, list &doxyList){ + if (noisy) cout << "Parsing " << theCommand << endl; + string name = getNextWord(tokList); + if (name.empty()){ + cout << "No word followed " << theCommand << " command. Not added" << endl; + return 0; + } + list::iterator endOfParagraph = getEndOfParagraph(tokList); + //if(!restOfParagraph.empty()){ + list aNewList; + aNewList = parse(endOfParagraph, tokList); + aNewList.push_front(DoxygenEntity("plainstring", name)); + doxyList.push_back(DoxygenEntity(theCommand, aNewList)); + return 0; + } + /* CommandWordLine + * Format: @command (line) + * Commands such as param + * "page", "subsection", "subsubsection", "section", "paragraph", "defgroup" + */ + int addCommandWordLine(string theCommand, TokenList &tokList, list &doxyList){ + if (noisy) cout << "Parsing " << theCommand << endl; + string name = getNextWord(tokList); + if (name.empty()){ + cout << "No word followed " << theCommand << " command. Not added" << endl; + return 0; + } + list::iterator endOfLine = getOneLine(tokList); + list aNewList; + aNewList = parse(endOfLine, tokList); + aNewList.push_front(DoxygenEntity("plainstring", name)); + doxyList.push_back(DoxygenEntity(theCommand, aNewList)); + return 1; + + //else cout << "No line followed " << theCommand << " command. Not added" << endl; + } + + /* Command Word Optional Word Optional Word + * Format: @command [] [] + * Commands such as class + * "category", "class", "protocol", "interface", "struct", "union" + */ + int addCommandWordOWordOWord(string theCommand, TokenList &tokList, list &doxyList){ + if (noisy) cout << "Parsing " << theCommand << endl; + string name = getNextWord(tokList); + if (name.empty()){ + cout << "No word followed " << theCommand << " command. Not added" << endl; + return 0; + } + string headerfile = getNextWord(tokList); + string headername = getNextWord(tokList); + list aNewList; + aNewList.push_back(DoxygenEntity("plainstring", name)); + if (!headerfile.empty()) aNewList.push_back(DoxygenEntity("plainstring", headerfile)); + if (!headername.empty()) aNewList.push_back(DoxygenEntity("plainstring", headername)); + doxyList.push_back(DoxygenEntity(theCommand, aNewList)); + return 1; + } + + /* Command Optional Word + * Format: @command [] + * Commands such as dir + * "dir", "file", "cond" + */ + int addCommandOWord(string theCommand, TokenList &tokList, list &doxyList){ + if (noisy) cout << "Parsing " << theCommand << endl; + string name = getNextWord(tokList); + doxyList.push_back(DoxygenEntity(theCommand, name)); + return 1; + } + + /* Commands that should not be encountered (such as PHP only) + */ + int addCommandErrorThrow(string theCommand, TokenList &tokList, list &doxyList){ + cout << "Encountered :" << theCommand << endl; + cout << "This command should not have been encountered. Behaviour past this may be unpredictable " << endl; + } + + + int addCommandUnique(string theCommand, TokenList &tokList, list &doxyList){ + list aNewList; + if (theCommand.compare("arg") == 0 || theCommand.compare("li") == 0){ + list::iterator endOfSection = getEndOfSection(theCommand, tokList); + list aNewList; + aNewList = parse(endOfSection, tokList); + doxyList.push_back( DoxygenEntity(theCommand, aNewList)); + } + + // \xrefitem "(heading)" "(list title)" {text} + else if (theCommand.compare("xrefitem") == 0){ + //TODO Implement xrefitem + if (noisy) cout << "Not Adding " << theCommand << endl; + list::iterator endOfParagraph = getEndOfParagraph(tokList); + tokList.setIterator(endOfParagraph); + return 1; + } + // \ingroup ( [ ]) + else if (theCommand.compare("ingroup") == 0){ + string name = getNextWord(tokList); + aNewList.push_back(DoxygenEntity("plainstring", name)); + name = getNextWord(tokList); + if(!name.empty()) aNewList.push_back(DoxygenEntity("plainstring", name)); + name = getNextWord(tokList); + if(!name.empty()) aNewList.push_back(DoxygenEntity("plainstring", name)); + doxyList.push_back(DoxygenEntity(theCommand, aNewList)); + return 1; + } + // \par [(paragraph title)] { paragraph } + else if (theCommand.compare("par") == 0){ + list::iterator endOfLine = getOneLine(tokList); + aNewList = parse(endOfLine, tokList); + list aNewList2; + aNewList2 = parse(endOfLine, tokList); + aNewList.splice(aNewList.end(), aNewList2); + doxyList.push_back(DoxygenEntity(theCommand, aNewList)); + return 1; + } + // \headerfile [] + else if (theCommand.compare("headerfile") == 0){ + list aNewList; + string name = getNextWord(tokList); + aNewList.push_back(DoxygenEntity("plainstring", name)); + name = getNextWord(tokList); + if(!name.empty()) aNewList.push_back(DoxygenEntity("plainstring", name)); + doxyList.push_back(DoxygenEntity(theCommand, aNewList)); + return 1; + } + // \overload [(function declaration)] + else if (theCommand.compare("overload") == 0){ + list::iterator endOfLine = getOneLine(tokList); + if (endOfLine != tokList.current()){ + list aNewList; + aNewList = parse(endOfLine, tokList); + doxyList.push_back(DoxygenEntity(theCommand, aNewList)); + } + else doxyList.push_back(DoxygenEntity(theCommand)); + } + // \weakgroup [(title)] + else if (theCommand.compare("weakgroup") == 0){ + if (noisy) cout << "Parsing " << theCommand << endl; + string name = getNextWord(tokList); + if (name.empty()){ + cout << "No word followed " << theCommand << " command. Not added" << endl; + return 0; + } + list aNewList; + list::iterator endOfLine = getOneLine(tokList); + if (endOfLine != tokList.current()) { + aNewList = parse(endOfLine, tokList); + } + aNewList.push_front(DoxygenEntity("plainstring", name)); + doxyList.push_back(DoxygenEntity(theCommand, aNewList)); + } + // \ref ["(text)"] + else if (theCommand.compare("ref") == 0){ + //TODO Implement ref + if (noisy) cout << "Not Adding " << theCommand << endl; + list::iterator endOfParagraph = getEndOfParagraph(tokList); + tokList.setIterator(endOfParagraph); + } + // \subpage ["(text)"] + else if (theCommand.compare("subpage") == 0){ + //TODO implement subpage + if (noisy) cout << "Not Adding " << theCommand << endl; + list::iterator endOfParagraph = getEndOfParagraph(tokList); + tokList.setIterator(endOfParagraph); + } + // \dotfile ["caption"] + else if (theCommand.compare("dotfile") == 0){ + //TODO implement dotfile + if (noisy) cout << "Not Adding " << theCommand << endl; + list::iterator endOfParagraph = getEndOfParagraph(tokList); + tokList.setIterator(endOfParagraph); + } + // \image ["caption"] [=] + else if (theCommand.compare("image") == 0){ + //todo implement image + } + // \addtogroup [(title)] + else if (theCommand.compare("addtogroup") == 0){ + if (noisy) cout << "Parsing " << theCommand << endl; + string name = getNextWord(tokList); + if (name.empty()){ + cout << "No word followed " << theCommand << " command. Not added" << endl; + return 0; + } + list aNewList; + list::iterator endOfLine = getOneLine(tokList); + if (endOfLine != tokList.current()) { + aNewList = parse(endOfLine, tokList); + } + aNewList.push_front(DoxygenEntity("plainstring", name)); + doxyList.push_back(DoxygenEntity(theCommand, aNewList)); + } + + } + +/* 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(string commandString, TokenList &tokList,list &doxyList){ + string theCommand = StringToLower(commandString); + + if (theCommand.compare("plainstring") == 0){ + string nextPhrase = getStringTilCommand( tokList); + if (noisy) cout << "Parsing plain string :" << nextPhrase << endl; + doxyList.push_back(DoxygenEntity("plainstring", nextPhrase )); + return 1; + } + int commandNumber = commandBelongs(theCommand); + if (commandNumber == SIMPLECOMMAND){ + return addSimpleCommand(theCommand, doxyList); + } + if (commandNumber == IGNOREDSIMPLECOMMAND){ + return ignoreSimpleCommand(theCommand, doxyList); + } + if (commandNumber == COMMANDWORD){ + return addCommandWord(theCommand, tokList, doxyList); + } + if (commandNumber == IGNOREDCOMMANDWORD){ + return ignoreCommandWord(theCommand, tokList, doxyList); + } + if (commandNumber == COMMANDLINE ){ + return addCommandLine(theCommand, tokList, doxyList); + } + if (commandNumber == IGNOREDCOMMANDLINE ){ + return ignoreCommandLine(theCommand, tokList, doxyList); + } + if (commandNumber == COMMANDPARAGRAPH){ + return addCommandParagraph(theCommand, tokList, doxyList); + } + if (commandNumber == IGNORECOMMANDPARAGRAPH){ + return ignoreCommandParagraph(theCommand, tokList, doxyList); + } + if (commandNumber == COMMANDENDCOMMAND){ + return addCommandEndCommand(theCommand, tokList, doxyList); + } + if (commandNumber == COMMANDWORDPARAGRAPH){ + return addCommandWordParagraph(theCommand, tokList, doxyList); + } + if (commandNumber == COMMANDWORDLINE){ + return addCommandWordLine(theCommand, tokList, doxyList); + } + if (commandNumber == COMMANDWORDOWORDWORD){ + return addCommandWordOWordOWord(theCommand, tokList, doxyList); + } + if (commandNumber == COMMANDOWORD){ + return addCommandOWord(theCommand, tokList, doxyList); + } + if (commandNumber == COMMANDERRORTHROW){ + return addCommandErrorThrow(theCommand, tokList, doxyList); + } + if (commandNumber == COMMANDUNIQUE){ + return addCommandUnique(theCommand, tokList, doxyList); + } + + return 0; +} + +list parse(list::iterator endParsingIndex, TokenList &tokList){ + list aNewList; + int currCommand; + while (tokList.current() != endParsingIndex){ + Token currToken = tokList.peek(); + if(noisy) cout << "Parsing for phrase starting in:" << currToken.toString() << endl; + if(currToken.tokenType == END_LINE ){ + tokList.next(); + } + else if(currToken.tokenType == COMMAND){ + currCommand = findCommand(currToken.tokenString); + tokList.next(); + if (currCommand < 0 ){ if(noisy) cout << "BAD COMMAND: " << currToken.tokenString << endl;} + //cout << "Command: " << currWord << " " << currCommand << endl; + + else addCommand(currToken.tokenString, tokList, aNewList); + } + else if (currToken.tokenType == PLAINSTRING){ + addCommand(string("plainstring"), tokList, aNewList); + } + + + } + + return aNewList; +} + +list DoxygenParser::createTree(string doxygenBlob){ + TokenList tokList = TokenList(doxygenBlob); + if(noisy) { + cout << "---TOKEN LIST---" << endl; + tokList.printList(); + } + list rootList; + rootList = parse( tokList.end(), tokList); + if(noisy) { + cout << "PARSED LIST" << endl; + printTree(rootList); + } + return rootList; +} diff --git a/Source/DoxygenTranslator/src/DoxygenParser.h b/Source/DoxygenTranslator/src/DoxygenParser.h new file mode 100644 index 000000000..776fcf123 --- /dev/null +++ b/Source/DoxygenTranslator/src/DoxygenParser.h @@ -0,0 +1,19 @@ +#ifndef DOXYGENPARSER_H_ +#define DOXYGENPARSER_H_ +#include +#include +#include +#include +#include +#include "DoxygenEntity.h" +#include "TokenList.h" +#include "JavaDocConverter.h" +class DoxygenParser +{ +public: + DoxygenParser(); + virtual ~DoxygenParser(); + list createTree(string doxygen); +}; + +#endif /*DOXYGENPARSER_H_*/ diff --git a/Source/DoxygenTranslator/src/DoxygenTranslator.cpp b/Source/DoxygenTranslator/src/DoxygenTranslator.cpp new file mode 100644 index 000000000..191057ae7 --- /dev/null +++ b/Source/DoxygenTranslator/src/DoxygenTranslator.cpp @@ -0,0 +1,41 @@ + + +#include "DoxygenParser.h" +#include "DoxygenTranslator.h" +#include +#include +#include +#include +#include +#include "DoxygenEntity.h" +#include "TokenList.h" +#include "JavaDocConverter.h" + +DoxygenParser doxyParse; +JavaDocConverter jDC; + +DoxygenTranslator::DoxygenTranslator(){ + doxyParse = DoxygenParser(); + JavaDocConverter jDC = JavaDocConverter(); +} + +DoxygenTranslator::~DoxygenTranslator(){ + +} + + +char *DoxygenTranslator::convert(char* doxygenBlob, char* option){ + + list rootList = doxyParse.createTree(string(doxygenBlob)); + rootList = doxyParse.createTree(string(doxygenBlob)); + string returnedString; + if(strcmp(option, "JAVADOC") == 0){ + returnedString = jDC.convertToJavaDoc(rootList); + } + else cout << "Option not current supported.\n"; + char *nonConstString; + nonConstString = (char *)malloc(returnedString.length() + 1); + strcpy(nonConstString, returnedString.c_str()); + return nonConstString; +} + diff --git a/Source/DoxygenTranslator/src/DoxygenTranslator.h b/Source/DoxygenTranslator/src/DoxygenTranslator.h new file mode 100644 index 000000000..e5fe7bcbb --- /dev/null +++ b/Source/DoxygenTranslator/src/DoxygenTranslator.h @@ -0,0 +1,10 @@ +#ifndef DOXYGENTRANSLATOR_H_ +#define DOXYGENTRANSLATOR_H_ +class DoxygenTranslator +{ +public: + DoxygenTranslator(); + virtual ~DoxygenTranslator(); + char* convert(char* doxygenBlob, char* option); +}; +#endif /*DOXYGENTRANSLATOR_H_*/ diff --git a/Source/DoxygenTranslator/src/Examples/DoxygenTransWTokenizer.cpp b/Source/DoxygenTranslator/src/Examples/DoxygenTransWTokenizer.cpp new file mode 100644 index 000000000..299f59216 --- /dev/null +++ b/Source/DoxygenTranslator/src/Examples/DoxygenTransWTokenizer.cpp @@ -0,0 +1,924 @@ +/* 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" +#include "TokenList.h" +#define SIMPLECOMMAND 1 +#define IGNOREDSIMPLECOMMAND 2 +#define COMMANDWORD 3 +#define IGNOREDCOMMANDWORD 4 +#define COMMANDLINE 5 +#define IGNOREDCOMMANDLINE 6 +#define COMMANDPARAGRAPH 7 +#define IGNORECOMMANDPARAGRAPH 8 +#define COMMANDENDCOMMAND 9 +#define COMMANDWORDPARAGRAPH 10 +#define COMMANDWORDLINE 11 +#define COMMANDWORDOWORDWORD 12 +#define COMMANDOWORD 13 +#define COMMANDERRORTHROW 14 +#define COMMANDUNIQUE 15 +using namespace std; + + +////////////////////////////////////////// +/*Set these to pick what internal functions +to test. */ + +//int testCommandParsingFunctions = 1;// not implemented + +int testCodeCrawlingFunctions = 0; +int demonstrateParsing = 0; +int runExamples = 0; +int noisy = 0; // set this to 1 for extra chatter from the parsing stage. +int addCommand(string commandName, int &startInd, list &doxyList, string doxygenString); +////////////////////////////////////////// + + + +/* 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 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" }; + +/* All of the doxygen commands divided up by how they are parsed */ +string simpleCommands[] = {"n", "$", "@", "//", "&", "~", "<", ">", "#", "%"}; +string ignoredSimpleCommands[] = {"nothing at the moment"}; +string commandWords[] = {"a", "b", "c", "e", "em", "p", "def", "enum", "example", "package", + "relates", "namespace", "relatesalso","anchor", "dontinclude", "include", "includelineno"}; +string ignoredCommandWords[] = {"copydoc", "copybrief", "copydetails", "verbinclude", "htmlinclude"}; +string commandLines[] = {"addindex", "fn", "name", "line", "var", "skipline", "typedef", "skip", "until", "property"}; +string ignoreCommandLines[] = {"nothing at the moment"}; +string commandParagraph[] = {"return", "remarks", "since", "test", "sa", "see", "pre", "post", "details", "invariant", + "deprecated", "date", "note", "warning", "version", "todo", "bug", "attention", "brief", "arg", "author"}; +string ignoreCommandParagraphs[] = {"nothing at the moment"}; +string commandEndCommands[] = {"code", "dot", "msc", "f$", "f[", "f{environment}{", "htmlonly", "latexonly", "manonly", + "verbatim", "xmlonly", "cond", "if", "ifnot", "link"}; +string commandWordParagraphs[] = {"param", "tparam", "throw", "retval", "exception"}; +string commandWordLines[] = {"page", "subsection", "subsubsection", "section", "paragraph", "defgroup"}; +string commandWordOWordOWords [] = {"category", "class", "protocol", "interface", "struct", "union"}; +string commandOWords[] = {"dir", "file", "cond"}; +string commandErrorThrowings[] = {"annotatedclasslist", "classhierarchy", "define", "functionindex", "header", + "headerfilelist", "inherit", "l", "postheader", "private", "privatesection", "protected", + "protectedsection", "public", "publicsection", "endcode", "enddot", "endmsc", "endhtmlonly", + "endlatexonly", "endmanonly", "endlink", "endverbatim", "endxmlonly", "f]", "f}", "endcond", + "endif"}; +string commandUniques[] = {"xrefitem", "ingroup", "par", "headerfile", "overload", "weakgroup", "ref", + "subpage", "dotfile", "image", "addtogroup", "li"}; + + //int startIndex = 0; + int isNewLine = 0; + 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){ + if(endIndex >= doxygenString.length()){ + finalIndex = endIndex; + keepLooping = 0; + } + else 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] == '!' || doxygenString[startIndex] == '\t') ){ + if(doxygenString[counter] == '\n') { + //cout << "Blank line found" << endl; + keepLooping = 0; + finalIndex = counter;} + else{ counter++;} + } + + } + //endIndex = counter; + } + else if (doxygenString[endIndex] == '\\' || doxygenString[endIndex] == '@'){ + finalIndex = endIndex; + keepLooping = 0; + } + else if(endIndex < doxygenString.length() -2 + && string("**/").compare(doxygenString.substr(endIndex , endIndex + 2)) == 0){ + finalIndex = endIndex; + //cout << "3 "; + keepLooping = 0; + } + if(keepLooping){ + //cout << "4 "; + endIndex++; + } + } + //cout << "Done with EndIndex" << endl; + while(doxygenString[startIndex] == '!' || doxygenString[startIndex] == ' ' + || doxygenString[startIndex] == '/' || doxygenString[startIndex] == '*' || doxygenString[startIndex] == '\t') startIndex++; + + for (int i = startIndex; i < endIndex; i++){ + + if (doxygenString[i] == '\n') { + + while ((doxygenString[i] == '\n' || doxygenString[startIndex] == '\t'|| doxygenString[i] == ' ' + || doxygenString[i] == '*' || doxygenString[i] == '/')&& endIndex < doxygenString.length() - 1){ + i++; + } + description.append(" "); + } + description.push_back(doxygenString[i]); + //cout << doxygenString[i]; + } + //if(noisy) cout << "Final Index is: " << finalIndex << endl; + startInd = finalIndex; + return description; + } + + +/* Returns a Paragraph- defined in Doxygen to be a paragraph of text + * seperate by either a structural command or a blank line + * This method is VERY messy currently + */ + //TODO fix getStringTilEndOfParagraph to be more forgiving, work on ' ' characters + string getStringTilEndOfParagraph(int &startInd, string doxygenString){ + if (startInd >= 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){ + if(endIndex >= doxygenString.length()){ + finalIndex = endIndex; + keepLooping = 0; + } + else 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[startIndex] == '\t' || doxygenString[counter] == '\n'|| doxygenString[counter] == '/' + || doxygenString[counter] == '!') ){ + if(doxygenString[counter] == '\n') { + //cout << "Blank line found" << endl; + keepLooping = 0; + finalIndex = counter;} + else{ counter++;} + } + + } + //endIndex = counter; + } + //todo this fix for not immediately exciting while parsing a paragraph seems somewhat cheap + else if (endIndex != startInd && doxygenString[endIndex] == '\\' || doxygenString[endIndex] == '@'){ + spareIndex = endIndex +1; + + if (isSectionIndicator(getNextWord(spareIndex, doxygenString))) { + keepLooping = 0; + finalIndex = endIndex;} + } + else if(endIndex < doxygenString.length() - 1 + && string("*/").compare(doxygenString.substr(endIndex , endIndex + 1)) == 0){ + keepLooping = 0; + finalIndex = endIndex; + } + if(keepLooping){ + endIndex++; + } + } + //cout << "Done with EndIndex" << endl; + while(doxygenString[startIndex] == '!' || doxygenString[startIndex] == ' ' || doxygenString[startIndex] == '\t' + || doxygenString[startIndex] == '/' || doxygenString[startIndex] == '*') startIndex++; + + for (int i = startIndex; i < endIndex; i++){ + + if (doxygenString[i] == '\n') { + + while ((doxygenString[i] == '\n' || doxygenString[startIndex] == '\t' || doxygenString[i] == ' ' ||doxygenString[startIndex] == '!' + || 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, string doxygenString){ + int endIndex = startInd; + while (endIndex < doxygenString.length()){ + if (doxygenString[endIndex] == '\\' || 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; + } + + /* A specialty method for commands such as \arg that end at the end of a paragraph OR when another \arg is encountered + */ + + string getStringTilAnyCommand(string theCommand, int &startInd, string doxygenString){ + if (startInd >= 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){ + if(endIndex >= theCommand.length()){ + finalIndex = endIndex; + keepLooping = 0; + } + else 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] == '!' || doxygenString[startIndex] == '\t') ){ + if(doxygenString[counter] == '\n') { + //cout << "Blank line found" << endl; + keepLooping = 0; + finalIndex = counter;} + else{ counter++;} + } + + } + //endIndex = counter; + } + else if (doxygenString[endIndex] == '\\' || doxygenString[endIndex] == '@'){ + //cout << "2 "; + spareIndex = endIndex; + if (endIndex + theCommand.length() < theCommand.length() + && theCommand.compare(doxygenString.substr(endIndex, theCommand.length())) == 0) 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] == '*' || doxygenString[startIndex] == '\t') startIndex++; + + for (int i = startIndex; i < endIndex; i++){ + + if (doxygenString[i] == '\n') { + + while ((doxygenString[i] == '\n' || doxygenString[i] == ' ' || doxygenString[startIndex] == '\t' + || doxygenString[i] == '*' || doxygenString[i] == '/')&& endIndex < doxygenString.length() - 1){ + i++; + } + description.append(" "); + } + description.push_back(doxygenString[i]); + //cout << doxygenString[i]; + } + startInd = finalIndex; + return description; + } + + + /* prints the parse tree + * + */ + void printTree(){ + + list::iterator p = rootList.begin(); + while (p != rootList.end()){ + (*p).printEntity(0); + p++; + } + + } + + + + list parse(int startInd, string doxygenString){ + string currWord; + int startIndex = startInd; + int savedIndex; + list aNewList; + int endIndex = doxygenString.length(); + int currCommand; + while (startIndex < endIndex){ + savedIndex = startIndex; + currWord = getNextWord(startIndex, doxygenString); + if(noisy) cout << "Parsing for phrase starting in:" << currWord << endl; + if(currWord == ""){ + if (startIndex < endIndex) startIndex++; + } + else if(currWord[0] == '\\' || currWord[0] == '@'){ + currWord = currWord.substr(1, currWord.length() - 1); + currCommand = findCommand(currWord); + if (currCommand < 0 ){ if(noisy) cout << "BAD COMMAND: " << currWord << endl;} + //cout << "Command: " << currWord << " " << currCommand << endl; + else addCommand(currWord, startIndex, aNewList, doxygenString); + } + else{ + startIndex = savedIndex; + addCommand(string("plainstring"), startIndex, aNewList, doxygenString); + + } + } + + return aNewList; + } + + /* Method for Adding a Simple Command + * Format: @command + * Plain commands, such as newline etc, they contain no other data + * \n \\ \@ \& \$ \# \< \> \% + */ + int addSimpleCommand(string theCommand, int &startInd, list &doxyList, string doxygenString){ + + if (noisy) cout << "Parsing " << theCommand << endl; + doxyList.push_back(DoxygenEntity(theCommand)); + return 1; + } + + /* NOT INCLUDED Simple Commands + * Format: @command + * Plain commands, such as newline etc, they contain no other data + */ + int ignoreSimpleCommand(string theCommand, int &startInd, list &doxyList, string doxygenString){ + + if (noisy) cout << "Not Adding " << theCommand << endl; + return 1; + } + + /* CommandWord + * Format: @command + * Commands with a single WORD after then such as @b + * "a", "b", "c", "e", "em", "p", "def", "enum", "example", "package", + * "relates", "namespace", "relatesalso","anchor", "dontinclude", "include", "includelineno" + */ + int addCommandWord(string theCommand, int &startInd, list &doxyList, string doxygenString){ + if (noisy) cout << "Parsing " << theCommand << endl; + string name = getNextWord(startInd, doxygenString); + if (!name.empty()){ + doxyList.push_back(DoxygenEntity(theCommand, name)); + return 1; + } + else cout << "No word followed " << theCommand << " command. Not added" << endl; + return 0; + } + /* NOT INCLUDED CommandWord + * Format: @command + * Commands with a single WORD after then such as @b + * "copydoc", "copybrief", "copydetails", "verbinclude", "htmlinclude" + */ + int ignoreCommandWord(string theCommand, int &startInd, list &doxyList, string doxygenString){ + if (noisy) cout << "Not Adding " << theCommand << endl; + string name = getNextWord(startInd, doxygenString); + if (!name.empty()){ + return 1; + } + else cout << "WARNING: No word followed " << theCommand << " command." << endl; + return 0; + } + + /* CommandLine + * Format: @command (line) + * Commands with a single LINE after then such as @var + * "addindex", "fn", "name", "line", "var", "skipline", "typedef", "skip", "until", "property" + */ + int addCommandLine(string theCommand, int &startInd, list &doxyList, string doxygenString){ + if (noisy) cout << "Parsing " << theCommand << endl; + string line = getOneLine(startInd, doxygenString); + if(!line.empty()){ + int placement = 0; + list aNewList; + aNewList = parse(placement, line); + doxyList.push_back( DoxygenEntity(theCommand, aNewList)); + return 1; + } + else cout << "No line followed " << theCommand << " command. Not added" << endl; + return 0; + } + + /* NOT INCLUDED CommandLine + * Format: @command (line) + * Commands with a single LINE after then such as @var + * + */ + int ignoreCommandLine(string theCommand, int &startInd, list &doxyList, string doxygenString){ + if (noisy) cout << "Not Adding " << theCommand << endl; + string line = getOneLine(startInd, doxygenString); + if(!line.empty()){ + return 1; + } + else cout << "WARNING: No line followed " << theCommand << " command." << endl; + return 0; + } + + /* CommandParagraph + * Format: @command {paragraph} + * Commands with a single paragraph after then such as @return + * "return", "remarks", "since", "test", "sa", "see", "pre", "post", "details", "invariant", + * "deprecated", "date", "note", "warning", "version", "todo", "bug", "attention", "brief", "arg", "author" + */ + int addCommandParagraph(string theCommand, int &startInd, list &doxyList, string doxygenString){ + if (noisy) cout << "Parsing " << theCommand << endl; + string restOfParagraph = getStringTilEndOfParagraph(startInd, doxygenString); + if(!restOfParagraph.empty()){ + int placement = 0; + list aNewList; + aNewList = parse(placement, restOfParagraph); + doxyList.push_back( DoxygenEntity(theCommand, aNewList)); + return 1; + } + else cout << "No line followed " << theCommand << " command. Not added" << endl; + return 0; + } + /* CommandParagraph + * Format: @command {paragraph} + * Commands with a single LINE after then such as @var + * + */ + int ignoreCommandParagraph(string theCommand, int &startInd, list &doxyList, string doxygenString){ + if (noisy) cout << "Not Adding " << theCommand << endl; + string restOfParagraph = getStringTilEndOfParagraph(startInd, doxygenString); + if(!restOfParagraph.empty()){ + return 1; + } + else cout << "WARNING: No line followed " << theCommand << " command." << endl; + return 0; + } + /* Command EndCommand + * Format: @command and ends at @endcommand + * Commands that take in a block of text such as @code + * "code", "dot", "msc", "f$", "f[", "f{environment}{", "htmlonly", "latexonly", "manonly", + * "verbatim", "xmlonly", "cond", "if", "ifnot", "link" + * Returns 1 if success, 0 if the endcommand is never encountered. + */ + + int ignoreCommandEndCommand(string theCommand, int &startInd, list &doxyList, string doxygenString){ + if (noisy) cout << "Not Adding " << theCommand << endl; + return progressTilEndCommand( "end" + theCommand, startInd, doxygenString); + + } + + /* CommandWordParagraph + * Format: @command {paragraph} + * Commands such as param + * "param", "tparam", "throw", "retval", "exception" + */ + int addCommandWordParagraph(string theCommand, int &startInd, list &doxyList, string doxygenString){ + if (noisy) cout << "Parsing " << theCommand << endl; + string name = getNextWord(startInd, doxygenString); + if (name.empty()){ + cout << "No word followed " << theCommand << " command. Not added" << endl; + return 0; + } + string restOfParagraph = getStringTilEndOfParagraph(startInd, doxygenString); + int placement = 0; + if(!restOfParagraph.empty()){ + list aNewList; + aNewList = parse(placement, restOfParagraph); + aNewList.push_front(DoxygenEntity("plainstring", name)); + doxyList.push_back(DoxygenEntity(theCommand, aNewList)); + return 1; + } + else cout << "No paragraph followed " << theCommand << " command. Not added" << endl; + return 0; + } + /* CommandWordLine + * Format: @command (line) + * Commands such as param + * "page", "subsection", "subsubsection", "section", "paragraph", "defgroup" + */ + int addCommandWordLine(string theCommand, int &startInd, list &doxyList, string doxygenString){ + if (noisy) cout << "Parsing " << theCommand << endl; + string name = getNextWord(startInd, doxygenString); + if (name.empty()){ + cout << "No word followed " << theCommand << " command. Not added" << endl; + return 0; + } + string restOfLine = getStringTilEndOfParagraph(startInd, doxygenString); + int placement = 0; + if(!restOfLine.empty()){ + list aNewList; + aNewList = parse(placement, restOfLine); + aNewList.push_front(DoxygenEntity("plainstring", name)); + doxyList.push_back(DoxygenEntity(theCommand, aNewList)); + return 1; + } + else cout << "No line followed " << theCommand << " command. Not added" << endl; + return 0; + } + + /* Command Word Optional Word Optional Word + * Format: @command [] [] + * Commands such as class + * "category", "class", "protocol", "interface", "struct", "union" + */ + int addCommandWordOWordOWord(string theCommand, int &startInd, list &doxyList, string doxygenString){ + if (noisy) cout << "Parsing " << theCommand << endl; + string name = getNextWord(startInd, doxygenString); + if (name.empty()){ + cout << "No word followed " << theCommand << " command. Not added" << endl; + return 0; + } + string headerfile = getNextWord(startInd, doxygenString); + string headername = getNextWord(startInd, doxygenString); + list aNewList; + aNewList.push_back(DoxygenEntity("plainstring", name)); + if (!headerfile.empty()) aNewList.push_back(DoxygenEntity("plainstring", headerfile)); + if (!headername.empty()) aNewList.push_back(DoxygenEntity("plainstring", headername)); + doxyList.push_back(DoxygenEntity(theCommand, aNewList)); + return 1; + } + + /* Command Optional Word + * Format: @command [] + * Commands such as dir + * "dir", "file", "cond" + */ + int addCommandOWord(string theCommand, int &startInd, list &doxyList, string doxygenString){ + if (noisy) cout << "Parsing " << theCommand << endl; + string name = getNextWord(startInd, doxygenString); + doxyList.push_back(DoxygenEntity(theCommand, name)); + return 1; + } + + /* 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(string commandString, int &startInd, list &doxyList, string doxygenString){ + string theCommand = StringToLower(commandString); + string voidArray[] = {""}; + /* @command */ + + + if (theCommand.compare("plainstring") == 0){ + string nextPhrase = getStringTilCommand(startInd, doxygenString); + if (noisy) cout << "Parsing plain string :" << nextPhrase << endl; + doxyList.push_back(DoxygenEntity("plainstring", nextPhrase )); + return 1; + } + int commandNumber = commandBelongs(theCommand); + if (commandNumber == SIMPLECOMMAND){ + return addSimpleCommand(theCommand, startInd,doxyList, doxygenString); + } + if (commandNumber == IGNOREDSIMPLECOMMAND){ + return ignoreSimpleCommand(theCommand, startInd,doxyList, doxygenString); + } + if (commandNumber == COMMANDWORD){ + return addCommandWord(theCommand, startInd,doxyList, doxygenString); + } + if (commandNumber == IGNOREDCOMMANDWORD){ + return ignoreCommandWord(theCommand, startInd,doxyList, doxygenString); + } + if (commandNumber == COMMANDLINE ){ + return addCommandLine(theCommand, startInd,doxyList, doxygenString); + } + if (commandNumber == IGNOREDCOMMANDLINE ){ + return ignoreCommandLine(theCommand, startInd,doxyList, doxygenString); + } + if (commandNumber == COMMANDPARAGRAPH){ + return addCommandParagraph(theCommand, startInd,doxyList, doxygenString); + } + if (commandNumber == IGNORECOMMANDPARAGRAPH){ + return ignoreCommandParagraph(theCommand, startInd,doxyList, doxygenString); + } + if (commandNumber == COMMANDENDCOMMAND){ + return ignoreCommandEndCommand(theCommand, startInd,doxyList, doxygenString); + } + if (commandNumber == COMMANDWORDPARAGRAPH){ + return addCommandWordParagraph(theCommand, startInd,doxyList, doxygenString); + } + if (commandNumber == COMMANDWORDLINE){ + return addCommandWordLine(theCommand, startInd,doxyList, doxygenString); + } + if (commandNumber == COMMANDWORDOWORDWORD){ + return addCommandWordOWordOWord(theCommand, startInd,doxyList, doxygenString); + } + if (commandNumber == COMMANDOWORD){ + return addCommandOWord(theCommand, startInd,doxyList, doxygenString); + } + if (commandNumber == COMMANDERRORTHROW){ + return 0; + } + if (commandNumber == COMMANDUNIQUE){ + return 0; + } + + return 0; + } + + int weirdTest(){ + string doxygenString = "this is a test."; + string restOfParagraph; + int startIndex = 0; + restOfParagraph = getStringTilEndOfParagraph(startIndex , doxygenString); + cout << restOfParagraph<< " " << startIndex << endl; + + startIndex = 0; + restOfParagraph = getStringTilCommand(startIndex, doxygenString); + cout << restOfParagraph<< " " << startIndex << endl; + } + + + + int doRunExamples(){ + string line; + string filename; + string exampleNames[] = {"Examples/Example1","Examples/Example2", "Examples/Example3", "Examples/Example4", "Examples/Example5"}; + int placement; + string doxygenString; + ifstream doxCommentFile; + for (int i = 0; i < 5; i++){ + doxCommentFile.open(exampleNames[i].c_str()); + doxCommentFile >> doxygenString; + while(getline(doxCommentFile, line)){ + doxygenString += line + "\n";} + doxCommentFile.close(); + placement = 0; + cout << "---RAW CODE---" << endl << doxygenString << endl< */ +#define POUND_COMMAND 236 /* \# */ +#define PERCENT_COMMAND 237 /* \% */ + +#endif /*TRANSLATOR_H_*/ diff --git a/Source/DoxygenTranslator/src/JavaDocConverter.cpp b/Source/DoxygenTranslator/src/JavaDocConverter.cpp new file mode 100644 index 000000000..91f52662f --- /dev/null +++ b/Source/DoxygenTranslator/src/JavaDocConverter.cpp @@ -0,0 +1,210 @@ +#include "JavaDocConverter.h" +#include +#include +#include +#include +#define APPROX_LINE_LENGTH 64//characters per line allowed +#define TAB_SIZE 8//characters per line allowed +int printSortedTree2 = 0; +//TODO {@link} {@linkplain} {@docRoot}, and other useful doxy commands that are not a javadoc tag +JavaDocConverter::JavaDocConverter() +{ +} + +JavaDocConverter::~JavaDocConverter() +{ +} + +/* Sorts entities by javaDoc standard order for commands + * NOTE: will not behave entirely properly until "First level" comments + * such as brief descriptions are TAGGED as such + */ +bool compare_DoxygenEntities(DoxygenEntity first, DoxygenEntity second){ + if(first.typeOfEntity.compare("plainstring") == 0) return true; + if(second.typeOfEntity.compare("plainstring") == 0) return false; + if(first.typeOfEntity.compare("param") == 0){ + if(second.typeOfEntity.compare("param")== 0) return true; + if(second.typeOfEntity.compare("return")== 0) return true; + if(second.typeOfEntity.compare("exception")== 0) return true; + if(second.typeOfEntity.compare("author")== 0) return true; + if(second.typeOfEntity.compare("version")== 0)return true; + if(second.typeOfEntity.compare("see")== 0)return true; + if(second.typeOfEntity.compare("since")== 0)return true; + if(second.typeOfEntity.compare("deprecated")== 0)return true; + return false; + } + if(first.typeOfEntity.compare("return")== 0){ + if(second.typeOfEntity.compare("return")== 0) return true; + if(second.typeOfEntity.compare("exception")== 0) return true; + if(second.typeOfEntity.compare("author")== 0) return true; + if(second.typeOfEntity.compare("version")== 0)return true; + if(second.typeOfEntity.compare("see")== 0)return true; + if(second.typeOfEntity.compare("since")== 0)return true; + if(second.typeOfEntity.compare("deprecated")== 0)return true; + return false; + + } + if(first.typeOfEntity.compare("exception")== 0){ + if(second.typeOfEntity.compare("exception")== 0) return true; + if(second.typeOfEntity.compare("author")== 0) return true; + if(second.typeOfEntity.compare("version")== 0)return true; + if(second.typeOfEntity.compare("see")== 0)return true; + if(second.typeOfEntity.compare("since")== 0)return true; + if(second.typeOfEntity.compare("deprecated")== 0)return true; + return false; + } + if(first.typeOfEntity.compare("author")== 0){ + if(first.typeOfEntity.compare("author")== 0) return true; + if(first.typeOfEntity.compare("version")== 0)return true; + if(first.typeOfEntity.compare("see")== 0)return true; + if(first.typeOfEntity.compare("since")== 0)return true; + if(first.typeOfEntity.compare("deprecated")== 0)return true; + return false; + } + if(first.typeOfEntity.compare("version")== 0){ + if(second.typeOfEntity.compare("version")== 0)return true; + if(second.typeOfEntity.compare("see")== 0)return true; + if(second.typeOfEntity.compare("since")== 0)return true; + if(second.typeOfEntity.compare("deprecated")== 0)return true; + return false; + } + if(first.typeOfEntity.compare("see")== 0 || first.typeOfEntity.compare("sa")== 0){ + if(second.typeOfEntity.compare("see")== 0)return true; + if(second.typeOfEntity.compare("sa")== 0)return true; + if(second.typeOfEntity.compare("since")== 0)return true; + if(second.typeOfEntity.compare("deprecated")== 0)return true; + return false; + } + if(first.typeOfEntity.compare("since")== 0){ + if(second.typeOfEntity.compare("since")== 0) return true; + if(second.typeOfEntity.compare("deprecated")== 0)return true; + return false; + } + if(first.typeOfEntity.compare("deprecated")== 0){ + if(second.typeOfEntity.compare("deprecated")== 0)return true; + return false; + } + return true; +} + +void JavaDocConverter::printSortedTree(list &entityList){ + list::iterator p = entityList.begin(); + while (p != entityList.end()){ + (*p).printEntity(0); + p++; + } +} +string formatCommand(string unformattedLine, int indent){ + string formattedLines = "\n * "; + int lastPosition = 0; + int i = 0; + int isFirstLine = 1; + while (i != -1 && i < unformattedLine.length()){ + lastPosition = i; + if (isFirstLine){ + i+=APPROX_LINE_LENGTH; + } + else i+=APPROX_LINE_LENGTH - indent*TAB_SIZE; + i = unformattedLine.find(" ", i); + + if (i > 0 && i + 1 < unformattedLine.length()){ + if (!isFirstLine) for (int j = 0; j < indent; j++) { + formattedLines.append("\t"); + } + else { + isFirstLine = 0; + } + formattedLines.append(unformattedLine.substr(lastPosition, i - lastPosition + 1)); + formattedLines.append("\n *"); + + } + } + if (lastPosition < unformattedLine.length()){ + if (!isFirstLine) {for (int j = 0; j < indent; j++) {formattedLines.append("\t");}} + formattedLines.append(unformattedLine.substr(lastPosition, unformattedLine.length() - lastPosition)); + } + + return formattedLines; +} + +/* Contains the conversions for tags + * could probably be much more efficient... + */ +string javaDocFormat(DoxygenEntity &doxygenEntity){ + if (doxygenEntity.typeOfEntity.compare("plainstring") == 0){ + return doxygenEntity.data; + } + else if (doxygenEntity.typeOfEntity.compare("brief") == 0){ + return doxygenEntity.data; + } + if (doxygenEntity.typeOfEntity.compare("detailed") == 0){ + return doxygenEntity.data; + } + else if (doxygenEntity.typeOfEntity.compare("b") == 0){ + return "" + doxygenEntity.data + ""; + } + else if (doxygenEntity.typeOfEntity.compare("c") == 0){ + return "" + doxygenEntity.data + ""; + } + return ""; +} + + +string translateSubtree( DoxygenEntity &doxygenEntity){ + string returnedString; + if (doxygenEntity.isLeaf){ return javaDocFormat(doxygenEntity) + " ";} + else { + returnedString += javaDocFormat(doxygenEntity); + list::iterator p = doxygenEntity.entityList.begin(); + while (p != doxygenEntity.entityList.end()){ + returnedString+= translateSubtree(*p); + p++; + } + } + return returnedString; +} + +string translateEntity(DoxygenEntity &doxyEntity){ + if(doxyEntity.typeOfEntity.compare("plainstring")== 0 || doxyEntity.typeOfEntity.compare("deprecated")== 0 || doxyEntity.typeOfEntity.compare("brief")== 0) + return formatCommand(doxyEntity.data, 0) + "\n * "; + else if(doxyEntity.typeOfEntity.compare("see") == 0){ + return formatCommand(string("@" + doxyEntity.typeOfEntity + "\t\t" + translateSubtree(doxyEntity)), 2); + } + else if(doxyEntity.typeOfEntity.compare("return")== 0 + || doxyEntity.typeOfEntity.compare("author")== 0 + || doxyEntity.typeOfEntity.compare("param")== 0 + || doxyEntity.typeOfEntity.compare("since")== 0 + || doxyEntity.typeOfEntity.compare("version")== 0 + || doxyEntity.typeOfEntity.compare("exception") == 0 + || doxyEntity.typeOfEntity.compare("deprecated") == 0){ + return formatCommand(string("@" + doxyEntity.typeOfEntity + "\t" + translateSubtree(doxyEntity)), 2); + } + else if(doxyEntity.typeOfEntity.compare("sa")== 0){ + return formatCommand(string("@see\t\t" + translateSubtree(doxyEntity)), 2); + } + + return ""; +} + +string JavaDocConverter:: convertToJavaDoc(list entityList){ + + + entityList.sort(compare_DoxygenEntities); + if(printSortedTree2){ + cout << "---RESORTED LIST---" << endl; + printSortedTree(entityList); + } + + string javaDocString = "/**"; + + list::iterator entityIterator = entityList.begin(); + while (entityIterator != entityList.end()){ + javaDocString += translateEntity(*entityIterator); + entityIterator++; + } + + javaDocString += "\n */\n"; + cout << "\n---RESULT IN JAVADOC---" << endl; + cout << javaDocString; + return javaDocString; +} \ No newline at end of file diff --git a/Source/DoxygenTranslator/src/JavaDocConverter.h b/Source/DoxygenTranslator/src/JavaDocConverter.h new file mode 100644 index 000000000..81122bc5f --- /dev/null +++ b/Source/DoxygenTranslator/src/JavaDocConverter.h @@ -0,0 +1,18 @@ + #include + #include + #include "DoxygenEntity.h" + +#ifndef JAVADOCCONVERTER_H_ +#define JAVADOCCONVERTER_H_ + +class JavaDocConverter +{ +public: + + JavaDocConverter(); + string convertToJavaDoc(list entityList); + ~JavaDocConverter(); + void printSortedTree(list &entityList); +}; + +#endif /*JAVADOCCONVERTER_H_*/ diff --git a/Source/DoxygenTranslator/src/Token.cpp b/Source/DoxygenTranslator/src/Token.cpp new file mode 100644 index 000000000..e85799546 --- /dev/null +++ b/Source/DoxygenTranslator/src/Token.cpp @@ -0,0 +1,32 @@ +#include "Token.h" +#include +#include +#include +#include +using namespace std; + + +Token::Token(int tType, string tString) +{ + tokenType = tType; + tokenString = tString; +} + +string Token::toString() +{ + if (tokenType == END_LINE){ + return "{END OF LINE}"; + } + if (tokenType == PARAGRAPH_END){ + return "{END OF PARAGRAPH}"; + } + if (tokenType == PLAINSTRING){ + return tokenString; + } + if (tokenType == COMMAND){ + return "{COMMAND : " + tokenString+ "}"; + } + return ""; +} + +Token:: ~Token(){} diff --git a/Source/DoxygenTranslator/src/Token.h b/Source/DoxygenTranslator/src/Token.h new file mode 100644 index 000000000..e98686c14 --- /dev/null +++ b/Source/DoxygenTranslator/src/Token.h @@ -0,0 +1,21 @@ +#ifndef TOKEN_H_ +#define TOKEN_H_ +#include + +#define END_LINE 101 +#define PARAGRAPH_END 102 +#define PLAINSTRING 103 +#define COMMAND 104 +using namespace std; + +class Token +{ +public: + Token(int tType, string tString); + ~Token(); + int tokenType; /* currently can be END_LINE, PLAINSTRING, or COMMAND */ + string tokenString; /* the data , such as param for @param*/ + string toString(); +}; + +#endif /*TOKEN_H_*/ diff --git a/Source/DoxygenTranslator/src/TokenList.cpp b/Source/DoxygenTranslator/src/TokenList.cpp new file mode 100644 index 000000000..eeec6da46 --- /dev/null +++ b/Source/DoxygenTranslator/src/TokenList.cpp @@ -0,0 +1,116 @@ +#include "TokenList.h" +#include +#include +#include +#include +#include "Token.h" +#define TOKENSPERLINE 8; //change this to change the printing behaviour of the token list +#define END_LINE 101 +#define PARAGRAPH_END 102 //not used at the moment +#define PLAINSTRING 103 +#define COMMAND 104 +using namespace std; + + +list tokenList; +list::iterator tokenListIterator; +int noisy2 = 0; +/* The tokenizer*/ + +TokenList::TokenList(string doxygenString){ + int currentIndex = 0; + //Regex whitespace("[ \t]+"); + //Regex newLine("[\n]"); + //Regex command("[@|\\]{1}[^ \t \n]+"); //the cheap solution + //Regex doxygenFluff("[/*!]+"); + int nextIndex = 0; + int isFluff = 0; + string currentWord; + while (currentIndex < doxygenString.length()){ + if(doxygenString[currentIndex] == '\n'){ + tokenList.push_back(Token(END_LINE, currentWord)); + currentIndex++; + } + while(currentIndex < doxygenString.length() && (doxygenString[currentIndex] == ' ' + || doxygenString[currentIndex]== '\t')) currentIndex ++; + if (currentIndex == doxygenString.length()) {} //do nothing since end of string was reached + else {nextIndex = currentIndex; + while (nextIndex < doxygenString.length() && (doxygenString[nextIndex] != ' ' + && doxygenString[nextIndex]!= '\t' && doxygenString[nextIndex]!= '\n')) nextIndex++; + currentWord = doxygenString.substr(currentIndex, nextIndex-currentIndex); + if(noisy2) cout << "Current Word: " << currentWord << endl; + if (currentWord[0] == '@' || currentWord[0] == '\\'){ + currentWord = currentWord.substr(1, currentWord.length()-1); + tokenList.push_back(Token(COMMAND, currentWord)); + } + else if (currentWord[0] == '\n'){ + //if ((tokenList.back()).tokenType == END_LINE){} + tokenList.push_back(Token(END_LINE, currentWord)); + + } + else if (currentWord[0] == '*' || currentWord[0] == '/' ||currentWord[0] == '!'){ + if (currentWord.length() == 1) {isFluff = 1;} + else { isFluff = 1; + for(int i = 1; i < currentWord.length(); i++){ + if (currentWord[0] != '*' && currentWord[0] != '/' && currentWord[0] != '!') isFluff = 0; + } + + } + if(!isFluff) tokenList.push_back(Token(PLAINSTRING, currentWord)); + } + + else tokenList.push_back(Token(PLAINSTRING, currentWord)); + currentIndex = nextIndex; + } + } + tokenListIterator = tokenList.begin(); +} + +Token TokenList::peek(){ + if(tokenListIterator!= tokenList.end()){ + Token returnedToken = (*tokenListIterator); + return returnedToken; + } + else + return Token(0, ""); +} + +Token TokenList::next(){ + if(tokenListIterator != tokenList.end()){ + Token returnedToken = (*tokenListIterator); + tokenListIterator++; + return (returnedToken); + } + else + return Token(0, ""); +} + +list::iterator TokenList::end(){ + return tokenList.end(); +} + +list::iterator TokenList::current(){ + return tokenListIterator; +} +void TokenList::printList(){ + list::iterator p = tokenList.begin(); + int i = 1; + int b = 0; + while (p != tokenList.end()){ + cout << (*p).toString() << " "; + b = i%TOKENSPERLINE; + if (b == 0) cout << endl; + p++; i++; + } +} + +list::iterator TokenList::iteratorCopy(){ + list::iterator p = tokenListIterator; + return p; +} +void TokenList::setIterator(list::iterator newPosition){ + tokenListIterator = newPosition; +} +TokenList:: ~TokenList(){ + tokenList.clear(); +} diff --git a/Source/DoxygenTranslator/src/TokenList.h b/Source/DoxygenTranslator/src/TokenList.h new file mode 100644 index 000000000..cc61f56e4 --- /dev/null +++ b/Source/DoxygenTranslator/src/TokenList.h @@ -0,0 +1,27 @@ +#ifndef TOKENLIST_H_ +#define TOKENLIST_H_ +#include +#include +#include +#include +#include "Token.h" +using namespace std; + +/* a small class used to represent the sequence of tokens + * that can be derived from a formatted doxygen string + */ + +class TokenList{ +public: + TokenList(string doxygenString); /* constructor takes a blob of Doxygen comment */ + ~TokenList(); + Token peek(); /* returns next token without advancing */ + Token next(); /* returns next token and advances */ + list::iterator end(); /* returns an end iterator */ + list::iterator current(); /* returns the current iterator */ + void printList(); /* prints out the sequence of tokens */ + list::iterator iteratorCopy(); /* returns a copy of the current iterator */ + void setIterator(list::iterator newPosition); /*moves up the iterator*/ +}; + +#endif /*TOKENLIST_H_*/ diff --git a/Source/DoxygenTranslator/src/TranslatorTest.cpp b/Source/DoxygenTranslator/src/TranslatorTest.cpp new file mode 100644 index 000000000..f2bb48983 --- /dev/null +++ b/Source/DoxygenTranslator/src/TranslatorTest.cpp @@ -0,0 +1,68 @@ + +#include +#include +#include +#include +#include +using namespace std; + + +/* This classes primary function is to test the basic text processing abilities of + * the Doxygen parsing class + * It is currently a little messy */ + + +int testCommandParsingFunctions = 1; +int testCodeCrawlingFunctions = 1; + + +/* 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"}; + + return 1; + + }; + +int testCCF(){ + + + + cout << "Testing getNextWord" << endl; + // Case 1: \command + string case1 = "\b word"; + string case2 = "\b word "; + string case3 = "\b word\n"; + string case4 = "\b word \n"; + string case5 = "\b word word"; + //Case 2: \command {paragraph} + + //Case 3: \command (text til end of line) + + + return 1; +} + +int testCPF(){ + // Case 1: \command + string case1 = "\b word"; + //Case 2: \command {paragraph} + + //Case 3: \command (text til end of line) + + return 1; + +} + +int main(int argc, char *argv[]){ + if(testCodeCrawlingFunctions) testCCF(); + if(testCommandParsingFunctions) testCPF(); + + + return 1; +} diff --git a/Source/DoxygenTranslator/src/TranslatorTest.h b/Source/DoxygenTranslator/src/TranslatorTest.h new file mode 100644 index 000000000..0014de718 --- /dev/null +++ b/Source/DoxygenTranslator/src/TranslatorTest.h @@ -0,0 +1,11 @@ +#ifndef TRANSLATORTEST_H_ +#define TRANSLATORTEST_H_ + +class TranslatorTest +{ +public: + TranslatorTest(); + virtual ~TranslatorTest(); +}; + +#endif /*TRANSLATORTEST_H_*/ diff --git a/Source/Makefile.am b/Source/Makefile.am index a72671305..1abe41cbd 100644 --- a/Source/Makefile.am +++ b/Source/Makefile.am @@ -88,7 +88,19 @@ eswig_SOURCES = CParse/cscanner.c \ Swig/typemap.c \ Swig/typesys.c \ Swig/warn.c \ - Swig/wrapfunc.c + Swig/wrapfunc.c \ + DoxygenTranslator/src/DoxygenEntity.h\ + DoxygenTranslator/src/DoxygenEntity.cpp\ + DoxygenTranslator/src/DoxygenParser.h\ + DoxygenTranslator/src/DoxygenParser.cpp\ + DoxygenTranslator/src/DoxygenTranslator.h\ + DoxygenTranslator/src/DoxygenTranslator.cpp\ + DoxygenTranslator/src/JavaDocConverter.h\ + DoxygenTranslator/src/JavaDocConverter.cpp\ + DoxygenTranslator/src/Token.h\ + DoxygenTranslator/src/Token.cpp\ + DoxygenTranslator/src/TokenList.h\ + DoxygenTranslator/src/TokenList.cpp bin_PROGRAMS = eswig eswig_LDADD = @SWIGLIBS@ diff --git a/Source/Modules/java.cxx b/Source/Modules/java.cxx index 5660b4885..23e233071 100644 --- a/Source/Modules/java.cxx +++ b/Source/Modules/java.cxx @@ -13,6 +13,7 @@ char cvsroot_java_cxx[] = "$Id$"; #include // for INT_MAX #include "cparse.h" #include +#include "../DoxygenTranslator/src/DoxygenTranslator.h" /* Hash type used for upcalls from C/C++ */ typedef DOH UpcallData; @@ -43,7 +44,7 @@ class JAVA:public Language { bool global_variable_flag; // Flag for when wrapping a global variable bool old_variable_names; // Flag for old style variable names in the intermediary class bool member_func_flag; // flag set when wrapping a member function - + String *imclass_name; // intermediary class name String *module_class_name; // module class name String *imclass_class_code; // intermediary class code @@ -70,7 +71,8 @@ class JAVA:public Language { String *imclass_cppcasts_code; //C++ casts up inheritance hierarchies intermediary class code String *imclass_directors; // Intermediate class director code String *destructor_call; //C++ destructor call if any - + String *structuralComments; + // Director method stuff: List *dmethods_seq; Hash *dmethods_table; @@ -87,6 +89,11 @@ class JAVA:public Language { Setline(p, Getline(n)); return p; } + /* DOXYGEN TO JAVADOC globals */ + bool doxygen_javadoc_flag; //flag for converting found doxygen to javadoc + //TODO make this bool a command line option + DoxygenTranslator doxyTranslator; + public: @@ -141,6 +148,7 @@ public: imclass_cppcasts_code(NULL), imclass_directors(NULL), destructor_call(NULL), + structuralComments(NULL), dmethods_seq(NULL), dmethods_table(NULL), n_dmethods(0), @@ -149,6 +157,7 @@ public: should be easy to implement though */ director_multiple_inheritance = 0; director_language = 1; + doxyTranslator = DoxygenTranslator(); } /* ----------------------------------------------------------------------------- @@ -202,6 +211,7 @@ public: virtual void main(int argc, char *argv[]) { + doxygen_javadoc_flag = true; SWIG_library_directory("java"); // Look for certain command line options @@ -355,6 +365,7 @@ public: imclass_imports = NewString(""); imclass_cppcasts_code = NewString(""); imclass_directors = NewString(""); + structuralComments = NewString(""); upcasts_code = NewString(""); dmethods_seq = NewList(); dmethods_table = NewHash(); @@ -432,6 +443,8 @@ public: // Start writing out the intermediary class file emitBanner(f_im); + + if (Len(package) > 0) Printf(f_im, "package %s;\n", package); @@ -482,13 +495,22 @@ public: // Start writing out the module class file emitBanner(f_module); - + //Add any structural comments to the top + if(doxygen_javadoc_flag && structuralComments){ + Printf(f_module, "%s", structuralComments); + } if (Len(package) > 0) Printf(f_module, "package %s;\n", package); if (module_imports) Printf(f_module, "%s\n", module_imports); - + + if (doxygen_javadoc_flag){ + if (Getattr(n,"DoxygenComment")){ + Printf(f_module, "/* This was generated from top() */"); + Printf(f_module, doxyTranslator.convert(Char((String *)Getattr(n,"DoxygenComment")),"JAVADOC")); + } + } if (Len(module_class_modifiers) > 0) Printf(f_module, "%s ", module_class_modifiers); Printf(f_module, "%s ", module_class_name); @@ -921,7 +943,7 @@ public: Delete(c_param_type); Delete(arg); } - + Printv(f->code, nondir_args, NIL); Delete(nondir_args); @@ -1135,6 +1157,7 @@ public: return ret; } + /* ---------------------------------------------------------------------- * enumDeclaration() * @@ -1205,7 +1228,15 @@ public: // Add extra indentation Replaceall(enum_code, "\n", "\n "); Replaceall(enum_code, " \n", "\n"); + //translate and write javadoc comment if flagged + if (doxygen_javadoc_flag){ + if (Getattr(n,"DoxygenComment")){ + Printv(proxy_class_constants_code, "/* This was generated from enumvalueDeclaration */", NIL ); + Printv(proxy_class_constants_code, doxyTranslator.convert(Char((const String *)Getattr(n,"DoxygenComment")),"JAVADOC"), NIL); + } + } + Printv(proxy_class_constants_code, " ", enum_code, "\n\n", NIL); } else { // Global enums are defined in their own file @@ -1267,7 +1298,14 @@ public: tmpValue = NewString(name); // Note that this is used in enumValue() amongst other places Setattr(n, "value", tmpValue); - + + //translate and write javadoc comment if flagged + if (doxygen_javadoc_flag){ + if (Getattr(n,"DoxygenComment")){ + Printf(enum_code, "/* This was generated from enumvalueDeclaration() */" ); + Printf(enum_code, doxyTranslator.convert(Char((String *)Getattr(n,"DoxygenComment")),"JAVADOC")); + } + } { EnumFeature enum_feature = decodeEnumFeature(parentNode(n)); @@ -1326,6 +1364,21 @@ public: return SWIG_OK; } + /* ----------------------------------------------------------------------- + * doxygenComment() + * Simply translates the doxygen comment and places it into the appropriate + * file + * ------------------------------------------------------------------------ */ + virtual int doxygenComment(Node *n){ + if (doxygen_javadoc_flag){ + if (Getattr(n,"DoxygenComment")){ + Printv(structuralComments, "/* This was generated from doxygenComment() */\n", NIL); + Printv(structuralComments, doxyTranslator.convert(Char((String *)Getattr(n,"DoxygenComment")),"JAVADOC"), NIL); + } + } + return SWIG_OK; + } + /* ----------------------------------------------------------------------- * constantWrapper() * Used for wrapping constants - #define or %constant. @@ -1344,7 +1397,14 @@ public: String *tm; String *return_type = NewString(""); String *constants_code = NewString(""); - + //translate and write javadoc comment if flagged + if (doxygen_javadoc_flag){ + if (Getattr(n,"DoxygenComment")){ + Printf(constants_code, "/* This was generated from enumvalueDeclaration */\n"); + Printf(constants_code, doxyTranslator.convert(Char((String *)Getattr(n,"DoxygenComment")),"JAVADOC")); + } + } + if (!addSymbol(symname, n)) return SWIG_ERROR; @@ -1605,7 +1665,15 @@ public: // Pure Java interfaces const String *pure_interfaces = typemapLookup("javainterfaces", typemap_lookup_type, WARN_NONE); - + + //translate and write javadoc comment if flagged + if (doxygen_javadoc_flag){ + if (Getattr(n,"DoxygenComment")){ + Printv(proxy_class_def, "/* This was generated from emitProxyClassDefAndCPPCasts() */\n", NIL ); + Printv(proxy_class_def, doxyTranslator.convert(Char((String *)Getattr(n,"DoxygenComment")),"JAVADOC"), NIL); + } + } + // Start writing the proxy class Printv(proxy_class_def, typemapLookup("javaimports", typemap_lookup_type, WARN_NONE), // Import statements "\n", typemapLookup("javaclassmodifiers", typemap_lookup_type, WARN_JAVA_TYPEMAP_CLASSMOD_UNDEF), // Class modifiers @@ -1754,9 +1822,10 @@ public: // Start writing out the proxy class file emitBanner(f_proxy); - if (Len(package) > 0) + if (Len(package) > 0){ + Printf(f_proxy, "LETS TEST THIS NAO THX \n\n\n"); Printf(f_proxy, "package %s;\n", package); - + } Clear(proxy_class_def); Clear(proxy_class_code); @@ -1936,7 +2005,16 @@ public: // For wrapping member variables (Javabean setter) setter_flag = (Cmp(Getattr(n, "sym:name"), Swig_name_set(Swig_name_member(proxy_class_name, variable_name))) == 0); } - + + + //translate and write javadoc comment if flagged + if (doxygen_javadoc_flag){ + if (Getattr(n,"DoxygenComment")){ + Printf(function_code, "/* This was generated from proxyclassfunctionhandler */"); + Printf(function_code, doxyTranslator.convert(Char((String *)Getattr(n,"DoxygenComment")),"JAVADOC")); + } + } + /* Start generating the proxy function */ const String *methodmods = Getattr(n, "feature:java:methodmodifiers"); methodmods = methodmods ? methodmods : (is_public(n) ? public_string : protected_string); @@ -2158,7 +2236,15 @@ public: tm = Getattr(n, "tmap:jtype"); // typemaps were attached earlier to the node Printf(im_return_type, "%s", tm); - + + //translate and write javadoc comment if flagged + if (doxygen_javadoc_flag){ + if (Getattr(n,"DoxygenComment")){ + Printf(function_code, "/* This was generated from constructionhandler */\n" ); + Printf(function_code, doxyTranslator.convert(Char((String *)Getattr(n,"DoxygenComment")),"JAVADOC")); + } + } + Printf(function_code, " %s %s(", methodmods, proxy_class_name); Printf(helper_code, " static private %s SwigConstruct%s(", im_return_type, proxy_class_name); @@ -2419,6 +2505,14 @@ public: bool setter_flag = false; String *pre_code = NewString(""); String *post_code = NewString(""); + + //translate and write javadoc comment if flagged + if (doxygen_javadoc_flag){ + if (Getattr(n,"DoxygenComment")){ + Printf(function_code, "/* This was generated from moduleClassFunctionHandler() */\n" ); + Printf(function_code, doxyTranslator.convert(Char((String *)Getattr(n,"DoxygenComment")),"JAVADOC")); + } + } if (l) { if (SwigType_type(Getattr(l, "type")) == T_VOID) { @@ -2814,6 +2908,7 @@ public: const String *pure_baseclass = typemapLookup("javabase", type, WARN_NONE); const String *pure_interfaces = typemapLookup("javainterfaces", type, WARN_NONE); + // Emit the class Printv(swigtype, typemapLookup("javaimports", type, WARN_NONE), // Import statements "\n", typemapLookup("javaclassmodifiers", type, WARN_JAVA_TYPEMAP_CLASSMOD_UNDEF), // Class modifiers diff --git a/Source/Modules/lang.cxx b/Source/Modules/lang.cxx index 4a7bf8813..368dc2c85 100644 --- a/Source/Modules/lang.cxx +++ b/Source/Modules/lang.cxx @@ -132,6 +132,12 @@ int Dispatcher::emit_one(Node *n) { ret = namespaceDeclaration(n); } else if (strcmp(tag, "template") == 0) { ret = templateDeclaration(n); + } + /* =============================================================== + * Doxygen Comment + * =============================================================== */ + else if (strcmp(tag, "doxycomm") == 0) { + ret = doxygenComment(n); } /* =============================================================== @@ -296,7 +302,9 @@ int Dispatcher::usingDeclaration(Node *n) { int Dispatcher::namespaceDeclaration(Node *n) { return defaultHandler(n); } - +int Dispatcher::doxygenComment(Node *n){ + return defaultHandler(n); +} /* Allocators */ Language::Language(): @@ -2817,6 +2825,17 @@ int Language::usingDeclaration(Node *n) { /* Stubs. Language modules need to implement these */ +/* ---------------------------------------------------------------------- + * Language::doxygenComment() + * ---------------------------------------------------------------------- */ +int Language::doxygenComment(Node *n){ + + String *comment = Getattr(n, "comment"); + + return SWIG_OK; + +} + /* ---------------------------------------------------------------------- * Language::constantWrapper() * ---------------------------------------------------------------------- */ diff --git a/Source/Modules/swigmod.h b/Source/Modules/swigmod.h index 5835c6362..03892e4f6 100644 --- a/Source/Modules/swigmod.h +++ b/Source/Modules/swigmod.h @@ -82,6 +82,9 @@ public: virtual int typemapcopyDirective(Node *n); virtual int typesDirective(Node *n); + /* Doxygen Comment */ + virtual int doxygenComment(Node *n); + /* C/C++ parsing */ virtual int cDeclaration(Node *n); @@ -159,6 +162,9 @@ public: virtual int namespaceDeclaration(Node *n); virtual int usingDeclaration(Node *n); + /* C/C++ parsing */ + virtual int doxygenComment(Node *n); + /* Function handlers */ virtual int functionHandler(Node *n); diff --git a/Tools/config/config.guess b/Tools/config/config.guess index 396482d6c..278f9e9e0 100755 --- a/Tools/config/config.guess +++ b/Tools/config/config.guess @@ -4,7 +4,7 @@ # 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, # Inc. -timestamp='2006-07-02' +timestamp='2007-07-22' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -161,6 +161,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; + sh5el) machine=sh5le-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched @@ -329,7 +330,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; - i86pc:SunOS:5.*:*) + i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:6*:*) @@ -780,7 +781,7 @@ EOF i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; - i*:MINGW*:*) + *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; i*:windows32*:*) @@ -790,12 +791,15 @@ EOF i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit ;; - x86:Interix*:[3456]*) - echo i586-pc-interix${UNAME_RELEASE} - exit ;; - EM64T:Interix*:[3456]*) - echo x86_64-unknown-interix${UNAME_RELEASE} - exit ;; + *:Interix*:[3456]*) + case ${UNAME_MACHINE} in + x86) + echo i586-pc-interix${UNAME_RELEASE} + exit ;; + EM64T | authenticamd) + echo x86_64-unknown-interix${UNAME_RELEASE} + exit ;; + esac ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks exit ;; @@ -950,6 +954,9 @@ EOF x86_64:Linux:*:*) echo x86_64-unknown-linux-gnu exit ;; + xtensa:Linux:*:*) + echo xtensa-unknown-linux-gnu + exit ;; i*86:Linux:*:*) # The BFD linker knows what the default object file format is, so # first see if it will tell us. cd to the root directory to prevent @@ -1208,6 +1215,15 @@ EOF SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} exit ;; + SX-7:SUPER-UX:*:*) + echo sx7-nec-superux${UNAME_RELEASE} + exit ;; + SX-8:SUPER-UX:*:*) + echo sx8-nec-superux${UNAME_RELEASE} + exit ;; + SX-8R:SUPER-UX:*:*) + echo sx8r-nec-superux${UNAME_RELEASE} + exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit ;; diff --git a/Tools/config/config.sub b/Tools/config/config.sub index fab0aa355..1761d8bdf 100755 --- a/Tools/config/config.sub +++ b/Tools/config/config.sub @@ -4,7 +4,7 @@ # 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, # Inc. -timestamp='2006-09-20' +timestamp='2007-06-28' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software @@ -245,12 +245,12 @@ case $basic_machine in | bfin \ | c4x | clipper \ | d10v | d30v | dlx | dsp16xx \ - | fr30 | frv \ + | fido | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ - | maxq | mb | microblaze | mcore \ + | maxq | mb | microblaze | mcore | mep \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ @@ -324,7 +324,7 @@ case $basic_machine in | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ - | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \ + | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | i*86-* | i860-* | i960-* | ia64-* \ @@ -475,8 +475,8 @@ case $basic_machine in basic_machine=craynv-cray os=-unicosmp ;; - cr16c) - basic_machine=cr16c-unknown + cr16) + basic_machine=cr16-unknown os=-elf ;; crds | unos) @@ -683,6 +683,10 @@ case $basic_machine in basic_machine=i386-pc os=-mingw32 ;; + mingw32ce) + basic_machine=arm-unknown + os=-mingw32ce + ;; miniframe) basic_machine=m68000-convergent ;; @@ -925,6 +929,9 @@ case $basic_machine in basic_machine=sh-hitachi os=-hms ;; + sh5el) + basic_machine=sh5le-unknown + ;; sh64) basic_machine=sh64-unknown ;; @@ -1219,7 +1226,7 @@ case $os in | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ - | -skyos* | -haiku* | -rdos* | -toppers*) + | -skyos* | -haiku* | -rdos* | -toppers* | -drops*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) @@ -1414,6 +1421,9 @@ case $basic_machine in m68*-cisco) os=-aout ;; + mep-*) + os=-elf + ;; mips*-cisco) os=-elf ;; From 311ddbc2bf57311750ba4b6ea759e94900b90866 Mon Sep 17 00:00:00 2001 From: Cheryl Foil Date: Fri, 15 Aug 2008 23:54:53 +0000 Subject: [PATCH 010/314] Added a new Examples folder with modified Examples/java files git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2008-cherylfoil@10763 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- .../doxygencomments/java/callback/Makefile | 18 ++ .../doxygencomments/java/callback/example.cxx | 4 + .../doxygencomments/java/callback/example.h | 24 +++ .../doxygencomments/java/callback/example.i | 14 ++ .../doxygencomments/java/callback/index.html | 20 ++ .../doxygencomments/java/callback/main.java | 56 +++++ Examples/doxygencomments/java/check.list | 15 ++ Examples/doxygencomments/java/class/Makefile | 18 ++ .../doxygencomments/java/class/example.cxx | 28 +++ .../doxygencomments/java/class/example.dsp | 162 ++++++++++++++ Examples/doxygencomments/java/class/example.h | 45 ++++ Examples/doxygencomments/java/class/example.i | 10 + .../doxygencomments/java/class/index.html | 197 ++++++++++++++++++ Examples/doxygencomments/java/class/main.java | 70 +++++++ .../doxygencomments/java/constants/Makefile | 18 ++ .../doxygencomments/java/constants/example.i | 30 +++ .../doxygencomments/java/constants/index.html | 52 +++++ .../doxygencomments/java/constants/main.java | 44 ++++ Examples/doxygencomments/java/enum/Makefile | 18 ++ .../doxygencomments/java/enum/example.cxx | 37 ++++ Examples/doxygencomments/java/enum/example.h | 23 ++ Examples/doxygencomments/java/enum/example.i | 14 ++ Examples/doxygencomments/java/enum/index.html | 29 +++ Examples/doxygencomments/java/enum/main.java | 38 ++++ Examples/doxygencomments/java/extend/Makefile | 18 ++ .../doxygencomments/java/extend/example.cxx | 4 + .../doxygencomments/java/extend/example.h | 60 ++++++ .../doxygencomments/java/extend/example.i | 15 ++ .../doxygencomments/java/extend/index.html | 19 ++ .../doxygencomments/java/extend/main.java | 88 ++++++++ .../doxygencomments/java/funcptr/Makefile | 18 ++ .../doxygencomments/java/funcptr/example.c | 19 ++ .../doxygencomments/java/funcptr/example.h | 10 + .../doxygencomments/java/funcptr/example.i | 16 ++ .../doxygencomments/java/funcptr/index.html | 91 ++++++++ .../doxygencomments/java/funcptr/main.java | 33 +++ Examples/doxygencomments/java/index.html | 65 ++++++ .../doxygencomments/java/multimap/Makefile | 18 ++ .../doxygencomments/java/multimap/example.c | 53 +++++ .../doxygencomments/java/multimap/example.dsp | 158 ++++++++++++++ .../doxygencomments/java/multimap/example.i | 109 ++++++++++ .../doxygencomments/java/multimap/main.java | 40 ++++ Examples/doxygencomments/java/native/Makefile | 18 ++ .../doxygencomments/java/native/example.i | 56 +++++ .../doxygencomments/java/native/index.html | 33 +++ .../doxygencomments/java/native/main.java | 19 ++ .../doxygencomments/java/pointer/Makefile | 18 ++ .../doxygencomments/java/pointer/example.c | 16 ++ .../doxygencomments/java/pointer/example.i | 30 +++ .../doxygencomments/java/pointer/index.html | 165 +++++++++++++++ .../doxygencomments/java/pointer/main.java | 55 +++++ .../doxygencomments/java/reference/Makefile | 18 ++ .../java/reference/example.cxx | 46 ++++ .../doxygencomments/java/reference/example.h | 26 +++ .../doxygencomments/java/reference/example.i | 46 ++++ .../doxygencomments/java/reference/index.html | 147 +++++++++++++ .../doxygencomments/java/reference/main.java | 79 +++++++ Examples/doxygencomments/java/simple/Makefile | 18 ++ .../doxygencomments/java/simple/example.c | 18 ++ .../doxygencomments/java/simple/example.dsp | 158 ++++++++++++++ .../doxygencomments/java/simple/example.i | 7 + .../doxygencomments/java/simple/index.html | 108 ++++++++++ .../doxygencomments/java/simple/main.java | 32 +++ .../doxygencomments/java/template/Makefile | 18 ++ .../doxygencomments/java/template/example.h | 32 +++ .../doxygencomments/java/template/example.i | 17 ++ .../doxygencomments/java/template/index.html | 102 +++++++++ .../doxygencomments/java/template/main.java | 45 ++++ .../doxygencomments/java/typemap/Makefile | 18 ++ .../doxygencomments/java/typemap/example.i | 101 +++++++++ .../doxygencomments/java/typemap/index.html | 32 +++ .../doxygencomments/java/typemap/main.java | 26 +++ .../doxygencomments/java/variables/Makefile | 18 ++ .../doxygencomments/java/variables/example.c | 91 ++++++++ .../doxygencomments/java/variables/example.h | 6 + .../doxygencomments/java/variables/example.i | 49 +++++ .../doxygencomments/java/variables/index.html | 85 ++++++++ .../doxygencomments/java/variables/main.java | 97 +++++++++ 78 files changed, 3668 insertions(+) create mode 100644 Examples/doxygencomments/java/callback/Makefile create mode 100644 Examples/doxygencomments/java/callback/example.cxx create mode 100644 Examples/doxygencomments/java/callback/example.h create mode 100644 Examples/doxygencomments/java/callback/example.i create mode 100644 Examples/doxygencomments/java/callback/index.html create mode 100644 Examples/doxygencomments/java/callback/main.java create mode 100644 Examples/doxygencomments/java/check.list create mode 100644 Examples/doxygencomments/java/class/Makefile create mode 100644 Examples/doxygencomments/java/class/example.cxx create mode 100644 Examples/doxygencomments/java/class/example.dsp create mode 100644 Examples/doxygencomments/java/class/example.h create mode 100644 Examples/doxygencomments/java/class/example.i create mode 100644 Examples/doxygencomments/java/class/index.html create mode 100644 Examples/doxygencomments/java/class/main.java create mode 100644 Examples/doxygencomments/java/constants/Makefile create mode 100644 Examples/doxygencomments/java/constants/example.i create mode 100644 Examples/doxygencomments/java/constants/index.html create mode 100644 Examples/doxygencomments/java/constants/main.java create mode 100644 Examples/doxygencomments/java/enum/Makefile create mode 100644 Examples/doxygencomments/java/enum/example.cxx create mode 100644 Examples/doxygencomments/java/enum/example.h create mode 100644 Examples/doxygencomments/java/enum/example.i create mode 100644 Examples/doxygencomments/java/enum/index.html create mode 100644 Examples/doxygencomments/java/enum/main.java create mode 100644 Examples/doxygencomments/java/extend/Makefile create mode 100644 Examples/doxygencomments/java/extend/example.cxx create mode 100644 Examples/doxygencomments/java/extend/example.h create mode 100644 Examples/doxygencomments/java/extend/example.i create mode 100644 Examples/doxygencomments/java/extend/index.html create mode 100644 Examples/doxygencomments/java/extend/main.java create mode 100644 Examples/doxygencomments/java/funcptr/Makefile create mode 100644 Examples/doxygencomments/java/funcptr/example.c create mode 100644 Examples/doxygencomments/java/funcptr/example.h create mode 100644 Examples/doxygencomments/java/funcptr/example.i create mode 100644 Examples/doxygencomments/java/funcptr/index.html create mode 100644 Examples/doxygencomments/java/funcptr/main.java create mode 100644 Examples/doxygencomments/java/index.html create mode 100644 Examples/doxygencomments/java/multimap/Makefile create mode 100644 Examples/doxygencomments/java/multimap/example.c create mode 100644 Examples/doxygencomments/java/multimap/example.dsp create mode 100644 Examples/doxygencomments/java/multimap/example.i create mode 100644 Examples/doxygencomments/java/multimap/main.java create mode 100644 Examples/doxygencomments/java/native/Makefile create mode 100644 Examples/doxygencomments/java/native/example.i create mode 100644 Examples/doxygencomments/java/native/index.html create mode 100644 Examples/doxygencomments/java/native/main.java create mode 100644 Examples/doxygencomments/java/pointer/Makefile create mode 100644 Examples/doxygencomments/java/pointer/example.c create mode 100644 Examples/doxygencomments/java/pointer/example.i create mode 100644 Examples/doxygencomments/java/pointer/index.html create mode 100644 Examples/doxygencomments/java/pointer/main.java create mode 100644 Examples/doxygencomments/java/reference/Makefile create mode 100644 Examples/doxygencomments/java/reference/example.cxx create mode 100644 Examples/doxygencomments/java/reference/example.h create mode 100644 Examples/doxygencomments/java/reference/example.i create mode 100644 Examples/doxygencomments/java/reference/index.html create mode 100644 Examples/doxygencomments/java/reference/main.java create mode 100644 Examples/doxygencomments/java/simple/Makefile create mode 100644 Examples/doxygencomments/java/simple/example.c create mode 100644 Examples/doxygencomments/java/simple/example.dsp create mode 100644 Examples/doxygencomments/java/simple/example.i create mode 100644 Examples/doxygencomments/java/simple/index.html create mode 100644 Examples/doxygencomments/java/simple/main.java create mode 100644 Examples/doxygencomments/java/template/Makefile create mode 100644 Examples/doxygencomments/java/template/example.h create mode 100644 Examples/doxygencomments/java/template/example.i create mode 100644 Examples/doxygencomments/java/template/index.html create mode 100644 Examples/doxygencomments/java/template/main.java create mode 100644 Examples/doxygencomments/java/typemap/Makefile create mode 100644 Examples/doxygencomments/java/typemap/example.i create mode 100644 Examples/doxygencomments/java/typemap/index.html create mode 100644 Examples/doxygencomments/java/typemap/main.java create mode 100644 Examples/doxygencomments/java/variables/Makefile create mode 100644 Examples/doxygencomments/java/variables/example.c create mode 100644 Examples/doxygencomments/java/variables/example.h create mode 100644 Examples/doxygencomments/java/variables/example.i create mode 100644 Examples/doxygencomments/java/variables/index.html create mode 100644 Examples/doxygencomments/java/variables/main.java diff --git a/Examples/doxygencomments/java/callback/Makefile b/Examples/doxygencomments/java/callback/Makefile new file mode 100644 index 000000000..14c301703 --- /dev/null +++ b/Examples/doxygencomments/java/callback/Makefile @@ -0,0 +1,18 @@ +TOP = ../.. +SWIG = $(TOP)/../preinst-swig +CXXSRCS = example.cxx +TARGET = example +INTERFACE = example.i +SWIGOPT = + +all:: java + +java:: + $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' java_cpp + javac *.java + +clean:: + $(MAKE) -f $(TOP)/Makefile java_clean + +check: all diff --git a/Examples/doxygencomments/java/callback/example.cxx b/Examples/doxygencomments/java/callback/example.cxx new file mode 100644 index 000000000..450d75608 --- /dev/null +++ b/Examples/doxygencomments/java/callback/example.cxx @@ -0,0 +1,4 @@ +/* File : example.cxx */ + +#include "example.h" + diff --git a/Examples/doxygencomments/java/callback/example.h b/Examples/doxygencomments/java/callback/example.h new file mode 100644 index 000000000..38ada8b84 --- /dev/null +++ b/Examples/doxygencomments/java/callback/example.h @@ -0,0 +1,24 @@ +/* File : example.h */ + +#include +#include + +/** Let's document class CALLBACK! */ +class Callback { +public: + virtual ~Callback() { std::cout << "Callback::~Callback()" << std:: endl; } + virtual void run() { std::cout << "Callback::run()" << std::endl; } +}; + +/** Let's document class Caller! */ +class Caller { +private: + Callback *_callback; +public: + Caller(): _callback(0) {} + ~Caller() { delCallback(); } + void delCallback() { delete _callback; _callback = 0; } + void setCallback(Callback *cb) { delCallback(); _callback = cb; } + void call() { if (_callback) _callback->run(); } +}; + diff --git a/Examples/doxygencomments/java/callback/example.i b/Examples/doxygencomments/java/callback/example.i new file mode 100644 index 000000000..5dae4e7c1 --- /dev/null +++ b/Examples/doxygencomments/java/callback/example.i @@ -0,0 +1,14 @@ +/* File : example.i */ +/** Let's document module Example! */ +%module(directors="1") example +%{ +#include "example.h" +%} + +%include "std_string.i" + +/* turn on director wrapping Callback */ +%feature("director") Callback; + +%include "example.h" + diff --git a/Examples/doxygencomments/java/callback/index.html b/Examples/doxygencomments/java/callback/index.html new file mode 100644 index 000000000..c25452018 --- /dev/null +++ b/Examples/doxygencomments/java/callback/index.html @@ -0,0 +1,20 @@ + + +SWIG:Examples:java:callback + + + + + +SWIG/Examples/python/extend/ +
+ +

Implementing C++ callbacks in Java

+ +

+This example illustrates how to use directors to implement C++ callbacks in Java. +

+ +
+ + diff --git a/Examples/doxygencomments/java/callback/main.java b/Examples/doxygencomments/java/callback/main.java new file mode 100644 index 000000000..4800f8cc9 --- /dev/null +++ b/Examples/doxygencomments/java/callback/main.java @@ -0,0 +1,56 @@ +public class main +{ + static { + try { + System.loadLibrary("example"); + } catch (UnsatisfiedLinkError e) { + System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e); + System.exit(1); + } + } + + public static void main(String[] args) + { + System.out.println("Adding and calling a normal C++ callback"); + System.out.println("----------------------------------------"); + + Caller caller = new Caller(); + Callback callback = new Callback(); + + caller.setCallback(callback); + caller.call(); + caller.delCallback(); + + callback = new JavaCallback(); + + System.out.println(); + System.out.println("Adding and calling a Java callback"); + System.out.println("------------------------------------"); + + caller.setCallback(callback); + caller.call(); + caller.delCallback(); + + // Test that a double delete does not occur as the object has already been deleted from the C++ layer. + // Note that the garbage collector can also call the delete() method via the finalizer (callback.finalize()) + // at any point after here. + callback.delete(); + + System.out.println(); + System.out.println("java exit"); + } +} + +class JavaCallback extends Callback +{ + public JavaCallback() + { + super(); + } + + public void run() + { + System.out.println("JavaCallback.run()"); + } +} + diff --git a/Examples/doxygencomments/java/check.list b/Examples/doxygencomments/java/check.list new file mode 100644 index 000000000..9728342f2 --- /dev/null +++ b/Examples/doxygencomments/java/check.list @@ -0,0 +1,15 @@ +# see top-level Makefile.in +callback +class +constants +enum +extend +funcptr +multimap +native +pointer +reference +simple +template +typemap +variables diff --git a/Examples/doxygencomments/java/class/Makefile b/Examples/doxygencomments/java/class/Makefile new file mode 100644 index 000000000..14c301703 --- /dev/null +++ b/Examples/doxygencomments/java/class/Makefile @@ -0,0 +1,18 @@ +TOP = ../.. +SWIG = $(TOP)/../preinst-swig +CXXSRCS = example.cxx +TARGET = example +INTERFACE = example.i +SWIGOPT = + +all:: java + +java:: + $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' java_cpp + javac *.java + +clean:: + $(MAKE) -f $(TOP)/Makefile java_clean + +check: all diff --git a/Examples/doxygencomments/java/class/example.cxx b/Examples/doxygencomments/java/class/example.cxx new file mode 100644 index 000000000..1e8e203dd --- /dev/null +++ b/Examples/doxygencomments/java/class/example.cxx @@ -0,0 +1,28 @@ +/* File : example.c */ + +#include "example.h" +#define M_PI 3.14159265358979323846 + +/* Move the shape to a new location */ +void Shape::move(double dx, double dy) { + x += dx; + y += dy; +} + +int Shape::nshapes = 0; + +double Circle::area(void) { + return M_PI*radius*radius; +} + +double Circle::perimeter(void) { + return 2*M_PI*radius; +} + +double Square::area(void) { + return width*width; +} + +double Square::perimeter(void) { + return 4*width; +} diff --git a/Examples/doxygencomments/java/class/example.dsp b/Examples/doxygencomments/java/class/example.dsp new file mode 100644 index 000000000..fbe87e7a4 --- /dev/null +++ b/Examples/doxygencomments/java/class/example.dsp @@ -0,0 +1,162 @@ +# Microsoft Developer Studio Project File - Name="example" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +CFG=example - Win32 Release +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "example.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "example.mak" CFG="example - Win32 Release" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "example - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "example - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "example - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "EXAMPLE_EXPORTS" /YX /FD /GZ /c +# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "$(JAVA_INCLUDE)" /I "$(JAVA_INCLUDE)\win32" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "EXAMPLE_EXPORTS" /YX /FD /GZ /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x809 /d "_DEBUG" +# ADD RSC /l 0x809 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /dll /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /dll /debug /machine:I386 /out:"example.dll" /pdbtype:sept +# Begin Special Build Tool +SOURCE="$(InputPath)" +PostBuild_Desc=Java compile post-build step +PostBuild_Cmds=echo on "%JAVA_BIN%\javac" *.java +# End Special Build Tool + +!ELSEIF "$(CFG)" == "example - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "EXAMPLE_EXPORTS" /YX /FD /c +# ADD CPP /nologo /MT /W3 /GX /O2 /I "$(JAVA_INCLUDE)" /I "$(JAVA_INCLUDE)\win32" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "EXAMPLE_EXPORTS" /YX /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x809 /d "NDEBUG" +# ADD RSC /l 0x809 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /dll /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /dll /machine:I386 /out:"example.dll" +# Begin Special Build Tool +SOURCE="$(InputPath)" +PostBuild_Desc=Java compile post-build step +PostBuild_Cmds=echo on "%JAVA_BIN%\javac" *.java +# End Special Build Tool + +!ENDIF + +# Begin Target + +# Name "example - Win32 Debug" +# Name "example - Win32 Release" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\example.cxx +# End Source File +# Begin Source File + +SOURCE=.\example_wrap.cxx +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=.\example.h +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# End Group +# Begin Source File + +SOURCE=.\example.i + +!IF "$(CFG)" == "example - Win32 Debug" + +# Begin Custom Build +InputPath=.\example.i +InputName=example + +"$(InputName)_wrap.cxx" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + echo In order to function correctly, please ensure the following environment variables are correctly set: + echo JAVA_INCLUDE: %JAVA_INCLUDE% + echo JAVA_BIN: %JAVA_BIN% + echo on + ..\..\..\swig.exe -c++ -java $(InputPath) + +# End Custom Build + +!ELSEIF "$(CFG)" == "example - Win32 Release" + +# Begin Custom Build +InputPath=.\example.i +InputName=example + +"$(InputName)_wrap.cxx" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + echo In order to function correctly, please ensure the following environment variables are correctly set: + echo JAVA_INCLUDE: %JAVA_INCLUDE% + echo JAVA_BIN: %JAVA_BIN% + echo on + ..\..\..\swig.exe -c++ -java $(InputPath) + +# End Custom Build + +!ENDIF + +# End Source File +# End Target +# End Project diff --git a/Examples/doxygencomments/java/class/example.h b/Examples/doxygencomments/java/class/example.h new file mode 100644 index 000000000..7e3e7d540 --- /dev/null +++ b/Examples/doxygencomments/java/class/example.h @@ -0,0 +1,45 @@ +/** \file example.h +comments on example.h */ + +/*! This is describing class Shape + \author Bob + */ + +class Shape { +public: + Shape() { + nshapes++; + } + virtual ~Shape() { + nshapes--; + }; + double x, y; /*!< Important things */ + void move(double dx, double dy); + virtual double area(void) = 0; /*!< \return the area */ + virtual double perimeter(void) = 0; /*!< \return the perimeter */ + static int nshapes; +}; +/*! This is describing class Circle */ +class Circle : public Shape { +private: + double radius; +public: + Circle(double r) : radius(r) { }; + virtual double area(void); + virtual double perimeter(void); +}; + +/*! This is describing class square */ +class Square : public Shape { +private: + double width; +public: + Square(double w) : width(w) { }; + virtual double area(void); + virtual double perimeter(void); +}; + + + + + diff --git a/Examples/doxygencomments/java/class/example.i b/Examples/doxygencomments/java/class/example.i new file mode 100644 index 000000000..05c0ca2ab --- /dev/null +++ b/Examples/doxygencomments/java/class/example.i @@ -0,0 +1,10 @@ +/** File : example.i */ +%module example + +%{ +#include "example.h" +%} + +/* Let's just grab the original header file here */ +%include "example.h" + diff --git a/Examples/doxygencomments/java/class/index.html b/Examples/doxygencomments/java/class/index.html new file mode 100644 index 000000000..e9db7e94a --- /dev/null +++ b/Examples/doxygencomments/java/class/index.html @@ -0,0 +1,197 @@ + + +SWIG:Examples:java:class + + + + + +SWIG/Examples/java/class/ +
+ +

Wrapping a simple C++ class

+ +

+This example illustrates the high level form of C++ class wrapping performed +by SWIG. In this case, a C++ class has a proxy Java class, which +provides access to C++ class members. + +

The C++ Code

+ +Suppose you have some C++ classes described by the following (and admittedly lame) +header file: + +
+
+/* File : example.h */
+
+class Shape {
+public:
+  Shape() {
+    nshapes++;
+  }
+  virtual ~Shape() {
+    nshapes--;
+  };
+  double  x, y;   
+  void    move(double dx, double dy);
+  virtual double area() = 0;
+  virtual double perimeter() = 0;
+  static  int nshapes;
+};
+
+class Circle : public Shape {
+private:
+  double radius;
+public:
+  Circle(double r) : radius(r) { };
+  virtual double area();
+  virtual double perimeter();
+};
+
+class Square : public Shape {
+private:
+  double width;
+public:
+  Square(double w) : width(w) { };
+  virtual double area();
+  virtual double perimeter();
+};
+
+
+ +

The SWIG interface

+ +A simple SWIG interface for this can be built by simply grabbing the header file +like this: + +
+
+/* File : example.i */
+%module example
+
+%{
+#include "example.h"
+%}
+
+/* Let's just grab the original header file here */
+%include "example.h"
+
+
+ +Note: when creating a C++ extension, you must run SWIG with the -c++ option like this: +
+
+% swig -c++ -java example.i
+
+
+ +

A sample Java program

+ +Click here to see a Java program that calls the C++ functions from Java. + +

Key points

+ +
    +
  • To create a new object, you call a constructor like this: + +
    +
    +Circle c = new Circle(10);
    +
    +
    + +

    +

  • To access member data, a pair of accessor functions are used. +For example: + +
    +
    +c.setX(15);        // Set member data
    +x = c.getX();      // Get member data
    +
    +
    + +

    +

  • To invoke a member function, you simply do this + +
    +
    +System.out.println( "The area is " + c.area() );
    +
    +
    + +

    +

  • To invoke a destructor, simply do this + +
    +
    +c.delete();     // Deletes a shape
    +
    +
    + +

    +

  • Static member variables are wrapped with java static get and set access functions. For example: + +
    +
    +n = Shape.getNshapes();     // Get a static data member
    +Shape.setNshapes(13);       // Set a static data member
    +
    +
    + +
+ +

General Comments

+ +
    +
  • This high-level interface using proxy classes is not the only way to handle C++ code. +A low level interface using c functions to access member variables and member functions is the alternative SWIG +approach. This entails passing around the c pointer or c++ 'this' pointer and as such it is not difficult to crash the JVM. +The abstraction of the underlying pointer by the java proxy classes far better fits the java programming paradigm. + +

    +

  • SWIG *does* know how to properly perform upcasting of objects in an inheritance +hierarchy (including multiple inheritance). However Java classes can only derive from one base class so multiple inheritance +is not implemented. Java classes can implement more than one interface so there is scope for improvement in the future. + +

    +

  • A wide variety of C++ features are not currently supported by SWIG. Here is the +short and incomplete list: + +

    +

      +
    • Overloaded methods and functions. SWIG wrappers don't know how to resolve name +conflicts so you must give an alternative name to any overloaded method name using the +%name directive like this: + +
      +
      +void foo(int a);  
      +%name(foo2) void foo(double a, double b);
      +
      +
      + +

      +

    • Overloaded operators. Not supported at all. The only workaround for this is +to write a helper function. For example: + +
      +
      +%inline %{
      +    Vector *vector_add(Vector *a, Vector *b) {
      +          ... whatever ...
      +    }
      +%}
      +
      +
      + +

      +

    • Namespaces. Not supported at all. Won't be supported until SWIG2.0 (if at all). + +
    +
+ +
+ + diff --git a/Examples/doxygencomments/java/class/main.java b/Examples/doxygencomments/java/class/main.java new file mode 100644 index 000000000..8ef35db6d --- /dev/null +++ b/Examples/doxygencomments/java/class/main.java @@ -0,0 +1,70 @@ +// This example illustrates how C++ classes can be used from Java using SWIG. +// The Java class gets mapped onto the C++ class and behaves as if it is a Java class. + +public class main { + static { + try { + System.loadLibrary("example"); + } catch (UnsatisfiedLinkError e) { + System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e); + System.exit(1); + } + } + + public static void main(String argv[]) + { + // ----- Object creation ----- + + System.out.println( "Creating some objects:" ); + Circle c = new Circle(10); + System.out.println( " Created circle " + c ); + Square s = new Square(10); + System.out.println( " Created square " + s ); + + // ----- Access a static member ----- + + System.out.println( "\nA total of " + Shape.getNshapes() + " shapes were created" ); + + // ----- Member data access ----- + + // Notice how we can do this using functions specific to + // the 'Circle' class. + c.setX(20); + c.setY(30); + + // Now use the same functions in the base class + Shape shape = s; + shape.setX(-10); + shape.setY(5); + + System.out.println( "\nHere is their current position:" ); + System.out.println( " Circle = (" + c.getX() + " " + c.getY() + ")" ); + System.out.println( " Square = (" + s.getX() + " " + s.getY() + ")" ); + + // ----- Call some methods ----- + + System.out.println( "\nHere are some properties of the shapes:" ); + Shape[] shapes = {c,s}; + for (int i=0; i + +SWIG:Examples:java:constants + + + + +SWIG/Examples/java/constants/ +
+ +

Wrapping C Constants

+ +

+When SWIG encounters C preprocessor macros and C declarations that look like constants, +it creates Java constant with an identical value. Click here +to see a SWIG interface with some constant declarations in it. + + +

Accessing Constants from Java

+Click here for the section on constants in the SWIG and Java documentation. +

+ +Click here to see a Java program that prints out the values +of the constants contained in the above file.

+

Key points

+
    +
  • The values of preprocessor macros are converted into Java constants. +
  • Types are inferred by syntax (e.g., "3" is an integer and "3.5" is a float). +
  • Character constants such as 'x' are converted into Java strings. +
  • C string literals such as "Hello World" are converted into Java strings. +
  • Macros that are not fully defined are simply ignored. For example: +
    +
    +#define EXTERN extern
    +
    +
    +is ignored because SWIG has no idea what type of variable this would be. + +

    +

  • Expressions are allowed provided that all of their components are defined. Otherwise, the constant is ignored. + +
  • Certain C declarations involving 'const' are also turned into Java constants. +
  • The constants that appear in a SWIG interface file do not have to appear in any sort +of matching C source file since the creation of a constant does not require linkage +to a stored value (i.e., a value held in a C global variable or memory location). +
+ +
+ + + + diff --git a/Examples/doxygencomments/java/constants/main.java b/Examples/doxygencomments/java/constants/main.java new file mode 100644 index 000000000..7130c3d70 --- /dev/null +++ b/Examples/doxygencomments/java/constants/main.java @@ -0,0 +1,44 @@ +import java.lang.reflect.*; + +public class main { + static { + try { + System.loadLibrary("example"); + } catch (UnsatisfiedLinkError e) { + System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e); + System.exit(1); + } + } + + public static void main(String argv[]) + { + System.out.println("ICONST = " + example.ICONST + " (should be 42)"); + System.out.println("FCONST = " + example.FCONST + " (should be 2.1828)"); + System.out.println("CCONST = " + example.CCONST + " (should be 'x')"); + System.out.println("CCONST2 = " + example.CCONST2 + " (this should be on a new line)"); + System.out.println("SCONST = " + example.SCONST + " (should be 'Hello World')"); + System.out.println("SCONST2 = " + example.SCONST2 + " (should be '\"Hello World\"')"); + System.out.println("EXPR = " + example.EXPR + " (should be 48.5484)"); + System.out.println("iconst = " + example.iconst + " (should be 37)"); + System.out.println("fconst = " + example.fconst + " (should be 3.14)"); + +// Use reflection to check if these variables are defined: + try + { + System.out.println("EXTERN = " + example.class.getField("EXTERN") + " (Arg! This shouldn't print anything)"); + } + catch (NoSuchFieldException e) + { + System.out.println("EXTERN isn't defined (good)"); + } + + try + { + System.out.println("FOO = " + example.class.getField("FOO") + " (Arg! This shouldn't print anything)"); + } + catch (NoSuchFieldException e) + { + System.out.println("FOO isn't defined (good)"); + } + } +} diff --git a/Examples/doxygencomments/java/enum/Makefile b/Examples/doxygencomments/java/enum/Makefile new file mode 100644 index 000000000..14c301703 --- /dev/null +++ b/Examples/doxygencomments/java/enum/Makefile @@ -0,0 +1,18 @@ +TOP = ../.. +SWIG = $(TOP)/../preinst-swig +CXXSRCS = example.cxx +TARGET = example +INTERFACE = example.i +SWIGOPT = + +all:: java + +java:: + $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' java_cpp + javac *.java + +clean:: + $(MAKE) -f $(TOP)/Makefile java_clean + +check: all diff --git a/Examples/doxygencomments/java/enum/example.cxx b/Examples/doxygencomments/java/enum/example.cxx new file mode 100644 index 000000000..df7bb6328 --- /dev/null +++ b/Examples/doxygencomments/java/enum/example.cxx @@ -0,0 +1,37 @@ +/* File : example.cxx */ + +#include "example.h" +#include + +void Foo::enum_test(speed s) { + if (s == IMPULSE) { + printf("IMPULSE speed\n"); + } else if (s == WARP) { + printf("WARP speed\n"); + } else if (s == LUDICROUS) { + printf("LUDICROUS speed\n"); + } else { + printf("Unknown speed\n"); + } +} + +void enum_test(color c, Foo::speed s) { + if (c == RED) { + printf("color = RED, "); + } else if (c == BLUE) { + printf("color = BLUE, "); + } else if (c == GREEN) { + printf("color = GREEN, "); + } else { + printf("color = Unknown color!, "); + } + if (s == Foo::IMPULSE) { + printf("speed = IMPULSE speed\n"); + } else if (s == Foo::WARP) { + printf("speed = WARP speed\n"); + } else if (s == Foo::LUDICROUS) { + printf("speed = LUDICROUS speed\n"); + } else { + printf("speed = Unknown speed!\n"); + } +} diff --git a/Examples/doxygencomments/java/enum/example.h b/Examples/doxygencomments/java/enum/example.h new file mode 100644 index 000000000..2142d8240 --- /dev/null +++ b/Examples/doxygencomments/java/enum/example.h @@ -0,0 +1,23 @@ + + +/** This is a block describing enum + */ + +enum color { RED, BLUE, GREEN }; + +/*! This is describing class foo + */ + +class Foo { + public: + Foo() { } + enum speed { IMPULSE=10, WARP=20, LUDICROUS=30 }; + void enum_test(speed s); +}; + +/*! This is describing enum test +//! \param c the color c +//! \param s the speed + */ + +void enum_test(color c, Foo::speed s); diff --git a/Examples/doxygencomments/java/enum/example.i b/Examples/doxygencomments/java/enum/example.i new file mode 100644 index 000000000..1f1f9d526 --- /dev/null +++ b/Examples/doxygencomments/java/enum/example.i @@ -0,0 +1,14 @@ +/** File : example.i */ +%module example + +%{ +#include "example.h" +%} + +/** Force the generated Java code to use the C enum values rather than making a JNI call */ +%javaconst(1); + +/** Let's just grab the original header file here */ + +%include "example.h" + diff --git a/Examples/doxygencomments/java/enum/index.html b/Examples/doxygencomments/java/enum/index.html new file mode 100644 index 000000000..52c06c5d1 --- /dev/null +++ b/Examples/doxygencomments/java/enum/index.html @@ -0,0 +1,29 @@ + + +SWIG:Examples:java:enum + + + + + +SWIG/Examples/java/enum/ +
+ +

Wrapping enumerations

+ +

+This example tests SWIG's ability to wrap enumerations. +SWIG wraps enums in numerous different ways. The default approach is to wrap +each enum with the typesafe enum pattern. Enums are handled as integers in the JNI layer. +See the documentation for the other approaches for wrapping enums. + + +

+ +
+ + diff --git a/Examples/doxygencomments/java/enum/main.java b/Examples/doxygencomments/java/enum/main.java new file mode 100644 index 000000000..8646e0087 --- /dev/null +++ b/Examples/doxygencomments/java/enum/main.java @@ -0,0 +1,38 @@ + +public class main { + static { + try { + System.loadLibrary("example"); + } catch (UnsatisfiedLinkError e) { + System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e); + System.exit(1); + } + } + + public static void main(String argv[]) + { + // Print out the value of some enums + System.out.println("*** color ***"); + System.out.println(" " + color.RED + " = " + color.RED.swigValue()); + System.out.println(" " + color.BLUE + " = " + color.BLUE.swigValue()); + System.out.println(" " + color.GREEN + " = " + color.GREEN.swigValue()); + + System.out.println("\n*** Foo::speed ***"); + System.out.println(" Foo::" + Foo.speed.IMPULSE + " = " + Foo.speed.IMPULSE.swigValue()); + System.out.println(" Foo::" + Foo.speed.WARP + " = " + Foo.speed.WARP.swigValue()); + System.out.println(" Foo::" + Foo.speed.LUDICROUS + " = " + Foo.speed.LUDICROUS.swigValue()); + + System.out.println("\nTesting use of enums with functions\n"); + + example.enum_test(color.RED, Foo.speed.IMPULSE); + example.enum_test(color.BLUE, Foo.speed.WARP); + example.enum_test(color.GREEN, Foo.speed.LUDICROUS); + + System.out.println( "\nTesting use of enum with class method" ); + Foo f = new Foo(); + + f.enum_test(Foo.speed.IMPULSE); + f.enum_test(Foo.speed.WARP); + f.enum_test(Foo.speed.LUDICROUS); + } +} diff --git a/Examples/doxygencomments/java/extend/Makefile b/Examples/doxygencomments/java/extend/Makefile new file mode 100644 index 000000000..14c301703 --- /dev/null +++ b/Examples/doxygencomments/java/extend/Makefile @@ -0,0 +1,18 @@ +TOP = ../.. +SWIG = $(TOP)/../preinst-swig +CXXSRCS = example.cxx +TARGET = example +INTERFACE = example.i +SWIGOPT = + +all:: java + +java:: + $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' java_cpp + javac *.java + +clean:: + $(MAKE) -f $(TOP)/Makefile java_clean + +check: all diff --git a/Examples/doxygencomments/java/extend/example.cxx b/Examples/doxygencomments/java/extend/example.cxx new file mode 100644 index 000000000..450d75608 --- /dev/null +++ b/Examples/doxygencomments/java/extend/example.cxx @@ -0,0 +1,4 @@ +/* File : example.cxx */ + +#include "example.h" + diff --git a/Examples/doxygencomments/java/extend/example.h b/Examples/doxygencomments/java/extend/example.h new file mode 100644 index 000000000..db49ae747 --- /dev/null +++ b/Examples/doxygencomments/java/extend/example.h @@ -0,0 +1,60 @@ +/* File : example.h */ + +#include +#include +#include +#include +#include + +/**This is describiing class Employee */ +class Employee { +private: + std::string name; +public: + /** TEST */ + Employee(const char* n): name(n) {} +/**This is describing method getTitle */ + virtual std::string getTitle() { return getPosition() + " " + getName(); } + virtual std::string getName() { return name; } + virtual std::string getPosition() const { return "Employee"; } + virtual ~Employee() { printf("~Employee() @ %p\n", this); } +}; + +/**This is describing class Manager */ +class Manager: public Employee { +public: + Manager(const char* n): Employee(n) {} + virtual std::string getPosition() const { return "Manager"; } +}; + + +class EmployeeList { + std::vector list; +public: + EmployeeList() { + list.push_back(new Employee("Bob")); + list.push_back(new Employee("Jane")); + list.push_back(new Manager("Ted")); + } + void addEmployee(Employee *p) { + list.push_back(p); + std::cout << "New employee added. Current employees are:" << std::endl; + std::vector::iterator i; + for (i=list.begin(); i!=list.end(); i++) { + std::cout << " " << (*i)->getTitle() << std::endl; + } + } +/**This is describing class get item */ + const Employee *get_item(int i) { + return list[i]; + } + ~EmployeeList() { + std::vector::iterator i; + std::cout << "~EmployeeList, deleting " << list.size() << " employees." << std::endl; + for (i=list.begin(); i!=list.end(); i++) { + delete *i; + } + std::cout << "~EmployeeList empty." << std::endl; + } +}; + diff --git a/Examples/doxygencomments/java/extend/example.i b/Examples/doxygencomments/java/extend/example.i new file mode 100644 index 000000000..c8ec32e09 --- /dev/null +++ b/Examples/doxygencomments/java/extend/example.i @@ -0,0 +1,15 @@ +/* File : example.i */ +%module(directors="1") example +%{ +#include "example.h" +%} + +%include "std_vector.i" +%include "std_string.i" + +/* turn on director wrapping for Manager */ +%feature("director") Employee; +%feature("director") Manager; + +%include "example.h" + diff --git a/Examples/doxygencomments/java/extend/index.html b/Examples/doxygencomments/java/extend/index.html new file mode 100644 index 000000000..c7c2c127d --- /dev/null +++ b/Examples/doxygencomments/java/extend/index.html @@ -0,0 +1,19 @@ + + +SWIG:Examples:java:extend + + + + + +SWIG/Examples/java/extend/ +
+ +

Extending a simple C++ class in Java

+ +

+This example illustrates the extending of a C++ class with cross language polymorphism. + +


+ + diff --git a/Examples/doxygencomments/java/extend/main.java b/Examples/doxygencomments/java/extend/main.java new file mode 100644 index 000000000..ee3a94ed0 --- /dev/null +++ b/Examples/doxygencomments/java/extend/main.java @@ -0,0 +1,88 @@ +// This file illustrates the cross language polymorphism using directors. + + +// CEO class, which overrides Employee::getPosition(). + +class CEO extends Manager { + public CEO(String name) { + super(name); + } + public String getPosition() { + return "CEO"; + } + // Public method to stop the SWIG proxy base class from thinking it owns the underlying C++ memory. + public void disownMemory() { + swigCMemOwn = false; + } +} + + +public class main { + static { + try { + System.loadLibrary("example"); + } catch (UnsatisfiedLinkError e) { + System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e); + System.exit(1); + } + } + + public static void main(String argv[]) + { + + // Create an instance of CEO, a class derived from the Java proxy of the + // underlying C++ class. The calls to getName() and getPosition() are standard, + // the call to getTitle() uses the director wrappers to call CEO.getPosition(). + + CEO e = new CEO("Alice"); + System.out.println( e.getName() + " is a " + e.getPosition() ); + System.out.println( "Just call her \"" + e.getTitle() + "\"" ); + System.out.println( "----------------------" ); + + + // Create a new EmployeeList instance. This class does not have a C++ + // director wrapper, but can be used freely with other classes that do. + + EmployeeList list = new EmployeeList(); + + // EmployeeList owns its items, so we must surrender ownership of objects we add. + e.disownMemory(); + list.addEmployee(e); + System.out.println( "----------------------" ); + + // Now we access the first four items in list (three are C++ objects that + // EmployeeList's constructor adds, the last is our CEO). The virtual + // methods of all these instances are treated the same. For items 0, 1, and + // 2, all methods resolve in C++. For item 3, our CEO, getTitle calls + // getPosition which resolves in Java. The call to getPosition is + // slightly different, however, because of the overidden getPosition() call, since + // now the object reference has been "laundered" by passing through + // EmployeeList as an Employee*. Previously, Java resolved the call + // immediately in CEO, but now Java thinks the object is an instance of + // class Employee. So the call passes through the + // Employee proxy class and on to the C wrappers and C++ director, + // eventually ending up back at the Java CEO implementation of getPosition(). + // The call to getTitle() for item 3 runs the C++ Employee::getTitle() + // method, which in turn calls getPosition(). This virtual method call + // passes down through the C++ director class to the Java implementation + // in CEO. All this routing takes place transparently. + + System.out.println( "(position, title) for items 0-3:" ); + + System.out.println( " " + list.get_item(0).getPosition() + ", \"" + list.get_item(0).getTitle() + "\"" ); + System.out.println( " " + list.get_item(1).getPosition() + ", \"" + list.get_item(1).getTitle() + "\"" ); + System.out.println( " " + list.get_item(2).getPosition() + ", \"" + list.get_item(2).getTitle() + "\"" ); + System.out.println( " " + list.get_item(3).getPosition() + ", \"" + list.get_item(3).getTitle() + "\"" ); + System.out.println( "----------------------" ); + + // Time to delete the EmployeeList, which will delete all the Employee* + // items it contains. The last item is our CEO, which gets destroyed as well. + list.delete(); + System.out.println( "----------------------" ); + + // All done. + + System.out.println( "java exit" ); + + } +} diff --git a/Examples/doxygencomments/java/funcptr/Makefile b/Examples/doxygencomments/java/funcptr/Makefile new file mode 100644 index 000000000..968c92c6c --- /dev/null +++ b/Examples/doxygencomments/java/funcptr/Makefile @@ -0,0 +1,18 @@ +TOP = ../.. +SWIG = $(TOP)/../preinst-swig +SRCS = example.c +TARGET = example +INTERFACE = example.i +SWIGOPT = + +all:: java + +java:: + $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' java + javac *.java + +clean:: + $(MAKE) -f $(TOP)/Makefile java_clean + +check: all diff --git a/Examples/doxygencomments/java/funcptr/example.c b/Examples/doxygencomments/java/funcptr/example.c new file mode 100644 index 000000000..5c4a3dabf --- /dev/null +++ b/Examples/doxygencomments/java/funcptr/example.c @@ -0,0 +1,19 @@ +/* File : example.c */ + +int do_op(int a, int b, int (*op)(int,int)) { + return (*op)(a,b); +} + +int add(int a, int b) { + return a+b; +} + +int sub(int a, int b) { + return a-b; +} + +int mul(int a, int b) { + return a*b; +} + +int (*funcvar)(int,int) = add; diff --git a/Examples/doxygencomments/java/funcptr/example.h b/Examples/doxygencomments/java/funcptr/example.h new file mode 100644 index 000000000..5285737a3 --- /dev/null +++ b/Examples/doxygencomments/java/funcptr/example.h @@ -0,0 +1,10 @@ +/* file: example.h */ + +extern int do_op(int,int, int (*op)(int,int)); +/*! Describing function add */ +extern int add(int,int); +extern int sub(int,int); +extern int mul(int,int); + +extern int (*funcvar)(int,int); + diff --git a/Examples/doxygencomments/java/funcptr/example.i b/Examples/doxygencomments/java/funcptr/example.i new file mode 100644 index 000000000..82c3c2201 --- /dev/null +++ b/Examples/doxygencomments/java/funcptr/example.i @@ -0,0 +1,16 @@ +/* File : example.i */ +%module example +%{ +#include "example.h" +%} + +/** Wrap a function taking a pointer to a function */ +extern int do_op(int a, int b, int (*op)(int, int)); + +/** Now install a bunch of "ops" as constants */ +%constant int (*ADD)(int,int) = add; +%constant int (*SUB)(int,int) = sub; +%constant int (*MUL)(int,int) = mul; + +extern int (*funcvar)(int,int); + diff --git a/Examples/doxygencomments/java/funcptr/index.html b/Examples/doxygencomments/java/funcptr/index.html new file mode 100644 index 000000000..0ad2be1cf --- /dev/null +++ b/Examples/doxygencomments/java/funcptr/index.html @@ -0,0 +1,91 @@ + + +SWIG:Examples:java:funcptr + + + + + +SWIG/Examples/java/funcptr/ +
+ +

Pointers to Functions

+ +

+Okay, just what in the heck does SWIG do with a declaration like this? + +

+
+int do_op(int a, int b, int (*op)(int, int));
+
+
+ +Well, it creates a wrapper as usual. Of course, that does raise some +questions about the third argument (the pointer to a function). + +

+In this case, SWIG will wrap the function pointer as it does for all other +pointers. However, in order to actually call this function from a Java program, +you will need to pass some kind of C function pointer object. In C, +this is easy, you just supply a function name as an argument like this: + +

+
+/* Some callback function */
+int add(int a, int b) {
+   return a+b;
+} 
+...
+int r = do_op(x,y,add);
+
+
+ +To make this work with SWIG, you will need to do a little extra work. Specifically, +you need to create some function pointer objects using the %constant directive like this: + +
+
+%constant(int (*)(int,int)) ADD = add;
+
+
+ +Now, in a Java program, you would do this: + +
+
+int r = do_op(x,y, example.ADD)
+
+
+where example is the module name. + +

An Example

+ +Here are some files that illustrate this with a simple example: + + + +

Notes

+ +
    +
  • The value of a function pointer must correspond to a function written in C or C++. +It is not possible to pass an arbitrary Java function in as a substitute for a C +function pointer. + +

    +

  • A Java function can be used as a C/C++ callback if you write some +clever typemaps and are very careful about how you create your extension. +This is an advanced topic not covered here. +
+ +
+ + + + + + diff --git a/Examples/doxygencomments/java/funcptr/main.java b/Examples/doxygencomments/java/funcptr/main.java new file mode 100644 index 000000000..cf81f92b4 --- /dev/null +++ b/Examples/doxygencomments/java/funcptr/main.java @@ -0,0 +1,33 @@ + +public class main { + + static { + try { + System.loadLibrary("example"); + } catch (UnsatisfiedLinkError e) { + System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e); + System.exit(1); + } + } + + public static void main(String argv[]) { + + + int a = 37; + int b = 42; + + // Now call our C function with a bunch of callbacks + + System.out.println( "Trying some C callback functions" ); + System.out.println( " a = " + a ); + System.out.println( " b = " + b ); + System.out.println( " ADD(a,b) = " + example.do_op(a,b,example.ADD) ); + System.out.println( " SUB(a,b) = " + example.do_op(a,b,example.SUB) ); + System.out.println( " MUL(a,b) = " + example.do_op(a,b,example.MUL) ); + + System.out.println( "Here is what the C callback function classes are called in Java" ); + System.out.println( " ADD = " + example.ADD.getClass().getName() ); + System.out.println( " SUB = " + example.SUB.getClass().getName() ); + System.out.println( " MUL = " + example.MUL.getClass().getName() ); + } +} diff --git a/Examples/doxygencomments/java/index.html b/Examples/doxygencomments/java/index.html new file mode 100644 index 000000000..d98f9a393 --- /dev/null +++ b/Examples/doxygencomments/java/index.html @@ -0,0 +1,65 @@ + + +SWIG:Examples:java + + + +

SWIG Java Examples

+ +

+The following examples illustrate the use of SWIG with Java. + +

    +
  • simple. A minimal example showing how SWIG can +be used to wrap a C function, a global variable, and a constant. +
  • native. Comparing the manual and the SWIG approach to calling native code. +
  • typemap. Modifying the Java module's default behaviour by using typemaps. +
  • constants. This shows how preprocessor macros and +certain C declarations are turned into constants. +
  • variables. An example showing how to access C global variables. +
  • enum. Wrapping enumerations. +
  • class. How to wrap a simple C++ class. +
  • reference. C++ references. +
  • pointer. Simple pointer handling. +
  • template. C++ templates. +
  • funcptr. Pointers to functions. +
  • callback. C++ callbacks using directors. +
  • extend. Polymorphism using directors. +
+ +

Running the examples

+Please see the Windows page in the main manual for information on using the examples on Windows.

+ +On Unix most of the examples work by making the Makefile before executing the program main.java. The Makefile will output the swig generated JNI c code as well as the Java wrapper classes. Additionally the JNI c/c++ code is compiled into the shared object (dynamic link library) which is needed for dynamic linking to the native code. The Makefiles also compile the Java files using javac. +

+Ensure that the dynamic link library file is in the appropriate path before executing the Java program. For example in Unix, libexample.so must be in the LD_LIBRARY_PATH. +

+A Unix example: +

+
+$ make
+$ export LD_LIBRARY_PATH=. #ksh 
+$ java main
+
+
+

+ + + +

Compatibility

+ +The examples have been extensively tested on the following platforms: + +
    +
  • Solaris +
  • Linux +
  • Cygwin +
  • Windows +
+ +Your mileage may vary. If you experience a problem, please let us know by +contacting us on the mailing lists. + + + + diff --git a/Examples/doxygencomments/java/multimap/Makefile b/Examples/doxygencomments/java/multimap/Makefile new file mode 100644 index 000000000..968c92c6c --- /dev/null +++ b/Examples/doxygencomments/java/multimap/Makefile @@ -0,0 +1,18 @@ +TOP = ../.. +SWIG = $(TOP)/../preinst-swig +SRCS = example.c +TARGET = example +INTERFACE = example.i +SWIGOPT = + +all:: java + +java:: + $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' java + javac *.java + +clean:: + $(MAKE) -f $(TOP)/Makefile java_clean + +check: all diff --git a/Examples/doxygencomments/java/multimap/example.c b/Examples/doxygencomments/java/multimap/example.c new file mode 100644 index 000000000..b8360fa8a --- /dev/null +++ b/Examples/doxygencomments/java/multimap/example.c @@ -0,0 +1,53 @@ +/* File : example.c */ +#include +#include +#include + +/* Compute the greatest common divisor of positive integers */ +int gcd(int x, int y) { + int g; + g = y; + while (x > 0) { + g = x; + x = y % x; + y = g; + } + return g; +} + +int gcdmain(int argc, char *argv[]) { + int x,y; + if (argc != 3) { + printf("usage: gcd x y\n"); + return -1; + } + x = atoi(argv[1]); + y = atoi(argv[2]); + printf("gcd(%d,%d) = %d\n", x,y,gcd(x,y)); + return 0; +} + +int count(char *bytes, int len, char c) { + int i; + int count = 0; + for (i = 0; i < len; i++) { + if (bytes[i] == c) count++; + } + return count; +} + +void capitalize(char *str, int len) { + int i; + for (i = 0; i < len; i++) { + str[i] = (char)toupper(str[i]); + } +} + +void circle(double x, double y) { + double a = x*x + y*y; + if (a > 1.0) { + printf("Bad points %g, %g\n", x,y); + } else { + printf("Good points %g, %g\n", x,y); + } +} diff --git a/Examples/doxygencomments/java/multimap/example.dsp b/Examples/doxygencomments/java/multimap/example.dsp new file mode 100644 index 000000000..8e1f8415e --- /dev/null +++ b/Examples/doxygencomments/java/multimap/example.dsp @@ -0,0 +1,158 @@ +# Microsoft Developer Studio Project File - Name="example" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +CFG=example - Win32 Release +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "example.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "example.mak" CFG="example - Win32 Release" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "example - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "example - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "example - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "EXAMPLE_EXPORTS" /YX /FD /GZ /c +# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "$(JAVA_INCLUDE)" /I "$(JAVA_INCLUDE)\win32" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "EXAMPLE_EXPORTS" /YX /FD /GZ /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x809 /d "_DEBUG" +# ADD RSC /l 0x809 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /dll /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /dll /debug /machine:I386 /out:"example.dll" /pdbtype:sept +# Begin Special Build Tool +SOURCE="$(InputPath)" +PostBuild_Desc=Java compile post-build step +PostBuild_Cmds=echo on "%JAVA_BIN%\javac" *.java +# End Special Build Tool + +!ELSEIF "$(CFG)" == "example - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "EXAMPLE_EXPORTS" /YX /FD /c +# ADD CPP /nologo /MT /W3 /GX /O2 /I "$(JAVA_INCLUDE)" /I "$(JAVA_INCLUDE)\win32" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "EXAMPLE_EXPORTS" /YX /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x809 /d "NDEBUG" +# ADD RSC /l 0x809 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /dll /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /dll /machine:I386 /out:"example.dll" +# Begin Special Build Tool +SOURCE="$(InputPath)" +PostBuild_Desc=Java compile post-build step +PostBuild_Cmds=echo on "%JAVA_BIN%\javac" *.java +# End Special Build Tool + +!ENDIF + +# Begin Target + +# Name "example - Win32 Debug" +# Name "example - Win32 Release" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\example.c +# End Source File +# Begin Source File + +SOURCE=.\example_wrap.c +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# End Group +# Begin Source File + +SOURCE=.\example.i + +!IF "$(CFG)" == "example - Win32 Debug" + +# Begin Custom Build +InputPath=.\example.i +InputName=example + +"$(InputName)_wrap.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + echo In order to function correctly, please ensure the following environment variables are correctly set: + echo JAVA_INCLUDE: %JAVA_INCLUDE% + echo JAVA_BIN: %JAVA_BIN% + echo on + ..\..\..\swig.exe -java $(InputPath) + +# End Custom Build + +!ELSEIF "$(CFG)" == "example - Win32 Release" + +# Begin Custom Build +InputPath=.\example.i +InputName=example + +"$(InputName)_wrap.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + echo In order to function correctly, please ensure the following environment variables are correctly set: + echo JAVA_INCLUDE: %JAVA_INCLUDE% + echo JAVA_BIN: %JAVA_BIN% + echo on + ..\..\..\swig.exe -java $(InputPath) + +# End Custom Build + +!ENDIF + +# End Source File +# End Target +# End Project diff --git a/Examples/doxygencomments/java/multimap/example.i b/Examples/doxygencomments/java/multimap/example.i new file mode 100644 index 000000000..8d67282a5 --- /dev/null +++ b/Examples/doxygencomments/java/multimap/example.i @@ -0,0 +1,109 @@ +/* File : example.i */ +%module example + +%{ +extern int gcd(int x, int y); +extern int gcdmain(int argc, char *argv[]); +extern int count(char *bytes, int len, char c); +extern void capitalize (char *str, int len); +extern void circle (double cx, double cy); +extern int squareCubed (int n, int *OUTPUT); +%} + +extern int gcd(int x, int y); + +%typemap(jni) (int argc, char *argv[]) "jobjectArray" +%typemap(jtype) (int argc, char *argv[]) "String[]" +%typemap(jstype) (int argc, char *argv[]) "String[]" + +%typemap(javain) (int argc, char *argv[]) "$javainput" + +%typemap(in) (int argc, char *argv[]) (jstring *jsarray) { +int i; + + $1 = (*jenv)->GetArrayLength(jenv, $input); + if ($1 == 0) { + SWIG_JavaThrowException(jenv, SWIG_JavaIndexOutOfBoundsException, "Array must contain at least 1 element"); + return $null; + } + $2 = (char **) malloc(($1+1)*sizeof(char *)); + jsarray = (jstring *) malloc($1*sizeof(jstring)); + for (i = 0; i < $1; i++) { + jsarray[i] = (jstring) (*jenv)->GetObjectArrayElement(jenv, $input, i); + $2[i] = (char *) (*jenv)->GetStringUTFChars(jenv, jsarray[i], 0); + } + $2[i] = 0; +} + +%typemap(argout) (int argc, char *argv[]) "" /* override char *[] default */ + +%typemap(freearg) (int argc, char *argv[]) { +int i; + for (i = 0; i < $1; i++) { + (*jenv)->ReleaseStringUTFChars(jenv, jsarray$argnum[i], $2[i]); + } + free($2); +} + +extern int gcdmain(int argc, char *argv[]); + +%typemap(jni) (char *bytes, int len) "jstring" +%typemap(jtype) (char *bytes, int len) "String" +%typemap(jstype) (char *bytes, int len) "String" + +%typemap(javain) (char *bytes, int len) "$javainput" + +%typemap(in) (char *bytes, int len) { + $1 = ($1_type)(*jenv)->GetStringUTFChars(jenv, $input, 0); + $2 = (*jenv)->GetStringUTFLength(jenv, $input); +} + +%typemap(freearg) (char *bytes, int len) %{ + (*jenv)->ReleaseStringUTFChars(jenv, $input, $1); +%} + +extern int count(char *bytes, int len, char c); + +/* This example shows how to wrap a function that mutates a c string. A one + * element Java string array is used so that the string can be returned modified.*/ + +%typemap(jni) (char *str, int len) "jobjectArray" +%typemap(jtype) (char *str, int len) "String[]" +%typemap(jstype) (char *str, int len) "String[]" + +%typemap(javain) (char *str, int len) "$javainput" + +%typemap(in) (char *str, int len) (jstring js) { + int index = 0; + js = (jstring) (*jenv)->GetObjectArrayElement(jenv, $input, index); + $1 = (char *) (*jenv)->GetStringUTFChars(jenv, js, 0); + $2 = (*jenv)->GetStringUTFLength(jenv, js); +} + +/* Return the mutated string as a modified element in the array. */ +%typemap(argout) (char *str, int len) { + jstring newstring = (*jenv)->NewStringUTF(jenv, $1); + (*jenv)->SetObjectArrayElement(jenv, $input, 0, newstring); +} + +/* Release memory */ +%typemap(freearg) (char *str, int len) { + (*jenv)->ReleaseStringUTFChars(jenv, js$argnum, $1); +} + +extern void capitalize(char *str, int len); + +/* A multi-valued constraint. Force two arguments to lie + inside the unit circle */ + +%typemap(check) (double cx, double cy) { + double a = $1*$1 + $2*$2; + if (a > 1.0) { + SWIG_JavaThrowException(jenv, SWIG_JavaIllegalArgumentException, "$1_name and $2_name must be in unit circle"); + return; + } +} + +extern void circle(double cx, double cy); + + diff --git a/Examples/doxygencomments/java/multimap/main.java b/Examples/doxygencomments/java/multimap/main.java new file mode 100644 index 000000000..331ac6b89 --- /dev/null +++ b/Examples/doxygencomments/java/multimap/main.java @@ -0,0 +1,40 @@ + +public class main { + + static { + try { + System.loadLibrary("example"); + } catch (UnsatisfiedLinkError e) { + System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e); + System.exit(1); + } + } + + public static void main(String argv[]) { + + // Call our gcd() function + int x = 42; + int y = 105; + int g = example.gcd(x,y); + System.out.println("The gcd of " + x + " and " + y + " is " + g); + + // Call the gcdmain() function + String[] args = {"gcdmain","42","105"}; + example.gcdmain(args); + + // Call the count function + System.out.println(example.count("Hello World", 'l')); + + // Call the capitalize function + String[] capitalizeMe = {"hello world"}; + example.capitalize(capitalizeMe); + System.out.println(capitalizeMe[0]); + } +} + + + + + + + diff --git a/Examples/doxygencomments/java/native/Makefile b/Examples/doxygencomments/java/native/Makefile new file mode 100644 index 000000000..92afbd4d0 --- /dev/null +++ b/Examples/doxygencomments/java/native/Makefile @@ -0,0 +1,18 @@ +TOP = ../.. +SWIG = $(TOP)/../preinst-swig +SRCS = +TARGET = example +INTERFACE = example.i +SWIGOPT = + +all:: java + +java:: + $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' java + javac *.java + +clean:: + $(MAKE) -f $(TOP)/Makefile java_clean + +check: all diff --git a/Examples/doxygencomments/java/native/example.i b/Examples/doxygencomments/java/native/example.i new file mode 100644 index 000000000..851b6fdc2 --- /dev/null +++ b/Examples/doxygencomments/java/native/example.i @@ -0,0 +1,56 @@ +/* File : example.i */ +%module example + +%{ +#include + +typedef struct point { + int x; + int y; +} Point; + + +Point *point_create(int x, int y) { + Point *p = (Point *) malloc(sizeof(Point)); + p->x = x; + p->y = y; + + return p; +} + +static char *point_toString(char *format, Point *p) { + static char buf[80]; + + sprintf(buf, format, p->x, p->y); + + return buf; +} + +/* this function will be wrapped by SWIG */ +char *point_toString1(Point *p) { + return point_toString("(%d,%d)", p); +} + +/* this one we wrapped manually*/ +JNIEXPORT jstring JNICALL Java_exampleJNI_point_1toString2(JNIEnv *jenv, jclass jcls, jlong jpoint) { + Point * p; + jstring result; + + (void)jcls; + + p = *(Point **)&jpoint; + + result = (*jenv)->NewStringUTF(jenv, point_toString("[%d,%d]", p)); + + return result; +} +%} + + +Point *point_create(int x, int y); +char *point_toString1(Point *p); + +/* give access to free() for memory cleanup of the malloc'd Point */ +extern void free(void *memblock); + +%native(point_toString2) char *point_toString2(Point *p); diff --git a/Examples/doxygencomments/java/native/index.html b/Examples/doxygencomments/java/native/index.html new file mode 100644 index 000000000..7ecf129ce --- /dev/null +++ b/Examples/doxygencomments/java/native/index.html @@ -0,0 +1,33 @@ + + +SWIG:Examples:java:native + + + + + +SWIG/Examples/java/native/ +
+ +

SWIG wrapped and manually wrapped functions in Java

+ +Click here for the relevant section in the SWIG and Java documentation. +

+This example compares wrapping a c global function using the manual way and the SWIG way. +

+ +
    +
  • example.i. Interface file comparing code wrapped by SWIG and wrapped manually. +
  • main.java. Sample Java program showing calls to both manually wrapped and SWIG wrapped c functions. +
+ +

Notes

+ +
    +
  • SWIG writes all the awkward JNI code for you. You just have to tell SWIG which functions to wrap. +
  • If memory is allocated in c it needs to be free'd. A function, such as free(), can be provided with access from Java to free the memory. +
+ +
+ + diff --git a/Examples/doxygencomments/java/native/main.java b/Examples/doxygencomments/java/native/main.java new file mode 100644 index 000000000..f4760bb3d --- /dev/null +++ b/Examples/doxygencomments/java/native/main.java @@ -0,0 +1,19 @@ + +public class main { + + static { + try { + System.loadLibrary("example"); + } catch (UnsatisfiedLinkError e) { + System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e); + System.exit(1); + } + } + + public static void main(String argv[]) { + SWIGTYPE_p_Point p = example.point_create(1, 2); + System.out.println("auto wrapped : " + example.point_toString1(p)); + System.out.println("manual wrapped: " + example.point_toString2(p)); + example.free(new SWIGTYPE_p_void(SWIGTYPE_p_Point.getCPtr(p), false)); //clean up c allocated memory + } +} diff --git a/Examples/doxygencomments/java/pointer/Makefile b/Examples/doxygencomments/java/pointer/Makefile new file mode 100644 index 000000000..968c92c6c --- /dev/null +++ b/Examples/doxygencomments/java/pointer/Makefile @@ -0,0 +1,18 @@ +TOP = ../.. +SWIG = $(TOP)/../preinst-swig +SRCS = example.c +TARGET = example +INTERFACE = example.i +SWIGOPT = + +all:: java + +java:: + $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' java + javac *.java + +clean:: + $(MAKE) -f $(TOP)/Makefile java_clean + +check: all diff --git a/Examples/doxygencomments/java/pointer/example.c b/Examples/doxygencomments/java/pointer/example.c new file mode 100644 index 000000000..b877d9a5b --- /dev/null +++ b/Examples/doxygencomments/java/pointer/example.c @@ -0,0 +1,16 @@ +/* File : example.c */ + +void add(int *x, int *y, int *result) { + *result = *x + *y; +} + +void sub(int *x, int *y, int *result) { + *result = *x - *y; +} + +int divide(int n, int d, int *r) { + int q; + q = n/d; + *r = n - q*d; + return q; +} diff --git a/Examples/doxygencomments/java/pointer/example.i b/Examples/doxygencomments/java/pointer/example.i new file mode 100644 index 000000000..a8ac79499 --- /dev/null +++ b/Examples/doxygencomments/java/pointer/example.i @@ -0,0 +1,30 @@ +/* File : example.i */ +%module example + +%{ +extern void add(int *, int *, int *); +extern void sub(int *, int *, int *); +extern int divide(int, int, int *); +%} + +/* This example illustrates a couple of different techniques + for manipulating C pointers */ + +/* First we'll use the pointer library */ +extern void add(int *x, int *y, int *result); +%include cpointer.i +%pointer_functions(int, intp); + +/* Next we'll use some typemaps */ + +%include typemaps.i +extern void sub(int *INPUT, int *INPUT, int *OUTPUT); + +/* Next we'll use typemaps and the %apply directive */ + +%apply int *OUTPUT { int *r }; +extern int divide(int n, int d, int *r); + + + + diff --git a/Examples/doxygencomments/java/pointer/index.html b/Examples/doxygencomments/java/pointer/index.html new file mode 100644 index 000000000..c30d549e6 --- /dev/null +++ b/Examples/doxygencomments/java/pointer/index.html @@ -0,0 +1,165 @@ + + +SWIG:Examples:java:pointer + + + + +SWIG/Examples/java/pointer/ +
+ +

Simple Pointer Handling

+ +

+This example illustrates a couple of techniques for handling +simple pointers in SWIG. The prototypical example is a C function +that operates on pointers such as this: + +

+
+void add(int *x, int *y, int *r) { 
+    *r = *x + *y;
+}
+
+
+ +By default, SWIG wraps this function exactly as specified and creates +an interface that expects pointer objects for arguments. +SWIG wraps a C pointer with a type wrapper class, for example, SWIGTYPE_p_int for an int*. +The only problem is how does one go about creating these objects from a Java program? +

+ + +

Possible Solutions

+ +
    +
  • Write some helper functions to explicitly create objects. For +example: + +
    +
    +int *new_int(int ivalue) {
    +  int *i = (int *) malloc(sizeof(ivalue));
    +  *i = ivalue;
    +  return i;
    +}
    +int get_int(int *i) {
    +  return *i;
    +}
    +
    +void delete_int(int *i) {
    +  free(i);
    +}
    +
    +
    + +

    +

  • The SWIG pointer library provides an easier way.
    +For example, in the interface file +you would do this: + +
    +
    +%include cpointer.i
    +%pointer_functions(int, intp);
    +
    +
    + +and from Java you would use pointers like this: + +
    +
    +SWIGTYPE_p_int a = example.new_intp();
    +SWIGTYPE_p_int b = example.new_intp();
    +SWIGTYPE_p_int c = example.new_intp();
    +example.intp_assign(a,37);
    +example.intp_assign(b,42);
    +
    +// Note that getCPtr() has package access by default
    +System.out.println("     a =" + Long.toHexString(SWIGTYPE_p_int.getCPtr(a)));
    +System.out.println("     b =" + Long.toHexString(SWIGTYPE_p_int.getCPtr(b)));
    +System.out.println("     c =" + Long.toHexString(SWIGTYPE_p_int.getCPtr(c)));
    +
    +// Call the add() function with some pointers
    +example.add(a,b,c);
    +
    +// Now get the result
    +int res = example.intp_value(c);
    +System.out.println("     37 + 42 =" + res);
    +
    +// Clean up the pointers
    +example.delete_intp(a);
    +example.delete_intp(b);
    +example.delete_intp(c);
    +
    +
    + +

    +

  • Use the SWIG typemap library. This library allows you to completely +change the way arguments are processed by SWIG. For example: + +
    +
    +%include "typemaps.i"
    +void add(int *INPUT, int *INPUT, int *OUTPUT);
    +
    +
    + +And in a Java program: + +
    +
    +int[] r = {0};
    +example.sub(37,42,r);
    +System.out.println("Result =" + r[0]);
    +
    +
    +Needless to say, this is substantially easier although a bit unusual. + +

    +

  • A final alternative is to use the typemaps library in combination +with the %apply directive. This allows you to change the names of parameters +that behave as input or output parameters. For example: + +
    +
    +%include "typemaps.i"
    +%apply int *INPUT {int *x, int *y};
    +%apply int *OUTPUT {int *r};
    +
    +void add(int *x, int *y, int *r);
    +void sub(int *x, int *y, int *r);
    +void mul(int *x, int *y, int *r);
    +... etc ...
    +
    +
    + +
+ +

Example

+ +The following example illustrates the use of these features for pointer +extraction. + + + +

Notes

+ +
    +
  • Since pointers are used for so many different things (arrays, output values, +etc...) the complexity of pointer handling can be as complicated as you want to +make it. + +

    +

  • More documentation on the typemaps.i and cpointer.i library files can be +found in the SWIG user manual. The files also contain documentation. + +
+ +
+ + diff --git a/Examples/doxygencomments/java/pointer/main.java b/Examples/doxygencomments/java/pointer/main.java new file mode 100644 index 000000000..e96e02eaa --- /dev/null +++ b/Examples/doxygencomments/java/pointer/main.java @@ -0,0 +1,55 @@ + +public class main { + + static { + try { + System.loadLibrary("example"); + } catch (UnsatisfiedLinkError e) { + System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e); + System.exit(1); + } + } + + public static void main(String argv[]) { + + // First create some objects using the pointer library. + System.out.println("Testing the pointer library"); + SWIGTYPE_p_int a = example.new_intp(); + SWIGTYPE_p_int b = example.new_intp(); + SWIGTYPE_p_int c = example.new_intp(); + example.intp_assign(a,37); + example.intp_assign(b,42); + + // Note that getCPtr() has package access by default + System.out.println(" a =" + Long.toHexString(SWIGTYPE_p_int.getCPtr(a))); + System.out.println(" b =" + Long.toHexString(SWIGTYPE_p_int.getCPtr(b))); + System.out.println(" c =" + Long.toHexString(SWIGTYPE_p_int.getCPtr(c))); + + // Call the add() function with some pointers + example.add(a,b,c); + + // Now get the result + int res = example.intp_value(c); + System.out.println(" 37 + 42 =" + res); + + // Clean up the pointers + example.delete_intp(a); + example.delete_intp(b); + example.delete_intp(c); + + // Now try the typemap library + // Now it is no longer necessary to manufacture pointers. + // Instead we use a single element array which in Java is modifiable. + + System.out.println("Trying the typemap library"); + int[] r = {0}; + example.sub(37,42,r); + System.out.println(" 37 - 42 = " + r[0]); + + // Now try the version with return value + + System.out.println("Testing return value"); + int q = example.divide(42,37,r); + System.out.println(" 42/37 = " + q + " remainder " + r[0]); + } +} diff --git a/Examples/doxygencomments/java/reference/Makefile b/Examples/doxygencomments/java/reference/Makefile new file mode 100644 index 000000000..14c301703 --- /dev/null +++ b/Examples/doxygencomments/java/reference/Makefile @@ -0,0 +1,18 @@ +TOP = ../.. +SWIG = $(TOP)/../preinst-swig +CXXSRCS = example.cxx +TARGET = example +INTERFACE = example.i +SWIGOPT = + +all:: java + +java:: + $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' java_cpp + javac *.java + +clean:: + $(MAKE) -f $(TOP)/Makefile java_clean + +check: all diff --git a/Examples/doxygencomments/java/reference/example.cxx b/Examples/doxygencomments/java/reference/example.cxx new file mode 100644 index 000000000..8a513bf49 --- /dev/null +++ b/Examples/doxygencomments/java/reference/example.cxx @@ -0,0 +1,46 @@ +/* File : example.cxx */ + +/* Deal with Microsoft's attempt at deprecating C standard runtime functions */ +#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) +# define _CRT_SECURE_NO_DEPRECATE +#endif + +#include "example.h" +#include +#include + +Vector operator+(const Vector &a, const Vector &b) { + Vector r; + r.x = a.x + b.x; + r.y = a.y + b.y; + r.z = a.z + b.z; + return r; +} + +char *Vector::print() { + static char temp[512]; + sprintf(temp,"Vector %p (%g,%g,%g)", this, x,y,z); + return temp; +} + +VectorArray::VectorArray(int size) { + items = new Vector[size]; + maxsize = size; +} + +VectorArray::~VectorArray() { + delete [] items; +} + +Vector &VectorArray::operator[](int index) { + if ((index < 0) || (index >= maxsize)) { + printf("Panic! Array index out of bounds.\n"); + exit(1); + } + return items[index]; +} + +int VectorArray::size() { + return maxsize; +} + diff --git a/Examples/doxygencomments/java/reference/example.h b/Examples/doxygencomments/java/reference/example.h new file mode 100644 index 000000000..4915adb1b --- /dev/null +++ b/Examples/doxygencomments/java/reference/example.h @@ -0,0 +1,26 @@ +/* File : example.h */ + +class Vector { +private: + double x,y,z; +public: + Vector() : x(0), y(0), z(0) { }; + Vector(double x, double y, double z) : x(x), y(y), z(z) { }; + friend Vector operator+(const Vector &a, const Vector &b); + char *print(); +}; + +class VectorArray { +private: + Vector *items; + int maxsize; +public: + VectorArray(int maxsize); + ~VectorArray(); + Vector &operator[](int); + int size(); +}; + + + + diff --git a/Examples/doxygencomments/java/reference/example.i b/Examples/doxygencomments/java/reference/example.i new file mode 100644 index 000000000..6daa3b1f4 --- /dev/null +++ b/Examples/doxygencomments/java/reference/example.i @@ -0,0 +1,46 @@ +/* File : example.i */ + +/* This file has a few "typical" uses of C++ references. */ + +%module example + +%{ +#include "example.h" +%} + +class Vector { +public: + Vector(double x, double y, double z); + ~Vector(); + char *print(); +}; + +/* This helper function calls an overloaded operator */ +%inline %{ +Vector addv(Vector &a, Vector &b) { + return a+b; +} +%} + +/* Wrapper around an array of vectors class */ + +class VectorArray { +public: + VectorArray(int maxsize); + ~VectorArray(); + int size(); + + /* This wrapper provides an alternative to the [] operator */ + %extend { + Vector &get(int index) { + return (*$self)[index]; + } + void set(int index, Vector &a) { + (*$self)[index] = a; + } + } +}; + + + + diff --git a/Examples/doxygencomments/java/reference/index.html b/Examples/doxygencomments/java/reference/index.html new file mode 100644 index 000000000..64b129cbb --- /dev/null +++ b/Examples/doxygencomments/java/reference/index.html @@ -0,0 +1,147 @@ + + +SWIG:Examples:java:reference + + + + + +SWIG/Examples/java/reference/ +
+ +

C++ Reference Handling

+ +

+This example tests SWIG's handling of C++ references. Since C++ +references are closely related to pointers (as both refer to a +location in memory), SWIG simply collapses all references into +pointers when creating wrappers. + +

Some examples

+ +References are most commonly used as function parameter. For example, +you might have an operator like this: + +
+
+Vector operator+(const Vector &a, const Vector &b) {
+   Vector result;
+   result.x = a.x + b.x;
+   result.y = a.y + b.y;
+   result.z = a.z + b.z;
+   return result;
+}
+
+
+ +or a function: + +
+
+Vector addv(const Vector &a, const Vector &b) {
+   Vector result;
+   result.x = a.x + b.x;
+   result.y = a.y + b.y;
+   result.z = a.z + b.z;
+   return result;
+}
+
+
+ +In these cases, SWIG transforms everything into a pointer and creates a wrapper +that looks like this: + +
+
+Vector wrap_addv(Vector *a, Vector *b) {
+    return addv(*a,*b);
+}
+
+
+ +Occasionally, a reference is used as a return value of a function +when the return result is to be used as an lvalue in an expression. +The prototypical example is an operator like this: + +
+
+Vector &operator[](int index);
+
+
+ +or a method: + +
+
+Vector &get(int index);
+
+
+ +For functions returning references, a wrapper like this is created: + +
+
+Vector *wrap_Object_get(Object *self, int index) {
+    Vector &result = self->get(index);
+    return &result;
+}
+
+
+ +The following header file contains some class +definitions with some operators and use of references. + +

SWIG Interface

+ +SWIG does NOT support overloaded operators so it can not directly build +an interface to the classes in the above file. However, a number of workarounds +can be made. For example, an overloaded operator can be stuck behind a function +call such as the addv() function above. Array access can be handled +with a pair of set/get functions like this: + +
+
+class VectorArray {
+public:
+ ...
+   %addmethods {
+    Vector &get(int index) {
+      return (*self)[index];
+    }
+    void set(int index, Vector &a) {
+      (*self)[index] = a;
+    }
+   }
+   ...
+}
+
+
+ +Click here to see a SWIG interface file with these additions. + +

Sample Java program

+ +Click here to see a Java program that manipulates some C++ references. + +

Notes:

+ +
    +
  • C++ references primarily provide notational convenience for C++ +source code. However, Java only supports the 'x.a' +notation so it doesn't much matter. + +

    +

  • When a program returns a reference, a pointer is returned. +Unlike return by value, memory is not allocated to hold the +return result. + +

    +

  • SWIG has particular trouble handling various combinations of references +and pointers. This is side effect of an old parsing scheme and +type representation that will be replaced in future versions. + +
+ +
+ + diff --git a/Examples/doxygencomments/java/reference/main.java b/Examples/doxygencomments/java/reference/main.java new file mode 100644 index 000000000..4fd354761 --- /dev/null +++ b/Examples/doxygencomments/java/reference/main.java @@ -0,0 +1,79 @@ +// This example illustrates the manipulation of C++ references in Java. + +public class main { + static { + try { + System.loadLibrary("example"); + } catch (UnsatisfiedLinkError e) { + System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e); + System.exit(1); + } + } + + public static void main(String argv[]) + { + System.out.println( "Creating some objects:" ); + Vector a = new Vector(3,4,5); + Vector b = new Vector(10,11,12); + + System.out.println( " Created " + a.print() ); + System.out.println( " Created " + b.print() ); + + // ----- Call an overloaded operator ----- + + // This calls the wrapper we placed around + // + // operator+(const Vector &a, const Vector &) + // + // It returns a new allocated object. + + System.out.println( "Adding a+b" ); + Vector c = example.addv(a,b); + System.out.println( " a+b = " + c.print() ); + + // Note: Unless we free the result, a memory leak will occur if the -noproxy commandline + // is used as the proxy classes define finalizers which call the delete() method. When + // -noproxy is not specified the memory management is controlled by the garbage collector. + // You can still call delete(). It will free the c++ memory immediately, but not the + // Java memory! You then must be careful not to call any member functions as it will + // use a NULL c pointer on the underlying c++ object. We set the Java object to null + // which will then throw a Java exception should we attempt to use it again. + c.delete(); + c = null; + + // ----- Create a vector array ----- + + System.out.println( "Creating an array of vectors" ); + VectorArray va = new VectorArray(10); + System.out.println( " va = " + va.toString() ); + + // ----- Set some values in the array ----- + + // These operators copy the value of Vector a and Vector b to the vector array + va.set(0,a); + va.set(1,b); + + // This works, but it would cause a memory leak if -noproxy was used! + + va.set(2,example.addv(a,b)); + + + // Get some values from the array + + System.out.println( "Getting some array values" ); + for (int i=0; i<5; i++) + System.out.println( " va(" + i + ") = " + va.get(i).print() ); + + // Watch under resource meter to check on this + System.out.println( "Making sure we don't leak memory." ); + for (int i=0; i<1000000; i++) + c = va.get(i%10); + + // ----- Clean up ----- + // This could be omitted. The garbage collector would then clean up for us. + System.out.println( "Cleaning up" ); + va.delete(); + a.delete(); + b.delete(); + } +} diff --git a/Examples/doxygencomments/java/simple/Makefile b/Examples/doxygencomments/java/simple/Makefile new file mode 100644 index 000000000..968c92c6c --- /dev/null +++ b/Examples/doxygencomments/java/simple/Makefile @@ -0,0 +1,18 @@ +TOP = ../.. +SWIG = $(TOP)/../preinst-swig +SRCS = example.c +TARGET = example +INTERFACE = example.i +SWIGOPT = + +all:: java + +java:: + $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' java + javac *.java + +clean:: + $(MAKE) -f $(TOP)/Makefile java_clean + +check: all diff --git a/Examples/doxygencomments/java/simple/example.c b/Examples/doxygencomments/java/simple/example.c new file mode 100644 index 000000000..1c2af789c --- /dev/null +++ b/Examples/doxygencomments/java/simple/example.c @@ -0,0 +1,18 @@ +/* File : example.c */ + +/* A global variable */ +double Foo = 3.0; + +/* Compute the greatest common divisor of positive integers */ +int gcd(int x, int y) { + int g; + g = y; + while (x > 0) { + g = x; + x = y % x; + y = g; + } + return g; +} + + diff --git a/Examples/doxygencomments/java/simple/example.dsp b/Examples/doxygencomments/java/simple/example.dsp new file mode 100644 index 000000000..8e1f8415e --- /dev/null +++ b/Examples/doxygencomments/java/simple/example.dsp @@ -0,0 +1,158 @@ +# Microsoft Developer Studio Project File - Name="example" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +CFG=example - Win32 Release +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "example.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "example.mak" CFG="example - Win32 Release" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "example - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "example - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "example - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "EXAMPLE_EXPORTS" /YX /FD /GZ /c +# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "$(JAVA_INCLUDE)" /I "$(JAVA_INCLUDE)\win32" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "EXAMPLE_EXPORTS" /YX /FD /GZ /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x809 /d "_DEBUG" +# ADD RSC /l 0x809 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /dll /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /dll /debug /machine:I386 /out:"example.dll" /pdbtype:sept +# Begin Special Build Tool +SOURCE="$(InputPath)" +PostBuild_Desc=Java compile post-build step +PostBuild_Cmds=echo on "%JAVA_BIN%\javac" *.java +# End Special Build Tool + +!ELSEIF "$(CFG)" == "example - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "EXAMPLE_EXPORTS" /YX /FD /c +# ADD CPP /nologo /MT /W3 /GX /O2 /I "$(JAVA_INCLUDE)" /I "$(JAVA_INCLUDE)\win32" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "EXAMPLE_EXPORTS" /YX /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x809 /d "NDEBUG" +# ADD RSC /l 0x809 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /dll /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /dll /machine:I386 /out:"example.dll" +# Begin Special Build Tool +SOURCE="$(InputPath)" +PostBuild_Desc=Java compile post-build step +PostBuild_Cmds=echo on "%JAVA_BIN%\javac" *.java +# End Special Build Tool + +!ENDIF + +# Begin Target + +# Name "example - Win32 Debug" +# Name "example - Win32 Release" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\example.c +# End Source File +# Begin Source File + +SOURCE=.\example_wrap.c +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# End Group +# Begin Source File + +SOURCE=.\example.i + +!IF "$(CFG)" == "example - Win32 Debug" + +# Begin Custom Build +InputPath=.\example.i +InputName=example + +"$(InputName)_wrap.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + echo In order to function correctly, please ensure the following environment variables are correctly set: + echo JAVA_INCLUDE: %JAVA_INCLUDE% + echo JAVA_BIN: %JAVA_BIN% + echo on + ..\..\..\swig.exe -java $(InputPath) + +# End Custom Build + +!ELSEIF "$(CFG)" == "example - Win32 Release" + +# Begin Custom Build +InputPath=.\example.i +InputName=example + +"$(InputName)_wrap.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + echo In order to function correctly, please ensure the following environment variables are correctly set: + echo JAVA_INCLUDE: %JAVA_INCLUDE% + echo JAVA_BIN: %JAVA_BIN% + echo on + ..\..\..\swig.exe -java $(InputPath) + +# End Custom Build + +!ENDIF + +# End Source File +# End Target +# End Project diff --git a/Examples/doxygencomments/java/simple/example.i b/Examples/doxygencomments/java/simple/example.i new file mode 100644 index 000000000..24093b9bf --- /dev/null +++ b/Examples/doxygencomments/java/simple/example.i @@ -0,0 +1,7 @@ +/* File : example.i */ +%module example + +%inline %{ +extern int gcd(int x, int y); +extern double Foo; +%} diff --git a/Examples/doxygencomments/java/simple/index.html b/Examples/doxygencomments/java/simple/index.html new file mode 100644 index 000000000..a363327fe --- /dev/null +++ b/Examples/doxygencomments/java/simple/index.html @@ -0,0 +1,108 @@ + + +SWIG:Examples:java:simple + + + + + +SWIG/Examples/java/simple/ +
+ +

Simple Java Example

+ +

+This example illustrates how you can hook Java to a very simple C program containing +a function and a global variable. + +

The C Code

+ +Suppose you have the following C code: + +
+
+/* File : example.c */
+
+/* A global variable */
+double Foo = 3.0;
+
+/* Compute the greatest common divisor of positive integers */
+int gcd(int x, int y) {
+  int g;
+  g = y;
+  while (x > 0) {
+    g = x;
+    x = y % x;
+    y = g;
+  }
+  return g;
+}
+
+
+ +

The SWIG interface

+ +Here is a simple SWIG interface file: + +
+
+/* File: example.i */
+%module example
+
+extern int gcd(int x, int y);
+extern double Foo;
+
+
+ +

Compilation

+ +
    +
  1. swig -java example.i +

    +

  2. Compile example_wrap.c and example.c +to create the extension libexample.so (unix). +
+ +

Using the extension

+ +Click here to see a program that calls our C functions from Java. +

+Compile the java files example.java and main.java +to create the class files example.class and main.class before running main in the JVM. Ensure that the libexample.so file is in your LD_LIBRARY_PATH before running. For example: +

+
+export LD_LIBRARY_PATH=. #ksh 
+javac *.java
+java main
+
+
+ +

Key points

+ +
    +
  • Use the loadLibrary statement from java to load and access the generated java classes. For example: +
    +
    +System.loadLibrary("example");
    +
    +
    + +
  • C functions work just like Java functions. For example: +
    +
    +int g = example.gcd(42,105);
    +
    +
    + +
  • C global variables are accessed through get and set functions in the module class. For example: +
    +
    +double a = example.get_Foo();
    +example.set_Foo(20.0);
    +
    +
    +
+ +
+ + diff --git a/Examples/doxygencomments/java/simple/main.java b/Examples/doxygencomments/java/simple/main.java new file mode 100644 index 000000000..6d224a4dc --- /dev/null +++ b/Examples/doxygencomments/java/simple/main.java @@ -0,0 +1,32 @@ + +public class main { + + static { + try { + System.loadLibrary("example"); + } catch (UnsatisfiedLinkError e) { + System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e); + System.exit(1); + } + } + + public static void main(String argv[]) { + // Call our gcd() function + + int x = 42; + int y = 105; + int g = example.gcd(x,y); + System.out.println("The gcd of " + x + " and " + y + " is " + g); + + // Manipulate the Foo global variable + + // Output its current value + System.out.println("Foo = " + example.getFoo()); + + // Change its value + example.setFoo(3.1415926); + + // See if the change took effect + System.out.println("Foo = " + example.getFoo()); + } +} diff --git a/Examples/doxygencomments/java/template/Makefile b/Examples/doxygencomments/java/template/Makefile new file mode 100644 index 000000000..2b3d35c6a --- /dev/null +++ b/Examples/doxygencomments/java/template/Makefile @@ -0,0 +1,18 @@ +TOP = ../.. +SWIG = $(TOP)/../preinst-swig +CXXSRCS = +TARGET = example +INTERFACE = example.i +SWIGOPT = + +all:: java + +java:: + $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' java_cpp + javac *.java + +clean:: + $(MAKE) -f $(TOP)/Makefile java_clean + +check: all diff --git a/Examples/doxygencomments/java/template/example.h b/Examples/doxygencomments/java/template/example.h new file mode 100644 index 000000000..7401df650 --- /dev/null +++ b/Examples/doxygencomments/java/template/example.h @@ -0,0 +1,32 @@ +/* File : example.h */ + +// Some template definitions + +template T max(T a, T b) { return a>b ? a : b; } + +template class vector { + T *v; + int sz; + public: + vector(int _sz) { + v = new T[_sz]; + sz = _sz; + } + T &get(int index) { + return v[index]; + } + void set(int index, T &val) { + v[index] = val; + } +#ifdef SWIG + %extend { + T getitem(int index) { + return $self->get(index); + } + void setitem(int index, T val) { + $self->set(index,val); + } + } +#endif +}; + diff --git a/Examples/doxygencomments/java/template/example.i b/Examples/doxygencomments/java/template/example.i new file mode 100644 index 000000000..8f94c4da1 --- /dev/null +++ b/Examples/doxygencomments/java/template/example.i @@ -0,0 +1,17 @@ +/* File : example.i */ +%module example + +%{ +#include "example.h" +%} + +/* Let's just grab the original header file here */ +%include "example.h" + +/* Now instantiate some specific template declarations */ + +%template(maxint) max; +%template(maxdouble) max; +%template(vecint) vector; +%template(vecdouble) vector; + diff --git a/Examples/doxygencomments/java/template/index.html b/Examples/doxygencomments/java/template/index.html new file mode 100644 index 000000000..1aebd4c2a --- /dev/null +++ b/Examples/doxygencomments/java/template/index.html @@ -0,0 +1,102 @@ + + +SWIG:Examples:java:template + + + + + +SWIG/Examples/java/template/ +
+ +

C++ template support

+ +

+This example illustrates how C++ templates can be used from Java using SWIG. + +

The C++ Code

+ +Lets take a templated function and a templated class as follows: + +
+
+/* File : example.h */
+
+// Some template definitions
+
+template T max(T a, T b) { return  a>b ? a : b; }
+
+template class vector {
+  T *v;
+  int sz;
+ public:
+  vector(int _sz) {
+    v = new T[_sz];
+    sz = _sz;
+  }
+  T &get(int index) {
+    return v[index];
+  }
+  void set(int index, T &val) {
+    v[index] = val;
+  }
+#ifdef SWIG
+  %addmethods {
+    T getitem(int index) {
+      return self->get(index);
+    }
+    void setitem(int index, T val) {
+      self->set(index,val);
+    }
+  }
+#endif
+};
+
+
+The %addmethods is used for a neater interface from Java as the functions get and set use C++ references to primitive types. These are tricky to use from Java as they end up as a pointer in Java (Java long). + +

The SWIG interface

+ +A simple SWIG interface for this can be built by simply grabbing the header file +like this: + +
+
+/* File : example.i */
+%module example
+
+%{
+#include "example.h"
+%}
+
+/* Let's just grab the original header file here */
+%include "example.h"
+
+/* Now instantiate some specific template declarations */
+
+%template(maxint) max;
+%template(maxdouble) max;
+%template(vecint) vector;
+%template(vecdouble) vector;
+
+
+ +Note that SWIG parses the templated function max and templated class vector and so knows about them. However to generate code for use from Java, SWIG has to be told which class/type to use as the template parameter. The SWIG directive %template is used for this. + +

A sample Java program

+ +Click here to see a Java program that calls the C++ functions from Java. + +

Notes

+Use templated classes just like you would any other SWIG generated Java class. Use the classnames specified by the %template directive. + +
+
+vecdouble dv = new vecdouble(1000);
+dv.setitem(i, 12.34));
+
+
+ +
+ + diff --git a/Examples/doxygencomments/java/template/main.java b/Examples/doxygencomments/java/template/main.java new file mode 100644 index 000000000..9129fcf2a --- /dev/null +++ b/Examples/doxygencomments/java/template/main.java @@ -0,0 +1,45 @@ +// This example illustrates how C++ templates can be used from Java. + +public class main { + static { + try { + System.loadLibrary("example"); + } catch (UnsatisfiedLinkError e) { + System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e); + System.exit(1); + } + } + + public static void main(String argv[]) + { + // Call some templated functions + System.out.println(example.maxint(3,7)); + System.out.println(example.maxdouble(3.14,2.18)); + + // Create some class + + vecint iv = new vecint(100); + vecdouble dv = new vecdouble(1000); + + for (int i=0; i<100; i++) + iv.setitem(i,2*i); + + for (int i=0; i<1000; i++) + dv.setitem(i, 1.0/(i+1)); + + { + int sum = 0; + for (int i=0; i<100; i++) + sum = sum + iv.getitem(i); + + System.out.println(sum); + } + + { + double sum = 0.0; + for (int i=0; i<1000; i++) + sum = sum + dv.getitem(i); + System.out.println(sum); + } + } +} diff --git a/Examples/doxygencomments/java/typemap/Makefile b/Examples/doxygencomments/java/typemap/Makefile new file mode 100644 index 000000000..92afbd4d0 --- /dev/null +++ b/Examples/doxygencomments/java/typemap/Makefile @@ -0,0 +1,18 @@ +TOP = ../.. +SWIG = $(TOP)/../preinst-swig +SRCS = +TARGET = example +INTERFACE = example.i +SWIGOPT = + +all:: java + +java:: + $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' java + javac *.java + +clean:: + $(MAKE) -f $(TOP)/Makefile java_clean + +check: all diff --git a/Examples/doxygencomments/java/typemap/example.i b/Examples/doxygencomments/java/typemap/example.i new file mode 100644 index 000000000..7c97e6673 --- /dev/null +++ b/Examples/doxygencomments/java/typemap/example.i @@ -0,0 +1,101 @@ +/* File : example.i */ +%module example +%{ +/* + example of a function that returns a value in the char * argument + normally used like: + + char buf[bigenough]; + f1(buf); +*/ + +void f1(char *s) { + if(s != NULL) { + sprintf(s, "hello world"); + } +} + +void f2(char *s) { + f1(s); +} + +void f3(char *s) { + f1(s); +} + +%} + +/* default behaviour is that of input arg, Java cannot return a value in a + * string argument, so any changes made by f1(char*) will not be seen in the Java + * string passed to the f1 function. +*/ +void f1(char *s); + +%include various.i + +/* use the BYTE argout typemap to get around this. Changes in the string by + * f2 can be seen in Java. */ +void f2(char *BYTE); + + + +/* Alternative approach uses a StringBuffer typemap for argout */ + +/* Define the types to use in the generated JNI C code and Java code */ +%typemap(jni) char *SBUF "jobject" +%typemap(jtype) char *SBUF "StringBuffer" +%typemap(jstype) char *SBUF "StringBuffer" + +/* How to convert Java(JNI) type to requested C type */ +%typemap(in) char *SBUF { + + $1 = NULL; + if($input != NULL) { + /* Get the String from the StringBuffer */ + jmethodID setLengthID; + jclass sbufClass = (*jenv)->GetObjectClass(jenv, $input); + jmethodID toStringID = (*jenv)->GetMethodID(jenv, sbufClass, "toString", "()Ljava/lang/String;"); + jstring js = (jstring) (*jenv)->CallObjectMethod(jenv, $input, toStringID); + + /* Convert the String to a C string */ + const char *pCharStr = (*jenv)->GetStringUTFChars(jenv, js, 0); + + /* Take a copy of the C string as the typemap is for a non const C string */ + jmethodID capacityID = (*jenv)->GetMethodID(jenv, sbufClass, "capacity", "()I"); + jint capacity = (*jenv)->CallIntMethod(jenv, $input, capacityID); + $1 = (char *) malloc(capacity+1); + strcpy($1, pCharStr); + + /* Release the UTF string we obtained with GetStringUTFChars */ + (*jenv)->ReleaseStringUTFChars(jenv, js, pCharStr); + + /* Zero the original StringBuffer, so we can replace it with the result */ + setLengthID = (*jenv)->GetMethodID(jenv, sbufClass, "setLength", "(I)V"); + (*jenv)->CallVoidMethod(jenv, $input, setLengthID, (jint) 0); + } +} + +/* How to convert the C type to the Java(JNI) type */ +%typemap(argout) char *SBUF { + + if($1 != NULL) { + /* Append the result to the empty StringBuffer */ + jstring newString = (*jenv)->NewStringUTF(jenv, $1); + jclass sbufClass = (*jenv)->GetObjectClass(jenv, $input); + jmethodID appendStringID = (*jenv)->GetMethodID(jenv, sbufClass, "append", "(Ljava/lang/String;)Ljava/lang/StringBuffer;"); + (*jenv)->CallObjectMethod(jenv, $input, appendStringID, newString); + + /* Clean up the string object, no longer needed */ + free($1); + $1 = NULL; + } +} +/* Prevent the default freearg typemap from being used */ +%typemap(freearg) char *SBUF "" + +/* Convert the jstype to jtype typemap type */ +%typemap(javain) char *SBUF "$javainput" + +/* apply the new typemap to our function */ +void f3(char *SBUF); + diff --git a/Examples/doxygencomments/java/typemap/index.html b/Examples/doxygencomments/java/typemap/index.html new file mode 100644 index 000000000..486aa8e79 --- /dev/null +++ b/Examples/doxygencomments/java/typemap/index.html @@ -0,0 +1,32 @@ + + +SWIG:Examples:java:typemap + + + + + +SWIG/Examples/java/typemap/ +
+ +

Typemaps in Java

+ +

+This example shows how typemaps can be used to modify the default behaviour of the Java SWIG module. + +

+ +

Notes

+ +
    +
  • Shows how to pass strings to Java from c and visa versa. +
  • Typemaps can modify the default behaviour of the Java SWIG module. +
  • The default c to java mapping can be modified using typemaps. +
+ +
+ + diff --git a/Examples/doxygencomments/java/typemap/main.java b/Examples/doxygencomments/java/typemap/main.java new file mode 100644 index 000000000..bd9a4e1b6 --- /dev/null +++ b/Examples/doxygencomments/java/typemap/main.java @@ -0,0 +1,26 @@ + +public class main { + + static { + try { + System.loadLibrary("example"); + } catch (UnsatisfiedLinkError e) { + System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e); + System.exit(1); + } + } + + public static void main(String argv[]) { + String s = "brave new world"; + example.f1(s); + System.out.println("f1(String): " + s); + + byte b[] = new byte[25]; + example.f2(b); + System.out.println("f2(byte[]): " + new String(b)); + + StringBuffer sb = new StringBuffer(20); + example.f3(sb); + System.out.println("f3(StringBuffer): " + sb); + } +} diff --git a/Examples/doxygencomments/java/variables/Makefile b/Examples/doxygencomments/java/variables/Makefile new file mode 100644 index 000000000..968c92c6c --- /dev/null +++ b/Examples/doxygencomments/java/variables/Makefile @@ -0,0 +1,18 @@ +TOP = ../.. +SWIG = $(TOP)/../preinst-swig +SRCS = example.c +TARGET = example +INTERFACE = example.i +SWIGOPT = + +all:: java + +java:: + $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' java + javac *.java + +clean:: + $(MAKE) -f $(TOP)/Makefile java_clean + +check: all diff --git a/Examples/doxygencomments/java/variables/example.c b/Examples/doxygencomments/java/variables/example.c new file mode 100644 index 000000000..aa4ffe9b3 --- /dev/null +++ b/Examples/doxygencomments/java/variables/example.c @@ -0,0 +1,91 @@ +/* File : example.c */ + +/* I'm a file containing some C global variables */ + +/* Deal with Microsoft's attempt at deprecating C standard runtime functions */ +#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) +# define _CRT_SECURE_NO_DEPRECATE +#endif + +#include +#include +#include "example.h" + +int ivar = 0; +short svar = 0; +long lvar = 0; +unsigned int uivar = 0; +unsigned short usvar = 0; +unsigned long ulvar = 0; +signed char scvar = 0; +unsigned char ucvar = 0; +char cvar = 0; +float fvar = 0; +double dvar = 0; +char *strvar = 0; +const char cstrvar[] = "Goodbye"; +int *iptrvar = 0; +char name[256] = "Dave"; +char path[256] = "/home/beazley"; + + +/* Global variables involving a structure */ +Point *ptptr = 0; +Point pt = { 10, 20 }; + +/* A variable that we will make read-only in the interface */ +int status = 1; + +/* A debugging function to print out their values */ + +void print_vars() { + printf("ivar = %d\n", ivar); + printf("svar = %d\n", svar); + printf("lvar = %ld\n", lvar); + printf("uivar = %u\n", uivar); + printf("usvar = %u\n", usvar); + printf("ulvar = %lu\n", ulvar); + printf("scvar = %d\n", scvar); + printf("ucvar = %u\n", ucvar); + printf("fvar = %g\n", fvar); + printf("dvar = %g\n", dvar); + printf("cvar = %c\n", cvar); + printf("strvar = %s\n", strvar ? strvar : "(null)"); + printf("cstrvar = %s\n", cstrvar ? cstrvar : "(null)"); + printf("iptrvar = %p\n", iptrvar); + printf("name = %s\n", name); + printf("ptptr = %p (%d, %d)\n", ptptr, ptptr ? ptptr->x : 0, ptptr ? ptptr->y : 0); + printf("pt = (%d, %d)\n", pt.x, pt.y); + printf("status = %d\n", status); +} + +/* A function to create an integer (to test iptrvar) */ + +int *new_int(int value) { + int *ip = (int *) malloc(sizeof(int)); + *ip = value; + return ip; +} + +/* A function to create a point */ + +Point *new_Point(int x, int y) { + Point *p = (Point *) malloc(sizeof(Point)); + p->x = x; + p->y = y; + return p; +} + +char * Point_print(Point *p) { + static char buffer[256]; + if (p) { + sprintf(buffer,"(%d,%d)", p->x,p->y); + } else { + sprintf(buffer,"null"); + } + return buffer; +} + +void pt_print() { + printf("(%d, %d)\n", pt.x, pt.y); +} diff --git a/Examples/doxygencomments/java/variables/example.h b/Examples/doxygencomments/java/variables/example.h new file mode 100644 index 000000000..0f7e89594 --- /dev/null +++ b/Examples/doxygencomments/java/variables/example.h @@ -0,0 +1,6 @@ +/* File: example.h */ + +typedef struct { + int x,y; +} Point; + diff --git a/Examples/doxygencomments/java/variables/example.i b/Examples/doxygencomments/java/variables/example.i new file mode 100644 index 000000000..591b871ed --- /dev/null +++ b/Examples/doxygencomments/java/variables/example.i @@ -0,0 +1,49 @@ +/* File : example.i */ +%module example +%{ +#include "example.h" +%} + +/* Some global variable declarations */ +%inline %{ +extern int ivar; +extern short svar; +extern long lvar; +extern unsigned int uivar; +extern unsigned short usvar; +extern unsigned long ulvar; +extern signed char scvar; +extern unsigned char ucvar; +extern char cvar; +extern float fvar; +extern double dvar; +extern char *strvar; +extern const char cstrvar[]; +extern int *iptrvar; +extern char name[256]; + +extern Point *ptptr; +extern Point pt; +%} + + +/* Some read-only variables */ + +%immutable; + +%inline %{ +extern int status; +extern char path[256]; +%} + +%mutable; + +/* Some helper functions to make it easier to test */ +%inline %{ +extern void print_vars(); +extern int *new_int(int value); +extern Point *new_Point(int x, int y); +extern char *Point_print(Point *p); +extern void pt_print(); +%} + diff --git a/Examples/doxygencomments/java/variables/index.html b/Examples/doxygencomments/java/variables/index.html new file mode 100644 index 000000000..05aaa2d6e --- /dev/null +++ b/Examples/doxygencomments/java/variables/index.html @@ -0,0 +1,85 @@ + + +SWIG:Examples:java:variables + + + + +SWIG/Examples/java/variables/ +
+ +

Wrapping C Global Variables

+ +

+When a C global variable appears in an interface file, SWIG tries to +wrap it using a technique known as "variable linking." The idea is +pretty simple---we try to create a Java variable that magically +retrieves or updates the value of the underlying C variable when it is +accessed. Click here to see a SWIG interface with some variable +declarations in it. + + +

Click here for the section on global variables in the SWIG and Java documentation.

+

Manipulating Variables from Java

+ +C variables are accessed through getters and setters from Java. Unfortunately this is the only way to get current values from variables because it is not possible to overload the dot operator in Java. All global variables are accessible from the module class. For example if the module class is called 'example', the global variable + +
+
+double foo;
+
+
+ +will be accessed in the Java module as +
+
+example.get_foo();
+example.set_foo(12.3);
+
+
+ +Click here to see the example program that updates and prints +out the values of the variables using this technique. + +

Key points

+ +
    +
  • When a global variable has the type "char *", SWIG manages it as a character +string. However, whenever the value of such a variable is set from Java, the old +value is destroyed using free() or delete (the choice of which depends +on whether or not SWIG was run with the -c++ option). +
  • signed char and unsigned char are handled as small 8-bit integers. +
  • String array variables such as 'char name[256]' are managed as Java strings, but +when setting the value, the result is truncated to the maximum length of the array. Furthermore, the string is assumed to be null-terminated. +
  • When structures and classes are used as global variables, they are mapped into pointers. +Getting the "value" returns a pointer to the global variable. Setting the value of a structure results in a memory copy from a pointer to the global. +
+ +

Creating read-only variables

+ +The %immutable and %mutable directives can be used to +specify a collection of read-only variables. For example: + +
+
+%immutable;
+int    status;
+double blah;
+...
+%mutable;
+
+
+ +The %immutable directive remains in effect until it is explicitly disabled +using the %mutable directive. + +

Comments

+
    +
  • Management of global variables is one of the most problematic aspects +of C/C++ wrapping because the Java interface and resulting memory management +is much trickier than simply creating a wrapper function. +
+ + + +
diff --git a/Examples/doxygencomments/java/variables/main.java b/Examples/doxygencomments/java/variables/main.java new file mode 100644 index 000000000..92745db99 --- /dev/null +++ b/Examples/doxygencomments/java/variables/main.java @@ -0,0 +1,97 @@ +// This example illustrates global variable access from Java. + +import java.lang.reflect.*; + +public class main { + static { + try { + System.loadLibrary("example"); + } catch (UnsatisfiedLinkError e) { + System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e); + System.exit(1); + } + } + + public static void main(String argv[]) { + +// Try to set the values of some global variables + + example.setIvar(42); + example.setSvar((short)-31000); + example.setLvar(65537); + example.setUivar(123456); + example.setUsvar(61000); + example.setUlvar(654321); + example.setScvar((byte)-13); + example.setUcvar((short)251); + example.setCvar('S'); + example.setFvar((float)3.14159); + example.setDvar(2.1828); + example.setStrvar("Hello World"); + example.setIptrvar(example.new_int(37)); + example.setPtptr(example.new_Point(37,42)); + example.setName("Bill"); + + // Now print out the values of the variables + + System.out.println( "Variables (values printed from Java)" ); + + System.out.println( "ivar =" + example.getIvar() ); + System.out.println( "svar =" + example.getSvar() ); + System.out.println( "lvar =" + example.getLvar() ); + System.out.println( "uivar =" + example.getUivar() ); + System.out.println( "usvar =" + example.getUsvar() ); + System.out.println( "ulvar =" + example.getUlvar() ); + System.out.println( "scvar =" + example.getScvar() ); + System.out.println( "ucvar =" + example.getUcvar() ); + System.out.println( "fvar =" + example.getFvar() ); + System.out.println( "dvar =" + example.getDvar() ); + System.out.println( "cvar =" + (char)example.getCvar() ); + System.out.println( "strvar =" + example.getStrvar() ); + System.out.println( "cstrvar =" + example.getCstrvar() ); + System.out.println( "iptrvar =" + Long.toHexString(SWIGTYPE_p_int.getCPtr(example.getIptrvar())) ); + System.out.println( "name =" + example.getName() ); + System.out.println( "ptptr =" + Long.toHexString(SWIGTYPE_p_Point.getCPtr(example.getPtptr())) + example.Point_print(example.getPtptr()) ); + System.out.println( "pt =" + Long.toHexString(SWIGTYPE_p_Point.getCPtr(example.getPt())) + example.Point_print(example.getPt()) ); + + System.out.println( "\nVariables (values printed from C)" ); + + example.print_vars(); + + System.out.println( "\nNow I'm going to try and modify some read only variables" ); + + System.out.println( " Trying to set 'path'" ); + try { + Method m = example.class.getDeclaredMethod("setPath", new Class[] {String.class}); + m.invoke(example.class, new Object[] {"Whoa!"} ); + System.out.println( "Hey, what's going on?!?! This shouldn't work" ); + } + catch (NoSuchMethodException e) { + System.out.println( "Good." ); + } + catch (Throwable t) { + System.out.println( "You shouldn't see this!" ); + } + + System.out.println( " Trying to set 'status'" ); + try { + Method m = example.class.getDeclaredMethod("setStatus", new Class[] {Integer.class}); + m.invoke(example.class, new Object[] {new Integer(0)} ); + System.out.println( "Hey, what's going on?!?! This shouldn't work" ); + } + catch (NoSuchMethodException e) { + System.out.println( "Good." ); + } + catch (Throwable t) { + System.out.println( "You shouldn't see this!" ); + } + + System.out.println( "\nI'm going to try and update a structure variable.\n" ); + + example.setPt(example.getPtptr()); + + System.out.println( "The new value is" ); + example.pt_print(); + System.out.println( "You should see the value" + example.Point_print(example.getPtptr()) ); + } +} From e1a6b2ca3ba4467863b479419537d080435be186 Mon Sep 17 00:00:00 2001 From: Cheryl Foil Date: Sat, 16 Aug 2008 00:42:37 +0000 Subject: [PATCH 011/314] Cleaning up directories a bit git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2008-cherylfoil@10764 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Source/DoxygenTranslator/DoxygenEntity.cpp | 89 -- Source/DoxygenTranslator/DoxygenEntity.h | 26 - .../DoxygenTranslator/DoxygenTranslator.cpp | 810 ------------------ Source/DoxygenTranslator/JavaDocConverter.cpp | 210 ----- Source/DoxygenTranslator/JavaDocConverter.h | 18 - Source/DoxygenTranslator/Token.cpp | 32 - Source/DoxygenTranslator/Token.h | 21 - Source/DoxygenTranslator/TokenList.cpp | 114 --- Source/DoxygenTranslator/TokenList.h | 27 - 9 files changed, 1347 deletions(-) delete mode 100644 Source/DoxygenTranslator/DoxygenEntity.cpp delete mode 100644 Source/DoxygenTranslator/DoxygenEntity.h delete mode 100644 Source/DoxygenTranslator/DoxygenTranslator.cpp delete mode 100644 Source/DoxygenTranslator/JavaDocConverter.cpp delete mode 100644 Source/DoxygenTranslator/JavaDocConverter.h delete mode 100644 Source/DoxygenTranslator/Token.cpp delete mode 100644 Source/DoxygenTranslator/Token.h delete mode 100644 Source/DoxygenTranslator/TokenList.cpp delete mode 100644 Source/DoxygenTranslator/TokenList.h diff --git a/Source/DoxygenTranslator/DoxygenEntity.cpp b/Source/DoxygenTranslator/DoxygenEntity.cpp deleted file mode 100644 index 6b8755592..000000000 --- a/Source/DoxygenTranslator/DoxygenEntity.cpp +++ /dev/null @@ -1,89 +0,0 @@ -#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 findCommand(int commandNum){ - - int arraySize = sizeof(commandArray2)/sizeof(*commandArray2); - if (commandNum - 101 >= 0 && commandNum - 101 < arraySize){ - return commandArray2[commandNum - 101]; - } - - return "" ; -} - -DoxygenEntity::DoxygenEntity(string 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(string typeEnt, string param1){ - typeOfEntity = typeEnt; - data = param1; - isLeaf = 1; -} - -/* Nonterminal node - * contains - */ -DoxygenEntity::DoxygenEntity(string typeEnt, list &entList ){ - typeOfEntity = typeEnt; - data = ""; - isLeaf = 0; - entityList = entList; -} - - -void DoxygenEntity::printEntity(int level){ - int thisLevel = level; - if (isLeaf) { - for (int i = 0; i < thisLevel; i++) {cout << "\t";} - cout << "Node Command: " << typeOfEntity << " "; - if (data.compare("") != 0) cout << "Node Data: " << data; - cout << endl; - } - else{ - for (int i = 0; i < thisLevel; i++) {cout << "\t";} - cout << "Node Command : " << typeOfEntity << endl; - list::iterator p = entityList.begin(); - thisLevel++; - while (p != entityList.end()){ - (*p).printEntity(thisLevel); - p++; - } - } -} - -DoxygenEntity::~DoxygenEntity() -{ -} diff --git a/Source/DoxygenTranslator/DoxygenEntity.h b/Source/DoxygenTranslator/DoxygenEntity.h deleted file mode 100644 index 0605b1cc9..000000000 --- a/Source/DoxygenTranslator/DoxygenEntity.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef DOXYGENENTITY_H_ -#define DOXYGENENTITY_H_ - -#include -#include -#include -#include - -using namespace std; - -class DoxygenEntity{ - -public: - DoxygenEntity(string typeEnt); - DoxygenEntity(string typeEnt, string param1); - DoxygenEntity(string typeEnt, list &entList ); - ~DoxygenEntity(); - void printEntity(int level); - string typeOfEntity; - list entityList; - string data; - int isLeaf; -}; - - -#endif /*TOKENLIST_H_*/ diff --git a/Source/DoxygenTranslator/DoxygenTranslator.cpp b/Source/DoxygenTranslator/DoxygenTranslator.cpp deleted file mode 100644 index 96fe6b2c5..000000000 --- a/Source/DoxygenTranslator/DoxygenTranslator.cpp +++ /dev/null @@ -1,810 +0,0 @@ - - - //THE TOKENIZER REWORK - - /* 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 work in Brief descriptions, detailed descriptions for autobrief - - #include - #include - #include - #include - #include - #include "DoxygenEntity.h" - #include "TokenList.h" - #include "JavaDocConverter.h" - #define SIMPLECOMMAND 1 - #define IGNOREDSIMPLECOMMAND 2 - #define COMMANDWORD 3 - #define IGNOREDCOMMANDWORD 4 - #define COMMANDLINE 5 - #define IGNOREDCOMMANDLINE 6 - #define COMMANDPARAGRAPH 7 - #define IGNORECOMMANDPARAGRAPH 8 - #define COMMANDENDCOMMAND 9 - #define COMMANDWORDPARAGRAPH 10 - #define COMMANDWORDLINE 11 - #define COMMANDWORDOWORDWORD 12 - #define COMMANDOWORD 13 - #define COMMANDERRORTHROW 14 - #define COMMANDUNIQUE 15 -#define END_LINE 101 -#define PARAGRAPH_END 102 -#define PLAINSTRING 103 -#define COMMAND 104 - using namespace std; - - ////////////////////////////////////////// - /*Set these to pick what internal functions - to test. */ - - //int testCommandParsingFunctions = 1;// not implemented - - - int noisy = 0; // set this to 1 for extra chatter from the parsing stage. - int addCommand(string currCommand, TokenList &tokList, list &aNewList); - list parse(list::iterator endParsingIndex, TokenList &tokList); - - ////////////////////////////////////////// - - - 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 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" }; - - /* All of the doxygen commands divided up by how they are parsed */ - string simpleCommands[] = {"n", "$", "@", "\\", "&", "~", "<", ">", "#", "%"}; - string ignoredSimpleCommands[] = {"nothing at the moment"}; - string commandWords[] = {"a", "b", "c", "e", "em", "p", "def", "enum", "example", "package", - "relates", "namespace", "relatesalso","anchor", "dontinclude", "include", "includelineno"}; - string ignoredCommandWords[] = {"copydoc", "copybrief", "copydetails", "verbinclude", "htmlinclude"}; - string commandLines[] = {"addindex", "fn", "name", "line", "var", "skipline", "typedef", "skip", "until", "property"}; - string ignoreCommandLines[] = {"nothing at the moment"}; - string commandParagraph[] = {"return", "remarks", "since", "test", "sa", "see", "pre", "post", "details", "invariant", - "deprecated", "date", "note", "warning", "version", "todo", "bug", "attention", "brief", "author"}; - string ignoreCommandParagraphs[] = {"nothing at the moment"}; - string commandEndCommands[] = {"code", "dot", "msc", "f$", "f[", "f{environment}{", "htmlonly", "latexonly", "manonly", - "verbatim", "xmlonly", "cond", "if", "ifnot", "link"}; - string commandWordParagraphs[] = {"param", "tparam", "throw", "retval", "exception"}; - string commandWordLines[] = {"page", "subsection", "subsubsection", "section", "paragraph", "defgroup"}; - string commandWordOWordOWords [] = {"category", "class", "protocol", "interface", "struct", "union"}; - string commandOWords[] = {"dir", "file", "cond"}; - string commandErrorThrowings[] = {"annotatedclasslist", "classhierarchy", "define", "functionindex", "header", - "headerfilelist", "inherit", "l", "postheader", "private", "privatesection", "protected", - "protectedsection", "public", "publicsection", "endcode", "enddot", "endmsc", "endhtmlonly", - "endlatexonly", "endmanonly", "endlink", "endverbatim", "endxmlonly", "f]", "f}", "endcond", - "endif"}; - string commandUniques[] = {"xrefitem", "arg", "ingroup", "par", "headerfile", "overload", "weakgroup", "ref", - "subpage", "dotfile", "image", "addtogroup", "li"}; - - - /* Changes a string to all lower case*/ - string StringToLower(string stringToConvert) - - { - - for(unsigned int i=0;i &rootList){ - - list::iterator p = rootList.begin(); - while (p != rootList.end()){ - (*p).printEntity(0); - p++; - } - - } - - /* Determines how a command should be handled (what group it belongs to - * for parsing rules - */ - - int commandBelongs(string theCommand){ - string smallString = StringToLower(theCommand ); - //cout << " Looking for command " << theCommand << endl; - int i = 0; - for ( i = 0; i < sizeof(simpleCommands)/sizeof(*simpleCommands); i++){ - if(smallString.compare(simpleCommands[i]) == 0){return SIMPLECOMMAND ;} - } - for ( i = 0; i < sizeof(ignoredSimpleCommands)/sizeof(*ignoredSimpleCommands); i++){ - if(smallString.compare(ignoredSimpleCommands[i]) == 0){return IGNOREDSIMPLECOMMAND;} - } - for ( i = 0; i < sizeof(commandWords)/sizeof(*commandWords); i++){ - if(smallString.compare( commandWords[i]) == 0){return COMMANDWORD;} - } - for ( i = 0; i < sizeof(ignoredCommandWords)/sizeof(*ignoredCommandWords); i++){ - if(smallString.compare( ignoredCommandWords[i]) == 0){return IGNOREDCOMMANDWORD;} - } - for ( i = 0; i < sizeof(commandLines)/sizeof(*commandLines); i++){ - if(smallString.compare( commandLines[i]) == 0){return COMMANDLINE;} - } - for ( i = 0; i < sizeof(ignoreCommandLines)/sizeof(*ignoreCommandLines); i++){ - if(smallString.compare( ignoreCommandLines[i]) == 0){return IGNOREDCOMMANDLINE;} - } - for ( i = 0; i < sizeof(commandParagraph)/sizeof(*commandParagraph); i++){ - if(smallString.compare( commandParagraph[i]) == 0){return COMMANDPARAGRAPH;} - } - /* IgnoreCommandParagraph */ - for ( i = 0; i < sizeof(ignoreCommandParagraphs)/sizeof(*ignoreCommandParagraphs); i++){ - if(smallString.compare( ignoreCommandParagraphs[i]) == 0){return IGNORECOMMANDPARAGRAPH;} - } - for ( i = 0; i < sizeof(commandEndCommands)/sizeof(*commandEndCommands); i++){ - if(smallString.compare( commandEndCommands[i]) == 0){return COMMANDENDCOMMAND ;} - } - for ( i = 0; i < sizeof(commandWordParagraphs)/sizeof(*commandWordParagraphs); i++){ - if(smallString.compare( commandWordParagraphs[i]) == 0){return COMMANDWORDPARAGRAPH;} - } - for ( i = 0; i < sizeof(commandWordLines)/sizeof(*commandWordLines); i++){ - if(smallString.compare( commandWordLines[i]) == 0){return COMMANDWORDLINE ;} - } - for ( i = 0; i < sizeof(commandWordOWordOWords)/sizeof(*commandWordOWordOWords); i++){ - if(smallString.compare( commandWordOWordOWords[i]) == 0){return COMMANDWORDOWORDWORD;} - } - for ( i = 0; i < sizeof(commandOWords)/sizeof(*commandOWords); i++){ - if(smallString.compare( commandOWords[i]) == 0){return COMMANDOWORD;} - } - for ( i = 0; i < sizeof(commandErrorThrowings)/sizeof(*commandErrorThrowings); i++){ - if(smallString.compare( commandErrorThrowings[i]) == 0){return COMMANDERRORTHROW;} - } - for ( i = 0; i < sizeof(commandUniques)/sizeof(*commandUniques); i++){ - if(smallString.compare( commandUniques[i]) == 0){return COMMANDUNIQUE;} - } - - return 0; - - } - /* Returns the next word ON THE CURRENT LINE ONLY - * if a new line is encountered, returns a blank string. - * Updates the index it is given if success. - */ - - string getNextWord(TokenList &tokList){ - Token nextToken = tokList.peek(); - if (nextToken.tokenType == PLAINSTRING ){ - nextToken = tokList.next(); - return nextToken.tokenString; - } - return ""; - } - - /* Returns the location of the end of the line as - * an iterator. - */ - list::iterator getOneLine(TokenList &tokList){ - list::iterator endOfParagraph = tokList.iteratorCopy(); - while(endOfParagraph != tokList.end()){ - if ((* endOfParagraph).tokenType == END_LINE){ - return endOfParagraph; - } - endOfParagraph++; - } - return tokList.end(); - } - - - -/* Returns a properly formatted string - * up til ANY command or end of paragraph is encountered. - */ -string getStringTilCommand(TokenList &tokList){ - string description; - if (tokList.peek().tokenType == 0) return ""; - while(tokList.peek().tokenType == PLAINSTRING || tokList.peek().tokenType == END_LINE ){ - Token currentToken = tokList.next(); - if(currentToken.tokenType == PLAINSTRING) { - description = description + currentToken.tokenString + " "; - } - else if (tokList.peek().tokenType == END_LINE) break; - } - - return description; - } - -/* Returns a properly formatted string - * up til the command specified is encountered - */ -//TODO check that this behaves properly for formulas - -string getStringTilEndCommand(string theCommand, TokenList &tokList){ - string description; - if (tokList.peek().tokenType == 0) return ""; - while(tokList.peek().tokenString.compare(theCommand) != 0 ){ - Token currentToken = tokList.next(); - description = description + currentToken.tokenString + " "; - - } - - return description; - } - -/* Returns the end of a Paragraph as an iterator- - * Paragraph is defined in Doxygen to be a paragraph of text - * seperate by either a structural command or a blank line - */ - -list::iterator getEndOfParagraph(TokenList &tokList){ - list::iterator endOfParagraph = tokList.iteratorCopy(); - while(endOfParagraph != tokList.end()){ - if ((* endOfParagraph).tokenType == COMMAND){ - if(isSectionIndicator((* endOfParagraph).tokenString)) return endOfParagraph; - else endOfParagraph++; - } - else if((* endOfParagraph).tokenType == PLAINSTRING) { - endOfParagraph++; - } - else if ((* endOfParagraph).tokenType == END_LINE){ - endOfParagraph++; - if ((* endOfParagraph).tokenType == END_LINE){ - endOfParagraph++; - return endOfParagraph; - } - } - - } - - return tokList.end(); - - } - -/* Returns the end of a section, defined as the first blank line OR first encounter of the same - * command. Example of this behaviour is \arg - */ - -list::iterator getEndOfSection(string theCommand, TokenList &tokList){ - list::iterator endOfParagraph = tokList.iteratorCopy(); - while(endOfParagraph != tokList.end()){ - if ((* endOfParagraph).tokenType == COMMAND){ - if(theCommand.compare((*endOfParagraph).tokenString) == 0) return endOfParagraph; - else endOfParagraph++; - } - else if((* endOfParagraph).tokenType == PLAINSTRING) { - endOfParagraph++; - } - else if ((* endOfParagraph).tokenType == END_LINE){ - endOfParagraph++; - if ((* endOfParagraph).tokenType == END_LINE){ - endOfParagraph++; - return endOfParagraph; - } - } - - } -} - /* This method is for returning the end of 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", tokenList); - */ -list::iterator getEndCommand(string theCommand, TokenList &tokList){ - list::iterator endOfCommand = tokList.iteratorCopy(); - while (endOfCommand!= tokList.end()){ - if ((*endOfCommand).tokenType == COMMAND){ - if (theCommand.compare((* endOfCommand).tokenString) == 0){ - return endOfCommand; - } - endOfCommand++; - } - } - //End command not found - return tokList.end(); - } - - /* A specialty method for commands such as \arg that end at the end of a paragraph OR when another \arg is encountered - */ - -list::iterator getTilAnyCommand(string theCommand, TokenList &tokList){ - list::iterator anIterator; - return anIterator; - } - - - - - /* Method for Adding a Simple Command - * Format: @command - * Plain commands, such as newline etc, they contain no other data - * \n \\ \@ \& \$ \# \< \> \% - */ - int addSimpleCommand(string theCommand, list &doxyList){ - - if (noisy) cout << "Parsing " << theCommand << endl; - doxyList.push_back(DoxygenEntity(theCommand)); - return 1; - } - - /* NOT INCLUDED Simple Commands - * Format: @command - * Plain commands, such as newline etc, they contain no other data - */ - int ignoreSimpleCommand(string theCommand, list &doxyList){ - - if (noisy) cout << "Not Adding " << theCommand << endl; - return 1; - } - - /* CommandWord - * Format: @command - * Commands with a single WORD after then such as @b - * "a", "b", "c", "e", "em", "p", "def", "enum", "example", "package", - * "relates", "namespace", "relatesalso","anchor", "dontinclude", "include", "includelineno" - */ - int addCommandWord(string theCommand, TokenList &tokList, list &doxyList){ - if (noisy) cout << "Parsing " << theCommand << endl; - string name = getNextWord(tokList); - if (!name.empty()){ - doxyList.push_back(DoxygenEntity(theCommand, name)); - return 1; - } - else cout << "No word followed " << theCommand << " command. Not added" << endl; - return 0; - } - /* NOT INCLUDED CommandWord - * Format: @command - * Commands with a single WORD after then such as @b - * "copydoc", "copybrief", "copydetails", "verbinclude", "htmlinclude" - */ - int ignoreCommandWord(string theCommand, TokenList &tokList, list &doxyList){ - if (noisy) cout << "Not Adding " << theCommand << endl; - string name = getNextWord(tokList); - if (!name.empty()){ - return 1; - } - else cout << "WARNING: No word followed " << theCommand << " command." << endl; - return 0; - } - - /* CommandLine - * Format: @command (line) - * Commands with a single LINE after then such as @var - * "addindex", "fn", "name", "line", "var", "skipline", "typedef", "skip", "until", "property" - */ - int addCommandLine(string theCommand, TokenList &tokList, list &doxyList){ - if (noisy) cout << "Parsing " << theCommand << endl; - list::iterator endOfLine = getOneLine(tokList); - list aNewList; - aNewList = parse(endOfLine, tokList); - doxyList.push_back( DoxygenEntity(theCommand, aNewList)); - return 1; - - } - - /* NOT INCLUDED CommandLine - * Format: @command (line) - * Commands with a single LINE after then such as @var - * - */ - int ignoreCommandLine(string theCommand, TokenList &tokList, list &doxyList){ - if (noisy) cout << "Not Adding " << theCommand << endl; - list::iterator endOfLine = getOneLine(tokList); - tokList.setIterator(endOfLine); - return 1; - } - - /* CommandParagraph - * Format: @command {paragraph} - * Commands with a single paragraph after then such as @return - * "return", "remarks", "since", "test", "sa", "see", "pre", "post", "details", "invariant", - * "deprecated", "date", "note", "warning", "version", "todo", "bug", "attention", "brief", "arg", "author" - */ - int addCommandParagraph(string theCommand, TokenList &tokList, list &doxyList){ - if (noisy) cout << "Parsing " << theCommand << endl; - list::iterator endOfParagraph = getEndOfParagraph(tokList); - //if(!restOfParagraph.empty()){ - list aNewList; - aNewList = parse(endOfParagraph, tokList); - doxyList.push_back( DoxygenEntity(theCommand, aNewList)); - return 1; - // } - //else cout << "No line followed " << theCommand << " command. Not added" << endl; - } - /* CommandParagraph - * Format: @command {paragraph} - * Commands with a single LINE after then such as @var - * - */ - int ignoreCommandParagraph(string theCommand, TokenList &tokList, list &doxyList){ - if (noisy) cout << "Not Adding " << theCommand << endl; - list::iterator endOfParagraph = getEndOfParagraph(tokList); - tokList.setIterator(endOfParagraph); - //else cout << "WARNING: No line followed " << theCommand << " command." << endl; - return 1; - } - /* Command EndCommand - * Format: @command and ends at @endcommand - * Commands that take in a block of text such as @code - * "code", "dot", "msc", "f$", "f[", "f{environment}{", "htmlonly", "latexonly", "manonly", - * "verbatim", "xmlonly", "cond", "if", "ifnot", "link" - * Returns 1 if success, 0 if the endcommand is never encountered. - */ - - int addCommandEndCommand(string theCommand, TokenList &tokList, list &doxyList){ - if (noisy) cout << "Not Adding " << theCommand << endl; - string description = getStringTilEndCommand( "end" + theCommand, tokList); - doxyList.push_back(DoxygenEntity(theCommand, description)); - return 1; - } - - /* CommandWordParagraph - * Format: @command {paragraph} - * Commands such as param - * "param", "tparam", "throw", "retval", "exception" - */ - int addCommandWordParagraph(string theCommand, TokenList &tokList, list &doxyList){ - if (noisy) cout << "Parsing " << theCommand << endl; - string name = getNextWord(tokList); - if (name.empty()){ - cout << "No word followed " << theCommand << " command. Not added" << endl; - return 0; - } - list::iterator endOfParagraph = getEndOfParagraph(tokList); - //if(!restOfParagraph.empty()){ - list aNewList; - aNewList = parse(endOfParagraph, tokList); - aNewList.push_front(DoxygenEntity("plainstring", name)); - doxyList.push_back(DoxygenEntity(theCommand, aNewList)); - return 0; - } - /* CommandWordLine - * Format: @command (line) - * Commands such as param - * "page", "subsection", "subsubsection", "section", "paragraph", "defgroup" - */ - int addCommandWordLine(string theCommand, TokenList &tokList, list &doxyList){ - if (noisy) cout << "Parsing " << theCommand << endl; - string name = getNextWord(tokList); - if (name.empty()){ - cout << "No word followed " << theCommand << " command. Not added" << endl; - return 0; - } - list::iterator endOfLine = getOneLine(tokList); - list aNewList; - aNewList = parse(endOfLine, tokList); - aNewList.push_front(DoxygenEntity("plainstring", name)); - doxyList.push_back(DoxygenEntity(theCommand, aNewList)); - return 1; - - //else cout << "No line followed " << theCommand << " command. Not added" << endl; - } - - /* Command Word Optional Word Optional Word - * Format: @command [] [] - * Commands such as class - * "category", "class", "protocol", "interface", "struct", "union" - */ - int addCommandWordOWordOWord(string theCommand, TokenList &tokList, list &doxyList){ - if (noisy) cout << "Parsing " << theCommand << endl; - string name = getNextWord(tokList); - if (name.empty()){ - cout << "No word followed " << theCommand << " command. Not added" << endl; - return 0; - } - string headerfile = getNextWord(tokList); - string headername = getNextWord(tokList); - list aNewList; - aNewList.push_back(DoxygenEntity("plainstring", name)); - if (!headerfile.empty()) aNewList.push_back(DoxygenEntity("plainstring", headerfile)); - if (!headername.empty()) aNewList.push_back(DoxygenEntity("plainstring", headername)); - doxyList.push_back(DoxygenEntity(theCommand, aNewList)); - return 1; - } - - /* Command Optional Word - * Format: @command [] - * Commands such as dir - * "dir", "file", "cond" - */ - int addCommandOWord(string theCommand, TokenList &tokList, list &doxyList){ - if (noisy) cout << "Parsing " << theCommand << endl; - string name = getNextWord(tokList); - doxyList.push_back(DoxygenEntity(theCommand, name)); - return 1; - } - - /* Commands that should not be encountered (such as PHP only) - */ - int addCommandErrorThrow(string theCommand, TokenList &tokList, list &doxyList){ - cout << "Encountered :" << theCommand << endl; - cout << "This command should not have been encountered. Behaviour past this may be unpredictable " << endl; - } - - - int addCommandUnique(string theCommand, TokenList &tokList, list &doxyList){ - list aNewList; - if (theCommand.compare("arg") == 0 || theCommand.compare("li") == 0){ - list::iterator endOfSection = getEndOfSection(theCommand, tokList); - list aNewList; - aNewList = parse(endOfSection, tokList); - doxyList.push_back( DoxygenEntity(theCommand, aNewList)); - } - - // \xrefitem "(heading)" "(list title)" {text} - else if (theCommand.compare("xrefitem") == 0){ - //TODO Implement xrefitem - if (noisy) cout << "Not Adding " << theCommand << endl; - list::iterator endOfParagraph = getEndOfParagraph(tokList); - tokList.setIterator(endOfParagraph); - return 1; - } - // \ingroup ( [ ]) - else if (theCommand.compare("ingroup") == 0){ - string name = getNextWord(tokList); - aNewList.push_back(DoxygenEntity("plainstring", name)); - name = getNextWord(tokList); - if(!name.empty()) aNewList.push_back(DoxygenEntity("plainstring", name)); - name = getNextWord(tokList); - if(!name.empty()) aNewList.push_back(DoxygenEntity("plainstring", name)); - doxyList.push_back(DoxygenEntity(theCommand, aNewList)); - return 1; - } - // \par [(paragraph title)] { paragraph } - else if (theCommand.compare("par") == 0){ - list::iterator endOfLine = getOneLine(tokList); - aNewList = parse(endOfLine, tokList); - list aNewList2; - aNewList2 = parse(endOfLine, tokList); - aNewList.splice(aNewList.end(), aNewList2); - doxyList.push_back(DoxygenEntity(theCommand, aNewList)); - return 1; - } - // \headerfile [] - else if (theCommand.compare("headerfile") == 0){ - list aNewList; - string name = getNextWord(tokList); - aNewList.push_back(DoxygenEntity("plainstring", name)); - name = getNextWord(tokList); - if(!name.empty()) aNewList.push_back(DoxygenEntity("plainstring", name)); - doxyList.push_back(DoxygenEntity(theCommand, aNewList)); - return 1; - } - // \overload [(function declaration)] - else if (theCommand.compare("overload") == 0){ - list::iterator endOfLine = getOneLine(tokList); - if (endOfLine != tokList.current()){ - list aNewList; - aNewList = parse(endOfLine, tokList); - doxyList.push_back(DoxygenEntity(theCommand, aNewList)); - } - else doxyList.push_back(DoxygenEntity(theCommand)); - } - // \weakgroup [(title)] - else if (theCommand.compare("weakgroup") == 0){ - if (noisy) cout << "Parsing " << theCommand << endl; - string name = getNextWord(tokList); - if (name.empty()){ - cout << "No word followed " << theCommand << " command. Not added" << endl; - return 0; - } - list aNewList; - list::iterator endOfLine = getOneLine(tokList); - if (endOfLine != tokList.current()) { - aNewList = parse(endOfLine, tokList); - } - aNewList.push_front(DoxygenEntity("plainstring", name)); - doxyList.push_back(DoxygenEntity(theCommand, aNewList)); - } - // \ref ["(text)"] - else if (theCommand.compare("ref") == 0){ - //TODO Implement ref - if (noisy) cout << "Not Adding " << theCommand << endl; - list::iterator endOfParagraph = getEndOfParagraph(tokList); - tokList.setIterator(endOfParagraph); - } - // \subpage ["(text)"] - else if (theCommand.compare("subpage") == 0){ - //TODO implement subpage - if (noisy) cout << "Not Adding " << theCommand << endl; - list::iterator endOfParagraph = getEndOfParagraph(tokList); - tokList.setIterator(endOfParagraph); - } - // \dotfile ["caption"] - else if (theCommand.compare("dotfile") == 0){ - //TODO implement dotfile - if (noisy) cout << "Not Adding " << theCommand << endl; - list::iterator endOfParagraph = getEndOfParagraph(tokList); - tokList.setIterator(endOfParagraph); - } - // \image ["caption"] [=] - else if (theCommand.compare("image") == 0){ - //todo implement image - } - // \addtogroup [(title)] - else if (theCommand.compare("addtogroup") == 0){ - if (noisy) cout << "Parsing " << theCommand << endl; - string name = getNextWord(tokList); - if (name.empty()){ - cout << "No word followed " << theCommand << " command. Not added" << endl; - return 0; - } - list aNewList; - list::iterator endOfLine = getOneLine(tokList); - if (endOfLine != tokList.current()) { - aNewList = parse(endOfLine, tokList); - } - aNewList.push_front(DoxygenEntity("plainstring", name)); - doxyList.push_back(DoxygenEntity(theCommand, aNewList)); - } - - } - - /* 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(string commandString, TokenList &tokList,list &doxyList){ - string theCommand = StringToLower(commandString); - - if (theCommand.compare("plainstring") == 0){ - string nextPhrase = getStringTilCommand( tokList); - if (noisy) cout << "Parsing plain string :" << nextPhrase << endl; - doxyList.push_back(DoxygenEntity("plainstring", nextPhrase )); - return 1; - } - int commandNumber = commandBelongs(theCommand); - if (commandNumber == SIMPLECOMMAND){ - return addSimpleCommand(theCommand, doxyList); - } - if (commandNumber == IGNOREDSIMPLECOMMAND){ - return ignoreSimpleCommand(theCommand, doxyList); - } - if (commandNumber == COMMANDWORD){ - return addCommandWord(theCommand, tokList, doxyList); - } - if (commandNumber == IGNOREDCOMMANDWORD){ - return ignoreCommandWord(theCommand, tokList, doxyList); - } - if (commandNumber == COMMANDLINE ){ - return addCommandLine(theCommand, tokList, doxyList); - } - if (commandNumber == IGNOREDCOMMANDLINE ){ - return ignoreCommandLine(theCommand, tokList, doxyList); - } - if (commandNumber == COMMANDPARAGRAPH){ - return addCommandParagraph(theCommand, tokList, doxyList); - } - if (commandNumber == IGNORECOMMANDPARAGRAPH){ - return ignoreCommandParagraph(theCommand, tokList, doxyList); - } - if (commandNumber == COMMANDENDCOMMAND){ - return addCommandEndCommand(theCommand, tokList, doxyList); - } - if (commandNumber == COMMANDWORDPARAGRAPH){ - return addCommandWordParagraph(theCommand, tokList, doxyList); - } - if (commandNumber == COMMANDWORDLINE){ - return addCommandWordLine(theCommand, tokList, doxyList); - } - if (commandNumber == COMMANDWORDOWORDWORD){ - return addCommandWordOWordOWord(theCommand, tokList, doxyList); - } - if (commandNumber == COMMANDOWORD){ - return addCommandOWord(theCommand, tokList, doxyList); - } - if (commandNumber == COMMANDERRORTHROW){ - return addCommandErrorThrow(theCommand, tokList, doxyList); - } - if (commandNumber == COMMANDUNIQUE){ - return addCommandUnique(theCommand, tokList, doxyList); - } - - return 0; - } - - list parse(list::iterator endParsingIndex, TokenList &tokList){ - list aNewList; - int currCommand; - while (tokList.current() != endParsingIndex){ - Token currToken = tokList.peek(); - if(noisy) cout << "Parsing for phrase starting in:" << currToken.toString() << endl; - if(currToken.tokenType == END_LINE ){ - tokList.next(); - } - else if(currToken.tokenType == COMMAND){ - currCommand = findCommand(currToken.tokenString); - tokList.next(); - if (currCommand < 0 ){ if(noisy) cout << "BAD COMMAND: " << currToken.tokenString << endl;} - //cout << "Command: " << currWord << " " << currCommand << endl; - - else addCommand(currToken.tokenString, tokList, aNewList); - } - else if (currToken.tokenType == PLAINSTRING){ - addCommand(string("plainstring"), tokList, aNewList); - } - - - } - - return aNewList; - } - -list convert(string doxygenBlob){ - TokenList tokList = TokenList(doxygenBlob); - if(noisy) { - cout << "---TOKEN LIST---" << endl; - tokList.printList(); - } - list rootList; - rootList = parse( tokList.end(), tokList); - if(noisy) { - cout << "PARSED LIST" << endl; - printTree(rootList); - } - return rootList; - } - -int main(int argc, char *argv[]){ - string doxygenString1 = "//! A normal member taking two arguments and returning an integer value. This is a very long description for the simple purpose of showing off formatting. Let's make it a bit longer just to be sure. \n/*!\n \\param a an \\b integer argument.\n \\return The test results\n \\param s a constant character pointer. Let's also make this a very long description! \n \\bug this command should, for now, be totally ignored\n \\author cheryl foil\n \\sa Test(), ~Test(), testMeToo() and publicVar()\n */"; - cout << "---ORIGINAL DOXYGEN--- " << endl << doxygenString1 << endl; - list rootList = convert(doxygenString1); - JavaDocConverter jDC = JavaDocConverter(); - jDC.convertToJavaDoc(rootList); - return 1; -} - - diff --git a/Source/DoxygenTranslator/JavaDocConverter.cpp b/Source/DoxygenTranslator/JavaDocConverter.cpp deleted file mode 100644 index 91f52662f..000000000 --- a/Source/DoxygenTranslator/JavaDocConverter.cpp +++ /dev/null @@ -1,210 +0,0 @@ -#include "JavaDocConverter.h" -#include -#include -#include -#include -#define APPROX_LINE_LENGTH 64//characters per line allowed -#define TAB_SIZE 8//characters per line allowed -int printSortedTree2 = 0; -//TODO {@link} {@linkplain} {@docRoot}, and other useful doxy commands that are not a javadoc tag -JavaDocConverter::JavaDocConverter() -{ -} - -JavaDocConverter::~JavaDocConverter() -{ -} - -/* Sorts entities by javaDoc standard order for commands - * NOTE: will not behave entirely properly until "First level" comments - * such as brief descriptions are TAGGED as such - */ -bool compare_DoxygenEntities(DoxygenEntity first, DoxygenEntity second){ - if(first.typeOfEntity.compare("plainstring") == 0) return true; - if(second.typeOfEntity.compare("plainstring") == 0) return false; - if(first.typeOfEntity.compare("param") == 0){ - if(second.typeOfEntity.compare("param")== 0) return true; - if(second.typeOfEntity.compare("return")== 0) return true; - if(second.typeOfEntity.compare("exception")== 0) return true; - if(second.typeOfEntity.compare("author")== 0) return true; - if(second.typeOfEntity.compare("version")== 0)return true; - if(second.typeOfEntity.compare("see")== 0)return true; - if(second.typeOfEntity.compare("since")== 0)return true; - if(second.typeOfEntity.compare("deprecated")== 0)return true; - return false; - } - if(first.typeOfEntity.compare("return")== 0){ - if(second.typeOfEntity.compare("return")== 0) return true; - if(second.typeOfEntity.compare("exception")== 0) return true; - if(second.typeOfEntity.compare("author")== 0) return true; - if(second.typeOfEntity.compare("version")== 0)return true; - if(second.typeOfEntity.compare("see")== 0)return true; - if(second.typeOfEntity.compare("since")== 0)return true; - if(second.typeOfEntity.compare("deprecated")== 0)return true; - return false; - - } - if(first.typeOfEntity.compare("exception")== 0){ - if(second.typeOfEntity.compare("exception")== 0) return true; - if(second.typeOfEntity.compare("author")== 0) return true; - if(second.typeOfEntity.compare("version")== 0)return true; - if(second.typeOfEntity.compare("see")== 0)return true; - if(second.typeOfEntity.compare("since")== 0)return true; - if(second.typeOfEntity.compare("deprecated")== 0)return true; - return false; - } - if(first.typeOfEntity.compare("author")== 0){ - if(first.typeOfEntity.compare("author")== 0) return true; - if(first.typeOfEntity.compare("version")== 0)return true; - if(first.typeOfEntity.compare("see")== 0)return true; - if(first.typeOfEntity.compare("since")== 0)return true; - if(first.typeOfEntity.compare("deprecated")== 0)return true; - return false; - } - if(first.typeOfEntity.compare("version")== 0){ - if(second.typeOfEntity.compare("version")== 0)return true; - if(second.typeOfEntity.compare("see")== 0)return true; - if(second.typeOfEntity.compare("since")== 0)return true; - if(second.typeOfEntity.compare("deprecated")== 0)return true; - return false; - } - if(first.typeOfEntity.compare("see")== 0 || first.typeOfEntity.compare("sa")== 0){ - if(second.typeOfEntity.compare("see")== 0)return true; - if(second.typeOfEntity.compare("sa")== 0)return true; - if(second.typeOfEntity.compare("since")== 0)return true; - if(second.typeOfEntity.compare("deprecated")== 0)return true; - return false; - } - if(first.typeOfEntity.compare("since")== 0){ - if(second.typeOfEntity.compare("since")== 0) return true; - if(second.typeOfEntity.compare("deprecated")== 0)return true; - return false; - } - if(first.typeOfEntity.compare("deprecated")== 0){ - if(second.typeOfEntity.compare("deprecated")== 0)return true; - return false; - } - return true; -} - -void JavaDocConverter::printSortedTree(list &entityList){ - list::iterator p = entityList.begin(); - while (p != entityList.end()){ - (*p).printEntity(0); - p++; - } -} -string formatCommand(string unformattedLine, int indent){ - string formattedLines = "\n * "; - int lastPosition = 0; - int i = 0; - int isFirstLine = 1; - while (i != -1 && i < unformattedLine.length()){ - lastPosition = i; - if (isFirstLine){ - i+=APPROX_LINE_LENGTH; - } - else i+=APPROX_LINE_LENGTH - indent*TAB_SIZE; - i = unformattedLine.find(" ", i); - - if (i > 0 && i + 1 < unformattedLine.length()){ - if (!isFirstLine) for (int j = 0; j < indent; j++) { - formattedLines.append("\t"); - } - else { - isFirstLine = 0; - } - formattedLines.append(unformattedLine.substr(lastPosition, i - lastPosition + 1)); - formattedLines.append("\n *"); - - } - } - if (lastPosition < unformattedLine.length()){ - if (!isFirstLine) {for (int j = 0; j < indent; j++) {formattedLines.append("\t");}} - formattedLines.append(unformattedLine.substr(lastPosition, unformattedLine.length() - lastPosition)); - } - - return formattedLines; -} - -/* Contains the conversions for tags - * could probably be much more efficient... - */ -string javaDocFormat(DoxygenEntity &doxygenEntity){ - if (doxygenEntity.typeOfEntity.compare("plainstring") == 0){ - return doxygenEntity.data; - } - else if (doxygenEntity.typeOfEntity.compare("brief") == 0){ - return doxygenEntity.data; - } - if (doxygenEntity.typeOfEntity.compare("detailed") == 0){ - return doxygenEntity.data; - } - else if (doxygenEntity.typeOfEntity.compare("b") == 0){ - return "" + doxygenEntity.data + ""; - } - else if (doxygenEntity.typeOfEntity.compare("c") == 0){ - return "" + doxygenEntity.data + ""; - } - return ""; -} - - -string translateSubtree( DoxygenEntity &doxygenEntity){ - string returnedString; - if (doxygenEntity.isLeaf){ return javaDocFormat(doxygenEntity) + " ";} - else { - returnedString += javaDocFormat(doxygenEntity); - list::iterator p = doxygenEntity.entityList.begin(); - while (p != doxygenEntity.entityList.end()){ - returnedString+= translateSubtree(*p); - p++; - } - } - return returnedString; -} - -string translateEntity(DoxygenEntity &doxyEntity){ - if(doxyEntity.typeOfEntity.compare("plainstring")== 0 || doxyEntity.typeOfEntity.compare("deprecated")== 0 || doxyEntity.typeOfEntity.compare("brief")== 0) - return formatCommand(doxyEntity.data, 0) + "\n * "; - else if(doxyEntity.typeOfEntity.compare("see") == 0){ - return formatCommand(string("@" + doxyEntity.typeOfEntity + "\t\t" + translateSubtree(doxyEntity)), 2); - } - else if(doxyEntity.typeOfEntity.compare("return")== 0 - || doxyEntity.typeOfEntity.compare("author")== 0 - || doxyEntity.typeOfEntity.compare("param")== 0 - || doxyEntity.typeOfEntity.compare("since")== 0 - || doxyEntity.typeOfEntity.compare("version")== 0 - || doxyEntity.typeOfEntity.compare("exception") == 0 - || doxyEntity.typeOfEntity.compare("deprecated") == 0){ - return formatCommand(string("@" + doxyEntity.typeOfEntity + "\t" + translateSubtree(doxyEntity)), 2); - } - else if(doxyEntity.typeOfEntity.compare("sa")== 0){ - return formatCommand(string("@see\t\t" + translateSubtree(doxyEntity)), 2); - } - - return ""; -} - -string JavaDocConverter:: convertToJavaDoc(list entityList){ - - - entityList.sort(compare_DoxygenEntities); - if(printSortedTree2){ - cout << "---RESORTED LIST---" << endl; - printSortedTree(entityList); - } - - string javaDocString = "/**"; - - list::iterator entityIterator = entityList.begin(); - while (entityIterator != entityList.end()){ - javaDocString += translateEntity(*entityIterator); - entityIterator++; - } - - javaDocString += "\n */\n"; - cout << "\n---RESULT IN JAVADOC---" << endl; - cout << javaDocString; - return javaDocString; -} \ No newline at end of file diff --git a/Source/DoxygenTranslator/JavaDocConverter.h b/Source/DoxygenTranslator/JavaDocConverter.h deleted file mode 100644 index 81122bc5f..000000000 --- a/Source/DoxygenTranslator/JavaDocConverter.h +++ /dev/null @@ -1,18 +0,0 @@ - #include - #include - #include "DoxygenEntity.h" - -#ifndef JAVADOCCONVERTER_H_ -#define JAVADOCCONVERTER_H_ - -class JavaDocConverter -{ -public: - - JavaDocConverter(); - string convertToJavaDoc(list entityList); - ~JavaDocConverter(); - void printSortedTree(list &entityList); -}; - -#endif /*JAVADOCCONVERTER_H_*/ diff --git a/Source/DoxygenTranslator/Token.cpp b/Source/DoxygenTranslator/Token.cpp deleted file mode 100644 index e85799546..000000000 --- a/Source/DoxygenTranslator/Token.cpp +++ /dev/null @@ -1,32 +0,0 @@ -#include "Token.h" -#include -#include -#include -#include -using namespace std; - - -Token::Token(int tType, string tString) -{ - tokenType = tType; - tokenString = tString; -} - -string Token::toString() -{ - if (tokenType == END_LINE){ - return "{END OF LINE}"; - } - if (tokenType == PARAGRAPH_END){ - return "{END OF PARAGRAPH}"; - } - if (tokenType == PLAINSTRING){ - return tokenString; - } - if (tokenType == COMMAND){ - return "{COMMAND : " + tokenString+ "}"; - } - return ""; -} - -Token:: ~Token(){} diff --git a/Source/DoxygenTranslator/Token.h b/Source/DoxygenTranslator/Token.h deleted file mode 100644 index e98686c14..000000000 --- a/Source/DoxygenTranslator/Token.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef TOKEN_H_ -#define TOKEN_H_ -#include - -#define END_LINE 101 -#define PARAGRAPH_END 102 -#define PLAINSTRING 103 -#define COMMAND 104 -using namespace std; - -class Token -{ -public: - Token(int tType, string tString); - ~Token(); - int tokenType; /* currently can be END_LINE, PLAINSTRING, or COMMAND */ - string tokenString; /* the data , such as param for @param*/ - string toString(); -}; - -#endif /*TOKEN_H_*/ diff --git a/Source/DoxygenTranslator/TokenList.cpp b/Source/DoxygenTranslator/TokenList.cpp deleted file mode 100644 index 0ace41c34..000000000 --- a/Source/DoxygenTranslator/TokenList.cpp +++ /dev/null @@ -1,114 +0,0 @@ -#include "TokenList.h" -#include -#include -#include -#include -#include "Token.h" -#define TOKENSPERLINE 8; //change this to change the printing behaviour of the token list -#define END_LINE 101 -#define PARAGRAPH_END 102 //not used at the moment -#define PLAINSTRING 103 -#define COMMAND 104 -using namespace std; - - -list tokenList; -list::iterator tokenListIterator; -int noisy2 = 0; -/* The tokenizer*/ - -TokenList::TokenList(string doxygenString){ - int currentIndex = 0; - //Regex whitespace("[ \t]+"); - //Regex newLine("[\n]"); - //Regex command("[@|\\]{1}[^ \t \n]+"); //the cheap solution - //Regex doxygenFluff("[/*!]+"); - int nextIndex = 0; - int isFluff = 0; - string currentWord; - while (currentIndex < doxygenString.length()){ - if(doxygenString[currentIndex] == '\n'){ - tokenList.push_back(Token(END_LINE, currentWord)); - currentIndex++; - } - while(currentIndex < doxygenString.length() && (doxygenString[currentIndex] == ' ' - || doxygenString[currentIndex]== '\t')) currentIndex ++; - if (currentIndex == doxygenString.length()) {} //do nothing since end of string was reached - else {nextIndex = currentIndex; - while (nextIndex < doxygenString.length() && (doxygenString[nextIndex] != ' ' - && doxygenString[nextIndex]!= '\t' && doxygenString[nextIndex]!= '\n')) nextIndex++; - currentWord = doxygenString.substr(currentIndex, nextIndex-currentIndex); - if(noisy2) cout << "Current Word: " << currentWord << endl; - if (currentWord[0] == '@' || currentWord[0] == '\\'){ - currentWord = currentWord.substr(1, currentWord.length()-1); - tokenList.push_back(Token(COMMAND, currentWord)); - } - else if (currentWord[0] == '\n'){ - //if ((tokenList.back()).tokenType == END_LINE){} - tokenList.push_back(Token(END_LINE, currentWord)); - - } - else if (currentWord[0] == '*' || currentWord[0] == '/' ||currentWord[0] == '!'){ - if (currentWord.length() == 1) {isFluff = 1;} - else { isFluff = 1; - for(int i = 1; i < currentWord.length(); i++){ - if (currentWord[0] != '*' && currentWord[0] != '/' && currentWord[0] != '!') isFluff = 0; - } - - } - if(!isFluff) tokenList.push_back(Token(PLAINSTRING, currentWord)); - } - - else tokenList.push_back(Token(PLAINSTRING, currentWord)); - currentIndex = nextIndex; - } - } - tokenListIterator = tokenList.begin(); -} - -Token TokenList::peek(){ - if(tokenListIterator!= tokenList.end()){ - Token returnedToken = (*tokenListIterator); - return returnedToken; - } - else - return Token(0, ""); -} - -Token TokenList::next(){ - if(tokenListIterator != tokenList.end()){ - Token returnedToken = (*tokenListIterator); - tokenListIterator++; - return (returnedToken); - } - else - return Token(0, ""); -} - -list::iterator TokenList::end(){ - return tokenList.end(); -} - -list::iterator TokenList::current(){ - return tokenListIterator; -} -void TokenList::printList(){ - list::iterator p = tokenList.begin(); - int i = 1; - int b = 0; - while (p != tokenList.end()){ - cout << (*p).toString() << " "; - b = i%TOKENSPERLINE; - if (b == 0) cout << endl; - p++; i++; - } -} - -list::iterator TokenList::iteratorCopy(){ - list::iterator p = tokenListIterator; - return p; -} -void TokenList::setIterator(list::iterator newPosition){ - tokenListIterator = newPosition; -} -TokenList:: ~TokenList(){} diff --git a/Source/DoxygenTranslator/TokenList.h b/Source/DoxygenTranslator/TokenList.h deleted file mode 100644 index cc61f56e4..000000000 --- a/Source/DoxygenTranslator/TokenList.h +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef TOKENLIST_H_ -#define TOKENLIST_H_ -#include -#include -#include -#include -#include "Token.h" -using namespace std; - -/* a small class used to represent the sequence of tokens - * that can be derived from a formatted doxygen string - */ - -class TokenList{ -public: - TokenList(string doxygenString); /* constructor takes a blob of Doxygen comment */ - ~TokenList(); - Token peek(); /* returns next token without advancing */ - Token next(); /* returns next token and advances */ - list::iterator end(); /* returns an end iterator */ - list::iterator current(); /* returns the current iterator */ - void printList(); /* prints out the sequence of tokens */ - list::iterator iteratorCopy(); /* returns a copy of the current iterator */ - void setIterator(list::iterator newPosition); /*moves up the iterator*/ -}; - -#endif /*TOKENLIST_H_*/ From f7e758e59fc01c6fe7add7d208f6706d8f6e7398 Mon Sep 17 00:00:00 2001 From: Cheryl Foil Date: Sat, 16 Aug 2008 07:08:45 +0000 Subject: [PATCH 012/314] just removing 2 more useless things :) git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2008-cherylfoil@10765 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Source/DoxygenTranslator/Skeleton | 1070 ---------------------------- Source/DoxygenTranslator/example.i | 19 - 2 files changed, 1089 deletions(-) delete mode 100755 Source/DoxygenTranslator/Skeleton delete mode 100644 Source/DoxygenTranslator/example.i diff --git a/Source/DoxygenTranslator/Skeleton b/Source/DoxygenTranslator/Skeleton deleted file mode 100755 index 099b94393..000000000 --- a/Source/DoxygenTranslator/Skeleton +++ /dev/null @@ -1,1070 +0,0 @@ -/** 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 deleted file mode 100644 index 20f2488cb..000000000 --- a/Source/DoxygenTranslator/example.i +++ /dev/null @@ -1,19 +0,0 @@ -/** 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; -%} From 03fd3d6581dbe5411425a23d455476f4d0d22ef4 Mon Sep 17 00:00:00 2001 From: Cheryl Foil Date: Sat, 16 Aug 2008 07:11:00 +0000 Subject: [PATCH 013/314] more cleaning up git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2008-cherylfoil@10766 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- .../DoxygenTranslator/src/TranslatorTest.cpp | 68 ------------------- Source/DoxygenTranslator/src/TranslatorTest.h | 11 --- 2 files changed, 79 deletions(-) delete mode 100644 Source/DoxygenTranslator/src/TranslatorTest.cpp delete mode 100644 Source/DoxygenTranslator/src/TranslatorTest.h diff --git a/Source/DoxygenTranslator/src/TranslatorTest.cpp b/Source/DoxygenTranslator/src/TranslatorTest.cpp deleted file mode 100644 index f2bb48983..000000000 --- a/Source/DoxygenTranslator/src/TranslatorTest.cpp +++ /dev/null @@ -1,68 +0,0 @@ - -#include -#include -#include -#include -#include -using namespace std; - - -/* This classes primary function is to test the basic text processing abilities of - * the Doxygen parsing class - * It is currently a little messy */ - - -int testCommandParsingFunctions = 1; -int testCodeCrawlingFunctions = 1; - - -/* 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"}; - - return 1; - - }; - -int testCCF(){ - - - - cout << "Testing getNextWord" << endl; - // Case 1: \command - string case1 = "\b word"; - string case2 = "\b word "; - string case3 = "\b word\n"; - string case4 = "\b word \n"; - string case5 = "\b word word"; - //Case 2: \command {paragraph} - - //Case 3: \command (text til end of line) - - - return 1; -} - -int testCPF(){ - // Case 1: \command - string case1 = "\b word"; - //Case 2: \command {paragraph} - - //Case 3: \command (text til end of line) - - return 1; - -} - -int main(int argc, char *argv[]){ - if(testCodeCrawlingFunctions) testCCF(); - if(testCommandParsingFunctions) testCPF(); - - - return 1; -} diff --git a/Source/DoxygenTranslator/src/TranslatorTest.h b/Source/DoxygenTranslator/src/TranslatorTest.h deleted file mode 100644 index 0014de718..000000000 --- a/Source/DoxygenTranslator/src/TranslatorTest.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef TRANSLATORTEST_H_ -#define TRANSLATORTEST_H_ - -class TranslatorTest -{ -public: - TranslatorTest(); - virtual ~TranslatorTest(); -}; - -#endif /*TRANSLATORTEST_H_*/ From 180171ddffc5f7c2e7d0a20816373c41e0fa6931 Mon Sep 17 00:00:00 2001 From: Cheryl Foil Date: Sat, 16 Aug 2008 07:31:05 +0000 Subject: [PATCH 014/314] Fixed post comment behaviour git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2008-cherylfoil@10767 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Source/CParse/parser.y | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Source/CParse/parser.y b/Source/CParse/parser.y index eaf53449b..09aeb7381 100644 --- a/Source/CParse/parser.y +++ b/Source/CParse/parser.y @@ -105,8 +105,14 @@ static Node *new_node(const String_or_char *tag) { if(parseComments){ /* Sets any post comments to the previous node */ if(previousNode != NULL && currentPostComment != 0){ - String *copyPostComment = Copy(currentComment); - Setattr(previousNode,"DoxygenPostComment",copyPostComment); + String *copyPostComment = Copy(currentPostComment); + if (!Getattr(previousNode, "DoxygenComment")){ + Setattr(previousNode,"DoxygenComment",copyPostComment);} + else { + Append(copyPostComment, Getattr(previousNode, "DoxygenComment")); + Setattr(previousNode,"DoxygenComment",copyPostComment); + } + currentPostComment = 0; } /* Sets Doxygen Comment if a Comment is Availible */ From 88bd4e6331272a01e3fed7ec66f2b75b42b1424a Mon Sep 17 00:00:00 2001 From: Cheryl Foil Date: Mon, 18 Aug 2008 04:54:35 +0000 Subject: [PATCH 015/314] Removal of unneeded importants; debugging parser git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2008-cherylfoil@10777 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- .../src/.deps/DoxygenEntity.Po | 190 +++++------ .../src/.deps/DoxygenParser.Po | 211 ++++++------ .../src/.deps/DoxygenTranslator.Po | 204 ++++++------ Source/DoxygenTranslator/src/.deps/Token.Po | 78 +---- .../DoxygenTranslator/src/DoxygenEntity.cpp | 2 +- Source/DoxygenTranslator/src/DoxygenEntity.h | 3 +- .../DoxygenTranslator/src/DoxygenParser.cpp | 306 +++++++++--------- Source/DoxygenTranslator/src/DoxygenParser.h | 5 - .../src/DoxygenTranslator.cpp | 32 +- .../src/JavaDocConverter.cpp | 33 +- Source/DoxygenTranslator/src/Token.cpp | 6 +- Source/DoxygenTranslator/src/TokenList.cpp | 2 +- 12 files changed, 498 insertions(+), 574 deletions(-) diff --git a/Source/DoxygenTranslator/src/.deps/DoxygenEntity.Po b/Source/DoxygenTranslator/src/.deps/DoxygenEntity.Po index 7d2d2e0db..7a6dbd296 100644 --- a/Source/DoxygenTranslator/src/.deps/DoxygenEntity.Po +++ b/Source/DoxygenTranslator/src/.deps/DoxygenEntity.Po @@ -1,36 +1,42 @@ DoxygenTranslator/src/DoxygenEntity.o \ DoxygenTranslator/src/DoxygenEntity.o: \ DoxygenTranslator/src/DoxygenEntity.cpp \ - DoxygenTranslator/src/DoxygenEntity.h /usr/include/c++/4.2/cstdlib \ + DoxygenTranslator/src/DoxygenEntity.h /usr/include/c++/4.2/string \ /usr/include/c++/4.2/i486-linux-gnu/bits/c++config.h \ /usr/include/c++/4.2/i486-linux-gnu/bits/os_defines.h \ /usr/include/features.h /usr/include/sys/cdefs.h \ /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ /usr/include/gnu/stubs-32.h \ /usr/include/c++/4.2/i486-linux-gnu/bits/cpu_defines.h \ + /usr/include/c++/4.2/bits/stringfwd.h \ + /usr/include/c++/4.2/bits/char_traits.h /usr/include/c++/4.2/cstring \ /usr/include/c++/4.2/cstddef \ /usr/lib/gcc/i486-linux-gnu/4.2.3/include/stddef.h \ + /usr/include/string.h /usr/include/xlocale.h \ + /usr/include/c++/4.2/bits/stl_algobase.h /usr/include/c++/4.2/climits \ + /usr/lib/gcc/i486-linux-gnu/4.2.3/include/limits.h \ + /usr/lib/gcc/i486-linux-gnu/4.2.3/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/xopen_lim.h \ + /usr/include/bits/stdio_lim.h /usr/include/c++/4.2/cstdlib \ /usr/include/stdlib.h /usr/include/bits/waitflags.h \ /usr/include/bits/waitstatus.h /usr/include/endian.h \ - /usr/include/bits/endian.h /usr/include/xlocale.h \ - /usr/include/sys/types.h /usr/include/bits/types.h \ - /usr/include/bits/typesizes.h /usr/include/time.h \ - /usr/include/sys/select.h /usr/include/bits/select.h \ - /usr/include/bits/sigset.h /usr/include/bits/time.h \ - /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ - /usr/include/alloca.h /usr/include/c++/4.2/iostream \ - /usr/include/c++/4.2/ostream /usr/include/c++/4.2/ios \ + /usr/include/bits/endian.h /usr/include/sys/types.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/time.h /usr/include/sys/select.h \ + /usr/include/bits/select.h /usr/include/bits/sigset.h \ + /usr/include/bits/time.h /usr/include/sys/sysmacros.h \ + /usr/include/bits/pthreadtypes.h /usr/include/alloca.h \ /usr/include/c++/4.2/iosfwd \ /usr/include/c++/4.2/i486-linux-gnu/bits/c++locale.h \ - /usr/include/c++/4.2/cstring /usr/include/string.h \ /usr/include/c++/4.2/cstdio /usr/include/stdio.h /usr/include/libio.h \ /usr/include/_G_config.h /usr/include/wchar.h \ /usr/lib/gcc/i486-linux-gnu/4.2.3/include/stdarg.h \ - /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ - /usr/include/c++/4.2/clocale /usr/include/locale.h \ - /usr/include/bits/locale.h /usr/include/langinfo.h \ - /usr/include/nl_types.h /usr/include/iconv.h /usr/include/libintl.h \ - /usr/include/c++/4.2/cstdarg \ + /usr/include/bits/sys_errlist.h /usr/include/c++/4.2/clocale \ + /usr/include/locale.h /usr/include/bits/locale.h \ + /usr/include/langinfo.h /usr/include/nl_types.h /usr/include/iconv.h \ + /usr/include/libintl.h /usr/include/c++/4.2/cstdarg \ /usr/include/c++/4.2/i486-linux-gnu/bits/c++io.h \ /usr/include/c++/4.2/i486-linux-gnu/bits/gthr.h \ /usr/include/c++/4.2/i486-linux-gnu/bits/gthr-default.h \ @@ -39,18 +45,10 @@ DoxygenTranslator/src/DoxygenEntity.o \ /usr/include/bits/posix_opt.h /usr/include/bits/environments.h \ /usr/include/bits/confname.h /usr/include/getopt.h \ /usr/include/c++/4.2/cctype /usr/include/ctype.h \ - /usr/include/c++/4.2/bits/stringfwd.h \ /usr/include/c++/4.2/bits/postypes.h /usr/include/c++/4.2/cwchar \ /usr/include/c++/4.2/ctime /usr/include/bits/wchar.h \ /usr/include/stdint.h /usr/include/c++/4.2/bits/functexcept.h \ - /usr/include/c++/4.2/exception_defines.h /usr/include/c++/4.2/exception \ - /usr/include/c++/4.2/bits/char_traits.h \ - /usr/include/c++/4.2/bits/stl_algobase.h /usr/include/c++/4.2/climits \ - /usr/lib/gcc/i486-linux-gnu/4.2.3/include/limits.h \ - /usr/lib/gcc/i486-linux-gnu/4.2.3/include/syslimits.h \ - /usr/include/limits.h /usr/include/bits/posix1_lim.h \ - /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ - /usr/include/bits/posix2_lim.h /usr/include/bits/xopen_lim.h \ + /usr/include/c++/4.2/exception_defines.h \ /usr/include/c++/4.2/bits/stl_pair.h \ /usr/include/c++/4.2/bits/cpp_type_traits.h \ /usr/include/c++/4.2/ext/type_traits.h /usr/include/c++/4.2/utility \ @@ -59,25 +57,28 @@ DoxygenTranslator/src/DoxygenEntity.o \ /usr/include/c++/4.2/bits/stl_iterator_base_funcs.h \ /usr/include/c++/4.2/bits/concept_check.h \ /usr/include/c++/4.2/bits/stl_iterator.h \ - /usr/include/c++/4.2/debug/debug.h \ - /usr/include/c++/4.2/bits/localefwd.h \ - /usr/include/c++/4.2/bits/ios_base.h \ - /usr/include/c++/4.2/ext/atomicity.h \ - /usr/include/c++/4.2/i486-linux-gnu/bits/atomic_word.h \ - /usr/include/c++/4.2/bits/locale_classes.h /usr/include/c++/4.2/string \ - /usr/include/c++/4.2/memory /usr/include/c++/4.2/bits/allocator.h \ + /usr/include/c++/4.2/debug/debug.h /usr/include/c++/4.2/memory \ + /usr/include/c++/4.2/bits/allocator.h \ /usr/include/c++/4.2/i486-linux-gnu/bits/c++allocator.h \ /usr/include/c++/4.2/ext/new_allocator.h /usr/include/c++/4.2/new \ + /usr/include/c++/4.2/exception \ /usr/include/c++/4.2/bits/stl_construct.h \ /usr/include/c++/4.2/bits/stl_uninitialized.h \ /usr/include/c++/4.2/bits/stl_raw_storage_iter.h \ /usr/include/c++/4.2/limits /usr/include/c++/4.2/bits/ostream_insert.h \ /usr/include/c++/4.2/bits/stl_function.h \ - /usr/include/c++/4.2/bits/basic_string.h /usr/include/c++/4.2/algorithm \ - /usr/include/c++/4.2/bits/stl_algo.h \ + /usr/include/c++/4.2/bits/basic_string.h \ + /usr/include/c++/4.2/ext/atomicity.h \ + /usr/include/c++/4.2/i486-linux-gnu/bits/atomic_word.h \ + /usr/include/c++/4.2/algorithm /usr/include/c++/4.2/bits/stl_algo.h \ /usr/include/c++/4.2/bits/stl_heap.h \ /usr/include/c++/4.2/bits/stl_tempbuf.h \ - /usr/include/c++/4.2/bits/basic_string.tcc \ + /usr/include/c++/4.2/bits/basic_string.tcc /usr/include/c++/4.2/list \ + /usr/include/c++/4.2/bits/stl_list.h /usr/include/c++/4.2/bits/list.tcc \ + /usr/include/c++/4.2/iostream /usr/include/c++/4.2/ostream \ + /usr/include/c++/4.2/ios /usr/include/c++/4.2/bits/localefwd.h \ + /usr/include/c++/4.2/bits/ios_base.h \ + /usr/include/c++/4.2/bits/locale_classes.h \ /usr/include/c++/4.2/streambuf /usr/include/c++/4.2/bits/streambuf.tcc \ /usr/include/c++/4.2/bits/basic_ios.h \ /usr/include/c++/4.2/bits/streambuf_iterator.h \ @@ -92,12 +93,11 @@ DoxygenTranslator/src/DoxygenEntity.o \ /usr/include/c++/4.2/bits/ostream.tcc /usr/include/c++/4.2/locale \ /usr/include/c++/4.2/bits/locale_facets.tcc \ /usr/include/c++/4.2/typeinfo /usr/include/c++/4.2/istream \ - /usr/include/c++/4.2/bits/istream.tcc /usr/include/c++/4.2/list \ - /usr/include/c++/4.2/bits/stl_list.h /usr/include/c++/4.2/bits/list.tcc + /usr/include/c++/4.2/bits/istream.tcc DoxygenTranslator/src/DoxygenEntity.h: -/usr/include/c++/4.2/cstdlib: +/usr/include/c++/4.2/string: /usr/include/c++/4.2/i486-linux-gnu/bits/c++config.h: @@ -115,10 +115,44 @@ DoxygenTranslator/src/DoxygenEntity.h: /usr/include/c++/4.2/i486-linux-gnu/bits/cpu_defines.h: +/usr/include/c++/4.2/bits/stringfwd.h: + +/usr/include/c++/4.2/bits/char_traits.h: + +/usr/include/c++/4.2/cstring: + /usr/include/c++/4.2/cstddef: /usr/lib/gcc/i486-linux-gnu/4.2.3/include/stddef.h: +/usr/include/string.h: + +/usr/include/xlocale.h: + +/usr/include/c++/4.2/bits/stl_algobase.h: + +/usr/include/c++/4.2/climits: + +/usr/lib/gcc/i486-linux-gnu/4.2.3/include/limits.h: + +/usr/lib/gcc/i486-linux-gnu/4.2.3/include/syslimits.h: + +/usr/include/limits.h: + +/usr/include/bits/posix1_lim.h: + +/usr/include/bits/local_lim.h: + +/usr/include/linux/limits.h: + +/usr/include/bits/posix2_lim.h: + +/usr/include/bits/xopen_lim.h: + +/usr/include/bits/stdio_lim.h: + +/usr/include/c++/4.2/cstdlib: + /usr/include/stdlib.h: /usr/include/bits/waitflags.h: @@ -129,8 +163,6 @@ DoxygenTranslator/src/DoxygenEntity.h: /usr/include/bits/endian.h: -/usr/include/xlocale.h: - /usr/include/sys/types.h: /usr/include/bits/types.h: @@ -153,20 +185,10 @@ DoxygenTranslator/src/DoxygenEntity.h: /usr/include/alloca.h: -/usr/include/c++/4.2/iostream: - -/usr/include/c++/4.2/ostream: - -/usr/include/c++/4.2/ios: - /usr/include/c++/4.2/iosfwd: /usr/include/c++/4.2/i486-linux-gnu/bits/c++locale.h: -/usr/include/c++/4.2/cstring: - -/usr/include/string.h: - /usr/include/c++/4.2/cstdio: /usr/include/stdio.h: @@ -179,8 +201,6 @@ DoxygenTranslator/src/DoxygenEntity.h: /usr/lib/gcc/i486-linux-gnu/4.2.3/include/stdarg.h: -/usr/include/bits/stdio_lim.h: - /usr/include/bits/sys_errlist.h: /usr/include/c++/4.2/clocale: @@ -229,8 +249,6 @@ DoxygenTranslator/src/DoxygenEntity.h: /usr/include/ctype.h: -/usr/include/c++/4.2/bits/stringfwd.h: - /usr/include/c++/4.2/bits/postypes.h: /usr/include/c++/4.2/cwchar: @@ -245,30 +263,6 @@ DoxygenTranslator/src/DoxygenEntity.h: /usr/include/c++/4.2/exception_defines.h: -/usr/include/c++/4.2/exception: - -/usr/include/c++/4.2/bits/char_traits.h: - -/usr/include/c++/4.2/bits/stl_algobase.h: - -/usr/include/c++/4.2/climits: - -/usr/lib/gcc/i486-linux-gnu/4.2.3/include/limits.h: - -/usr/lib/gcc/i486-linux-gnu/4.2.3/include/syslimits.h: - -/usr/include/limits.h: - -/usr/include/bits/posix1_lim.h: - -/usr/include/bits/local_lim.h: - -/usr/include/linux/limits.h: - -/usr/include/bits/posix2_lim.h: - -/usr/include/bits/xopen_lim.h: - /usr/include/c++/4.2/bits/stl_pair.h: /usr/include/c++/4.2/bits/cpp_type_traits.h: @@ -289,18 +283,6 @@ DoxygenTranslator/src/DoxygenEntity.h: /usr/include/c++/4.2/debug/debug.h: -/usr/include/c++/4.2/bits/localefwd.h: - -/usr/include/c++/4.2/bits/ios_base.h: - -/usr/include/c++/4.2/ext/atomicity.h: - -/usr/include/c++/4.2/i486-linux-gnu/bits/atomic_word.h: - -/usr/include/c++/4.2/bits/locale_classes.h: - -/usr/include/c++/4.2/string: - /usr/include/c++/4.2/memory: /usr/include/c++/4.2/bits/allocator.h: @@ -311,6 +293,8 @@ DoxygenTranslator/src/DoxygenEntity.h: /usr/include/c++/4.2/new: +/usr/include/c++/4.2/exception: + /usr/include/c++/4.2/bits/stl_construct.h: /usr/include/c++/4.2/bits/stl_uninitialized.h: @@ -325,6 +309,10 @@ DoxygenTranslator/src/DoxygenEntity.h: /usr/include/c++/4.2/bits/basic_string.h: +/usr/include/c++/4.2/ext/atomicity.h: + +/usr/include/c++/4.2/i486-linux-gnu/bits/atomic_word.h: + /usr/include/c++/4.2/algorithm: /usr/include/c++/4.2/bits/stl_algo.h: @@ -335,6 +323,24 @@ DoxygenTranslator/src/DoxygenEntity.h: /usr/include/c++/4.2/bits/basic_string.tcc: +/usr/include/c++/4.2/list: + +/usr/include/c++/4.2/bits/stl_list.h: + +/usr/include/c++/4.2/bits/list.tcc: + +/usr/include/c++/4.2/iostream: + +/usr/include/c++/4.2/ostream: + +/usr/include/c++/4.2/ios: + +/usr/include/c++/4.2/bits/localefwd.h: + +/usr/include/c++/4.2/bits/ios_base.h: + +/usr/include/c++/4.2/bits/locale_classes.h: + /usr/include/c++/4.2/streambuf: /usr/include/c++/4.2/bits/streambuf.tcc: @@ -372,9 +378,3 @@ DoxygenTranslator/src/DoxygenEntity.h: /usr/include/c++/4.2/istream: /usr/include/c++/4.2/bits/istream.tcc: - -/usr/include/c++/4.2/list: - -/usr/include/c++/4.2/bits/stl_list.h: - -/usr/include/c++/4.2/bits/list.tcc: diff --git a/Source/DoxygenTranslator/src/.deps/DoxygenParser.Po b/Source/DoxygenTranslator/src/.deps/DoxygenParser.Po index 3a023d6b9..8ec874c8c 100644 --- a/Source/DoxygenTranslator/src/.deps/DoxygenParser.Po +++ b/Source/DoxygenTranslator/src/.deps/DoxygenParser.Po @@ -1,36 +1,42 @@ DoxygenTranslator/src/DoxygenParser.o \ DoxygenTranslator/src/DoxygenParser.o: \ DoxygenTranslator/src/DoxygenParser.cpp \ - DoxygenTranslator/src/DoxygenParser.h /usr/include/c++/4.2/cstdlib \ + DoxygenTranslator/src/DoxygenParser.h /usr/include/c++/4.2/string \ /usr/include/c++/4.2/i486-linux-gnu/bits/c++config.h \ /usr/include/c++/4.2/i486-linux-gnu/bits/os_defines.h \ /usr/include/features.h /usr/include/sys/cdefs.h \ /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ /usr/include/gnu/stubs-32.h \ /usr/include/c++/4.2/i486-linux-gnu/bits/cpu_defines.h \ + /usr/include/c++/4.2/bits/stringfwd.h \ + /usr/include/c++/4.2/bits/char_traits.h /usr/include/c++/4.2/cstring \ /usr/include/c++/4.2/cstddef \ /usr/lib/gcc/i486-linux-gnu/4.2.3/include/stddef.h \ + /usr/include/string.h /usr/include/xlocale.h \ + /usr/include/c++/4.2/bits/stl_algobase.h /usr/include/c++/4.2/climits \ + /usr/lib/gcc/i486-linux-gnu/4.2.3/include/limits.h \ + /usr/lib/gcc/i486-linux-gnu/4.2.3/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/xopen_lim.h \ + /usr/include/bits/stdio_lim.h /usr/include/c++/4.2/cstdlib \ /usr/include/stdlib.h /usr/include/bits/waitflags.h \ /usr/include/bits/waitstatus.h /usr/include/endian.h \ - /usr/include/bits/endian.h /usr/include/xlocale.h \ - /usr/include/sys/types.h /usr/include/bits/types.h \ - /usr/include/bits/typesizes.h /usr/include/time.h \ - /usr/include/sys/select.h /usr/include/bits/select.h \ - /usr/include/bits/sigset.h /usr/include/bits/time.h \ - /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ - /usr/include/alloca.h /usr/include/c++/4.2/iostream \ - /usr/include/c++/4.2/ostream /usr/include/c++/4.2/ios \ + /usr/include/bits/endian.h /usr/include/sys/types.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/time.h /usr/include/sys/select.h \ + /usr/include/bits/select.h /usr/include/bits/sigset.h \ + /usr/include/bits/time.h /usr/include/sys/sysmacros.h \ + /usr/include/bits/pthreadtypes.h /usr/include/alloca.h \ /usr/include/c++/4.2/iosfwd \ /usr/include/c++/4.2/i486-linux-gnu/bits/c++locale.h \ - /usr/include/c++/4.2/cstring /usr/include/string.h \ /usr/include/c++/4.2/cstdio /usr/include/stdio.h /usr/include/libio.h \ /usr/include/_G_config.h /usr/include/wchar.h \ /usr/lib/gcc/i486-linux-gnu/4.2.3/include/stdarg.h \ - /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ - /usr/include/c++/4.2/clocale /usr/include/locale.h \ - /usr/include/bits/locale.h /usr/include/langinfo.h \ - /usr/include/nl_types.h /usr/include/iconv.h /usr/include/libintl.h \ - /usr/include/c++/4.2/cstdarg \ + /usr/include/bits/sys_errlist.h /usr/include/c++/4.2/clocale \ + /usr/include/locale.h /usr/include/bits/locale.h \ + /usr/include/langinfo.h /usr/include/nl_types.h /usr/include/iconv.h \ + /usr/include/libintl.h /usr/include/c++/4.2/cstdarg \ /usr/include/c++/4.2/i486-linux-gnu/bits/c++io.h \ /usr/include/c++/4.2/i486-linux-gnu/bits/gthr.h \ /usr/include/c++/4.2/i486-linux-gnu/bits/gthr-default.h \ @@ -39,18 +45,10 @@ DoxygenTranslator/src/DoxygenParser.o \ /usr/include/bits/posix_opt.h /usr/include/bits/environments.h \ /usr/include/bits/confname.h /usr/include/getopt.h \ /usr/include/c++/4.2/cctype /usr/include/ctype.h \ - /usr/include/c++/4.2/bits/stringfwd.h \ /usr/include/c++/4.2/bits/postypes.h /usr/include/c++/4.2/cwchar \ /usr/include/c++/4.2/ctime /usr/include/bits/wchar.h \ /usr/include/stdint.h /usr/include/c++/4.2/bits/functexcept.h \ - /usr/include/c++/4.2/exception_defines.h /usr/include/c++/4.2/exception \ - /usr/include/c++/4.2/bits/char_traits.h \ - /usr/include/c++/4.2/bits/stl_algobase.h /usr/include/c++/4.2/climits \ - /usr/lib/gcc/i486-linux-gnu/4.2.3/include/limits.h \ - /usr/lib/gcc/i486-linux-gnu/4.2.3/include/syslimits.h \ - /usr/include/limits.h /usr/include/bits/posix1_lim.h \ - /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ - /usr/include/bits/posix2_lim.h /usr/include/bits/xopen_lim.h \ + /usr/include/c++/4.2/exception_defines.h \ /usr/include/c++/4.2/bits/stl_pair.h \ /usr/include/c++/4.2/bits/cpp_type_traits.h \ /usr/include/c++/4.2/ext/type_traits.h /usr/include/c++/4.2/utility \ @@ -59,25 +57,29 @@ DoxygenTranslator/src/DoxygenParser.o \ /usr/include/c++/4.2/bits/stl_iterator_base_funcs.h \ /usr/include/c++/4.2/bits/concept_check.h \ /usr/include/c++/4.2/bits/stl_iterator.h \ - /usr/include/c++/4.2/debug/debug.h \ - /usr/include/c++/4.2/bits/localefwd.h \ - /usr/include/c++/4.2/bits/ios_base.h \ - /usr/include/c++/4.2/ext/atomicity.h \ - /usr/include/c++/4.2/i486-linux-gnu/bits/atomic_word.h \ - /usr/include/c++/4.2/bits/locale_classes.h /usr/include/c++/4.2/string \ - /usr/include/c++/4.2/memory /usr/include/c++/4.2/bits/allocator.h \ + /usr/include/c++/4.2/debug/debug.h /usr/include/c++/4.2/memory \ + /usr/include/c++/4.2/bits/allocator.h \ /usr/include/c++/4.2/i486-linux-gnu/bits/c++allocator.h \ /usr/include/c++/4.2/ext/new_allocator.h /usr/include/c++/4.2/new \ + /usr/include/c++/4.2/exception \ /usr/include/c++/4.2/bits/stl_construct.h \ /usr/include/c++/4.2/bits/stl_uninitialized.h \ /usr/include/c++/4.2/bits/stl_raw_storage_iter.h \ /usr/include/c++/4.2/limits /usr/include/c++/4.2/bits/ostream_insert.h \ /usr/include/c++/4.2/bits/stl_function.h \ - /usr/include/c++/4.2/bits/basic_string.h /usr/include/c++/4.2/algorithm \ - /usr/include/c++/4.2/bits/stl_algo.h \ + /usr/include/c++/4.2/bits/basic_string.h \ + /usr/include/c++/4.2/ext/atomicity.h \ + /usr/include/c++/4.2/i486-linux-gnu/bits/atomic_word.h \ + /usr/include/c++/4.2/algorithm /usr/include/c++/4.2/bits/stl_algo.h \ /usr/include/c++/4.2/bits/stl_heap.h \ /usr/include/c++/4.2/bits/stl_tempbuf.h \ - /usr/include/c++/4.2/bits/basic_string.tcc \ + /usr/include/c++/4.2/bits/basic_string.tcc /usr/include/c++/4.2/list \ + /usr/include/c++/4.2/bits/stl_list.h /usr/include/c++/4.2/bits/list.tcc \ + DoxygenTranslator/src/DoxygenEntity.h DoxygenTranslator/src/TokenList.h \ + /usr/include/c++/4.2/iostream /usr/include/c++/4.2/ostream \ + /usr/include/c++/4.2/ios /usr/include/c++/4.2/bits/localefwd.h \ + /usr/include/c++/4.2/bits/ios_base.h \ + /usr/include/c++/4.2/bits/locale_classes.h \ /usr/include/c++/4.2/streambuf /usr/include/c++/4.2/bits/streambuf.tcc \ /usr/include/c++/4.2/bits/basic_ios.h \ /usr/include/c++/4.2/bits/streambuf_iterator.h \ @@ -92,16 +94,11 @@ DoxygenTranslator/src/DoxygenParser.o \ /usr/include/c++/4.2/bits/ostream.tcc /usr/include/c++/4.2/locale \ /usr/include/c++/4.2/bits/locale_facets.tcc \ /usr/include/c++/4.2/typeinfo /usr/include/c++/4.2/istream \ - /usr/include/c++/4.2/bits/istream.tcc /usr/include/c++/4.2/fstream \ - /usr/include/c++/4.2/i486-linux-gnu/bits/basic_file.h \ - /usr/include/c++/4.2/bits/fstream.tcc /usr/include/c++/4.2/list \ - /usr/include/c++/4.2/bits/stl_list.h /usr/include/c++/4.2/bits/list.tcc \ - DoxygenTranslator/src/DoxygenEntity.h DoxygenTranslator/src/TokenList.h \ - DoxygenTranslator/src/Token.h DoxygenTranslator/src/JavaDocConverter.h + /usr/include/c++/4.2/bits/istream.tcc DoxygenTranslator/src/Token.h DoxygenTranslator/src/DoxygenParser.h: -/usr/include/c++/4.2/cstdlib: +/usr/include/c++/4.2/string: /usr/include/c++/4.2/i486-linux-gnu/bits/c++config.h: @@ -119,10 +116,44 @@ DoxygenTranslator/src/DoxygenParser.h: /usr/include/c++/4.2/i486-linux-gnu/bits/cpu_defines.h: +/usr/include/c++/4.2/bits/stringfwd.h: + +/usr/include/c++/4.2/bits/char_traits.h: + +/usr/include/c++/4.2/cstring: + /usr/include/c++/4.2/cstddef: /usr/lib/gcc/i486-linux-gnu/4.2.3/include/stddef.h: +/usr/include/string.h: + +/usr/include/xlocale.h: + +/usr/include/c++/4.2/bits/stl_algobase.h: + +/usr/include/c++/4.2/climits: + +/usr/lib/gcc/i486-linux-gnu/4.2.3/include/limits.h: + +/usr/lib/gcc/i486-linux-gnu/4.2.3/include/syslimits.h: + +/usr/include/limits.h: + +/usr/include/bits/posix1_lim.h: + +/usr/include/bits/local_lim.h: + +/usr/include/linux/limits.h: + +/usr/include/bits/posix2_lim.h: + +/usr/include/bits/xopen_lim.h: + +/usr/include/bits/stdio_lim.h: + +/usr/include/c++/4.2/cstdlib: + /usr/include/stdlib.h: /usr/include/bits/waitflags.h: @@ -133,8 +164,6 @@ DoxygenTranslator/src/DoxygenParser.h: /usr/include/bits/endian.h: -/usr/include/xlocale.h: - /usr/include/sys/types.h: /usr/include/bits/types.h: @@ -157,20 +186,10 @@ DoxygenTranslator/src/DoxygenParser.h: /usr/include/alloca.h: -/usr/include/c++/4.2/iostream: - -/usr/include/c++/4.2/ostream: - -/usr/include/c++/4.2/ios: - /usr/include/c++/4.2/iosfwd: /usr/include/c++/4.2/i486-linux-gnu/bits/c++locale.h: -/usr/include/c++/4.2/cstring: - -/usr/include/string.h: - /usr/include/c++/4.2/cstdio: /usr/include/stdio.h: @@ -183,8 +202,6 @@ DoxygenTranslator/src/DoxygenParser.h: /usr/lib/gcc/i486-linux-gnu/4.2.3/include/stdarg.h: -/usr/include/bits/stdio_lim.h: - /usr/include/bits/sys_errlist.h: /usr/include/c++/4.2/clocale: @@ -233,8 +250,6 @@ DoxygenTranslator/src/DoxygenParser.h: /usr/include/ctype.h: -/usr/include/c++/4.2/bits/stringfwd.h: - /usr/include/c++/4.2/bits/postypes.h: /usr/include/c++/4.2/cwchar: @@ -249,30 +264,6 @@ DoxygenTranslator/src/DoxygenParser.h: /usr/include/c++/4.2/exception_defines.h: -/usr/include/c++/4.2/exception: - -/usr/include/c++/4.2/bits/char_traits.h: - -/usr/include/c++/4.2/bits/stl_algobase.h: - -/usr/include/c++/4.2/climits: - -/usr/lib/gcc/i486-linux-gnu/4.2.3/include/limits.h: - -/usr/lib/gcc/i486-linux-gnu/4.2.3/include/syslimits.h: - -/usr/include/limits.h: - -/usr/include/bits/posix1_lim.h: - -/usr/include/bits/local_lim.h: - -/usr/include/linux/limits.h: - -/usr/include/bits/posix2_lim.h: - -/usr/include/bits/xopen_lim.h: - /usr/include/c++/4.2/bits/stl_pair.h: /usr/include/c++/4.2/bits/cpp_type_traits.h: @@ -293,18 +284,6 @@ DoxygenTranslator/src/DoxygenParser.h: /usr/include/c++/4.2/debug/debug.h: -/usr/include/c++/4.2/bits/localefwd.h: - -/usr/include/c++/4.2/bits/ios_base.h: - -/usr/include/c++/4.2/ext/atomicity.h: - -/usr/include/c++/4.2/i486-linux-gnu/bits/atomic_word.h: - -/usr/include/c++/4.2/bits/locale_classes.h: - -/usr/include/c++/4.2/string: - /usr/include/c++/4.2/memory: /usr/include/c++/4.2/bits/allocator.h: @@ -315,6 +294,8 @@ DoxygenTranslator/src/DoxygenParser.h: /usr/include/c++/4.2/new: +/usr/include/c++/4.2/exception: + /usr/include/c++/4.2/bits/stl_construct.h: /usr/include/c++/4.2/bits/stl_uninitialized.h: @@ -329,6 +310,10 @@ DoxygenTranslator/src/DoxygenParser.h: /usr/include/c++/4.2/bits/basic_string.h: +/usr/include/c++/4.2/ext/atomicity.h: + +/usr/include/c++/4.2/i486-linux-gnu/bits/atomic_word.h: + /usr/include/c++/4.2/algorithm: /usr/include/c++/4.2/bits/stl_algo.h: @@ -339,6 +324,28 @@ DoxygenTranslator/src/DoxygenParser.h: /usr/include/c++/4.2/bits/basic_string.tcc: +/usr/include/c++/4.2/list: + +/usr/include/c++/4.2/bits/stl_list.h: + +/usr/include/c++/4.2/bits/list.tcc: + +DoxygenTranslator/src/DoxygenEntity.h: + +DoxygenTranslator/src/TokenList.h: + +/usr/include/c++/4.2/iostream: + +/usr/include/c++/4.2/ostream: + +/usr/include/c++/4.2/ios: + +/usr/include/c++/4.2/bits/localefwd.h: + +/usr/include/c++/4.2/bits/ios_base.h: + +/usr/include/c++/4.2/bits/locale_classes.h: + /usr/include/c++/4.2/streambuf: /usr/include/c++/4.2/bits/streambuf.tcc: @@ -377,22 +384,4 @@ DoxygenTranslator/src/DoxygenParser.h: /usr/include/c++/4.2/bits/istream.tcc: -/usr/include/c++/4.2/fstream: - -/usr/include/c++/4.2/i486-linux-gnu/bits/basic_file.h: - -/usr/include/c++/4.2/bits/fstream.tcc: - -/usr/include/c++/4.2/list: - -/usr/include/c++/4.2/bits/stl_list.h: - -/usr/include/c++/4.2/bits/list.tcc: - -DoxygenTranslator/src/DoxygenEntity.h: - -DoxygenTranslator/src/TokenList.h: - DoxygenTranslator/src/Token.h: - -DoxygenTranslator/src/JavaDocConverter.h: diff --git a/Source/DoxygenTranslator/src/.deps/DoxygenTranslator.Po b/Source/DoxygenTranslator/src/.deps/DoxygenTranslator.Po index d71e23830..4cec6c648 100644 --- a/Source/DoxygenTranslator/src/.deps/DoxygenTranslator.Po +++ b/Source/DoxygenTranslator/src/.deps/DoxygenTranslator.Po @@ -1,36 +1,42 @@ DoxygenTranslator/src/DoxygenTranslator.o \ DoxygenTranslator/src/DoxygenTranslator.o: \ DoxygenTranslator/src/DoxygenTranslator.cpp \ - DoxygenTranslator/src/DoxygenParser.h /usr/include/c++/4.2/cstdlib \ + DoxygenTranslator/src/DoxygenParser.h /usr/include/c++/4.2/string \ /usr/include/c++/4.2/i486-linux-gnu/bits/c++config.h \ /usr/include/c++/4.2/i486-linux-gnu/bits/os_defines.h \ /usr/include/features.h /usr/include/sys/cdefs.h \ /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ /usr/include/gnu/stubs-32.h \ /usr/include/c++/4.2/i486-linux-gnu/bits/cpu_defines.h \ + /usr/include/c++/4.2/bits/stringfwd.h \ + /usr/include/c++/4.2/bits/char_traits.h /usr/include/c++/4.2/cstring \ /usr/include/c++/4.2/cstddef \ /usr/lib/gcc/i486-linux-gnu/4.2.3/include/stddef.h \ + /usr/include/string.h /usr/include/xlocale.h \ + /usr/include/c++/4.2/bits/stl_algobase.h /usr/include/c++/4.2/climits \ + /usr/lib/gcc/i486-linux-gnu/4.2.3/include/limits.h \ + /usr/lib/gcc/i486-linux-gnu/4.2.3/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/xopen_lim.h \ + /usr/include/bits/stdio_lim.h /usr/include/c++/4.2/cstdlib \ /usr/include/stdlib.h /usr/include/bits/waitflags.h \ /usr/include/bits/waitstatus.h /usr/include/endian.h \ - /usr/include/bits/endian.h /usr/include/xlocale.h \ - /usr/include/sys/types.h /usr/include/bits/types.h \ - /usr/include/bits/typesizes.h /usr/include/time.h \ - /usr/include/sys/select.h /usr/include/bits/select.h \ - /usr/include/bits/sigset.h /usr/include/bits/time.h \ - /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ - /usr/include/alloca.h /usr/include/c++/4.2/iostream \ - /usr/include/c++/4.2/ostream /usr/include/c++/4.2/ios \ + /usr/include/bits/endian.h /usr/include/sys/types.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/time.h /usr/include/sys/select.h \ + /usr/include/bits/select.h /usr/include/bits/sigset.h \ + /usr/include/bits/time.h /usr/include/sys/sysmacros.h \ + /usr/include/bits/pthreadtypes.h /usr/include/alloca.h \ /usr/include/c++/4.2/iosfwd \ /usr/include/c++/4.2/i486-linux-gnu/bits/c++locale.h \ - /usr/include/c++/4.2/cstring /usr/include/string.h \ /usr/include/c++/4.2/cstdio /usr/include/stdio.h /usr/include/libio.h \ /usr/include/_G_config.h /usr/include/wchar.h \ /usr/lib/gcc/i486-linux-gnu/4.2.3/include/stdarg.h \ - /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ - /usr/include/c++/4.2/clocale /usr/include/locale.h \ - /usr/include/bits/locale.h /usr/include/langinfo.h \ - /usr/include/nl_types.h /usr/include/iconv.h /usr/include/libintl.h \ - /usr/include/c++/4.2/cstdarg \ + /usr/include/bits/sys_errlist.h /usr/include/c++/4.2/clocale \ + /usr/include/locale.h /usr/include/bits/locale.h \ + /usr/include/langinfo.h /usr/include/nl_types.h /usr/include/iconv.h \ + /usr/include/libintl.h /usr/include/c++/4.2/cstdarg \ /usr/include/c++/4.2/i486-linux-gnu/bits/c++io.h \ /usr/include/c++/4.2/i486-linux-gnu/bits/gthr.h \ /usr/include/c++/4.2/i486-linux-gnu/bits/gthr-default.h \ @@ -39,18 +45,10 @@ DoxygenTranslator/src/DoxygenTranslator.o \ /usr/include/bits/posix_opt.h /usr/include/bits/environments.h \ /usr/include/bits/confname.h /usr/include/getopt.h \ /usr/include/c++/4.2/cctype /usr/include/ctype.h \ - /usr/include/c++/4.2/bits/stringfwd.h \ /usr/include/c++/4.2/bits/postypes.h /usr/include/c++/4.2/cwchar \ /usr/include/c++/4.2/ctime /usr/include/bits/wchar.h \ /usr/include/stdint.h /usr/include/c++/4.2/bits/functexcept.h \ - /usr/include/c++/4.2/exception_defines.h /usr/include/c++/4.2/exception \ - /usr/include/c++/4.2/bits/char_traits.h \ - /usr/include/c++/4.2/bits/stl_algobase.h /usr/include/c++/4.2/climits \ - /usr/lib/gcc/i486-linux-gnu/4.2.3/include/limits.h \ - /usr/lib/gcc/i486-linux-gnu/4.2.3/include/syslimits.h \ - /usr/include/limits.h /usr/include/bits/posix1_lim.h \ - /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ - /usr/include/bits/posix2_lim.h /usr/include/bits/xopen_lim.h \ + /usr/include/c++/4.2/exception_defines.h \ /usr/include/c++/4.2/bits/stl_pair.h \ /usr/include/c++/4.2/bits/cpp_type_traits.h \ /usr/include/c++/4.2/ext/type_traits.h /usr/include/c++/4.2/utility \ @@ -59,25 +57,30 @@ DoxygenTranslator/src/DoxygenTranslator.o \ /usr/include/c++/4.2/bits/stl_iterator_base_funcs.h \ /usr/include/c++/4.2/bits/concept_check.h \ /usr/include/c++/4.2/bits/stl_iterator.h \ - /usr/include/c++/4.2/debug/debug.h \ - /usr/include/c++/4.2/bits/localefwd.h \ - /usr/include/c++/4.2/bits/ios_base.h \ - /usr/include/c++/4.2/ext/atomicity.h \ - /usr/include/c++/4.2/i486-linux-gnu/bits/atomic_word.h \ - /usr/include/c++/4.2/bits/locale_classes.h /usr/include/c++/4.2/string \ - /usr/include/c++/4.2/memory /usr/include/c++/4.2/bits/allocator.h \ + /usr/include/c++/4.2/debug/debug.h /usr/include/c++/4.2/memory \ + /usr/include/c++/4.2/bits/allocator.h \ /usr/include/c++/4.2/i486-linux-gnu/bits/c++allocator.h \ /usr/include/c++/4.2/ext/new_allocator.h /usr/include/c++/4.2/new \ + /usr/include/c++/4.2/exception \ /usr/include/c++/4.2/bits/stl_construct.h \ /usr/include/c++/4.2/bits/stl_uninitialized.h \ /usr/include/c++/4.2/bits/stl_raw_storage_iter.h \ /usr/include/c++/4.2/limits /usr/include/c++/4.2/bits/ostream_insert.h \ /usr/include/c++/4.2/bits/stl_function.h \ - /usr/include/c++/4.2/bits/basic_string.h /usr/include/c++/4.2/algorithm \ - /usr/include/c++/4.2/bits/stl_algo.h \ + /usr/include/c++/4.2/bits/basic_string.h \ + /usr/include/c++/4.2/ext/atomicity.h \ + /usr/include/c++/4.2/i486-linux-gnu/bits/atomic_word.h \ + /usr/include/c++/4.2/algorithm /usr/include/c++/4.2/bits/stl_algo.h \ /usr/include/c++/4.2/bits/stl_heap.h \ /usr/include/c++/4.2/bits/stl_tempbuf.h \ - /usr/include/c++/4.2/bits/basic_string.tcc \ + /usr/include/c++/4.2/bits/basic_string.tcc /usr/include/c++/4.2/list \ + /usr/include/c++/4.2/bits/stl_list.h /usr/include/c++/4.2/bits/list.tcc \ + DoxygenTranslator/src/DoxygenEntity.h \ + DoxygenTranslator/src/DoxygenTranslator.h /usr/include/c++/4.2/iostream \ + /usr/include/c++/4.2/ostream /usr/include/c++/4.2/ios \ + /usr/include/c++/4.2/bits/localefwd.h \ + /usr/include/c++/4.2/bits/ios_base.h \ + /usr/include/c++/4.2/bits/locale_classes.h \ /usr/include/c++/4.2/streambuf /usr/include/c++/4.2/bits/streambuf.tcc \ /usr/include/c++/4.2/bits/basic_ios.h \ /usr/include/c++/4.2/bits/streambuf_iterator.h \ @@ -94,15 +97,12 @@ DoxygenTranslator/src/DoxygenTranslator.o \ /usr/include/c++/4.2/typeinfo /usr/include/c++/4.2/istream \ /usr/include/c++/4.2/bits/istream.tcc /usr/include/c++/4.2/fstream \ /usr/include/c++/4.2/i486-linux-gnu/bits/basic_file.h \ - /usr/include/c++/4.2/bits/fstream.tcc /usr/include/c++/4.2/list \ - /usr/include/c++/4.2/bits/stl_list.h /usr/include/c++/4.2/bits/list.tcc \ - DoxygenTranslator/src/DoxygenEntity.h DoxygenTranslator/src/TokenList.h \ - DoxygenTranslator/src/Token.h DoxygenTranslator/src/JavaDocConverter.h \ - DoxygenTranslator/src/DoxygenTranslator.h + /usr/include/c++/4.2/bits/fstream.tcc DoxygenTranslator/src/TokenList.h \ + DoxygenTranslator/src/Token.h DoxygenTranslator/src/JavaDocConverter.h DoxygenTranslator/src/DoxygenParser.h: -/usr/include/c++/4.2/cstdlib: +/usr/include/c++/4.2/string: /usr/include/c++/4.2/i486-linux-gnu/bits/c++config.h: @@ -120,10 +120,44 @@ DoxygenTranslator/src/DoxygenParser.h: /usr/include/c++/4.2/i486-linux-gnu/bits/cpu_defines.h: +/usr/include/c++/4.2/bits/stringfwd.h: + +/usr/include/c++/4.2/bits/char_traits.h: + +/usr/include/c++/4.2/cstring: + /usr/include/c++/4.2/cstddef: /usr/lib/gcc/i486-linux-gnu/4.2.3/include/stddef.h: +/usr/include/string.h: + +/usr/include/xlocale.h: + +/usr/include/c++/4.2/bits/stl_algobase.h: + +/usr/include/c++/4.2/climits: + +/usr/lib/gcc/i486-linux-gnu/4.2.3/include/limits.h: + +/usr/lib/gcc/i486-linux-gnu/4.2.3/include/syslimits.h: + +/usr/include/limits.h: + +/usr/include/bits/posix1_lim.h: + +/usr/include/bits/local_lim.h: + +/usr/include/linux/limits.h: + +/usr/include/bits/posix2_lim.h: + +/usr/include/bits/xopen_lim.h: + +/usr/include/bits/stdio_lim.h: + +/usr/include/c++/4.2/cstdlib: + /usr/include/stdlib.h: /usr/include/bits/waitflags.h: @@ -134,8 +168,6 @@ DoxygenTranslator/src/DoxygenParser.h: /usr/include/bits/endian.h: -/usr/include/xlocale.h: - /usr/include/sys/types.h: /usr/include/bits/types.h: @@ -158,20 +190,10 @@ DoxygenTranslator/src/DoxygenParser.h: /usr/include/alloca.h: -/usr/include/c++/4.2/iostream: - -/usr/include/c++/4.2/ostream: - -/usr/include/c++/4.2/ios: - /usr/include/c++/4.2/iosfwd: /usr/include/c++/4.2/i486-linux-gnu/bits/c++locale.h: -/usr/include/c++/4.2/cstring: - -/usr/include/string.h: - /usr/include/c++/4.2/cstdio: /usr/include/stdio.h: @@ -184,8 +206,6 @@ DoxygenTranslator/src/DoxygenParser.h: /usr/lib/gcc/i486-linux-gnu/4.2.3/include/stdarg.h: -/usr/include/bits/stdio_lim.h: - /usr/include/bits/sys_errlist.h: /usr/include/c++/4.2/clocale: @@ -234,8 +254,6 @@ DoxygenTranslator/src/DoxygenParser.h: /usr/include/ctype.h: -/usr/include/c++/4.2/bits/stringfwd.h: - /usr/include/c++/4.2/bits/postypes.h: /usr/include/c++/4.2/cwchar: @@ -250,30 +268,6 @@ DoxygenTranslator/src/DoxygenParser.h: /usr/include/c++/4.2/exception_defines.h: -/usr/include/c++/4.2/exception: - -/usr/include/c++/4.2/bits/char_traits.h: - -/usr/include/c++/4.2/bits/stl_algobase.h: - -/usr/include/c++/4.2/climits: - -/usr/lib/gcc/i486-linux-gnu/4.2.3/include/limits.h: - -/usr/lib/gcc/i486-linux-gnu/4.2.3/include/syslimits.h: - -/usr/include/limits.h: - -/usr/include/bits/posix1_lim.h: - -/usr/include/bits/local_lim.h: - -/usr/include/linux/limits.h: - -/usr/include/bits/posix2_lim.h: - -/usr/include/bits/xopen_lim.h: - /usr/include/c++/4.2/bits/stl_pair.h: /usr/include/c++/4.2/bits/cpp_type_traits.h: @@ -294,18 +288,6 @@ DoxygenTranslator/src/DoxygenParser.h: /usr/include/c++/4.2/debug/debug.h: -/usr/include/c++/4.2/bits/localefwd.h: - -/usr/include/c++/4.2/bits/ios_base.h: - -/usr/include/c++/4.2/ext/atomicity.h: - -/usr/include/c++/4.2/i486-linux-gnu/bits/atomic_word.h: - -/usr/include/c++/4.2/bits/locale_classes.h: - -/usr/include/c++/4.2/string: - /usr/include/c++/4.2/memory: /usr/include/c++/4.2/bits/allocator.h: @@ -316,6 +298,8 @@ DoxygenTranslator/src/DoxygenParser.h: /usr/include/c++/4.2/new: +/usr/include/c++/4.2/exception: + /usr/include/c++/4.2/bits/stl_construct.h: /usr/include/c++/4.2/bits/stl_uninitialized.h: @@ -330,6 +314,10 @@ DoxygenTranslator/src/DoxygenParser.h: /usr/include/c++/4.2/bits/basic_string.h: +/usr/include/c++/4.2/ext/atomicity.h: + +/usr/include/c++/4.2/i486-linux-gnu/bits/atomic_word.h: + /usr/include/c++/4.2/algorithm: /usr/include/c++/4.2/bits/stl_algo.h: @@ -340,6 +328,28 @@ DoxygenTranslator/src/DoxygenParser.h: /usr/include/c++/4.2/bits/basic_string.tcc: +/usr/include/c++/4.2/list: + +/usr/include/c++/4.2/bits/stl_list.h: + +/usr/include/c++/4.2/bits/list.tcc: + +DoxygenTranslator/src/DoxygenEntity.h: + +DoxygenTranslator/src/DoxygenTranslator.h: + +/usr/include/c++/4.2/iostream: + +/usr/include/c++/4.2/ostream: + +/usr/include/c++/4.2/ios: + +/usr/include/c++/4.2/bits/localefwd.h: + +/usr/include/c++/4.2/bits/ios_base.h: + +/usr/include/c++/4.2/bits/locale_classes.h: + /usr/include/c++/4.2/streambuf: /usr/include/c++/4.2/bits/streambuf.tcc: @@ -384,18 +394,8 @@ DoxygenTranslator/src/DoxygenParser.h: /usr/include/c++/4.2/bits/fstream.tcc: -/usr/include/c++/4.2/list: - -/usr/include/c++/4.2/bits/stl_list.h: - -/usr/include/c++/4.2/bits/list.tcc: - -DoxygenTranslator/src/DoxygenEntity.h: - DoxygenTranslator/src/TokenList.h: DoxygenTranslator/src/Token.h: DoxygenTranslator/src/JavaDocConverter.h: - -DoxygenTranslator/src/DoxygenTranslator.h: diff --git a/Source/DoxygenTranslator/src/.deps/Token.Po b/Source/DoxygenTranslator/src/.deps/Token.Po index 9a4bb90f5..dbfe541b1 100644 --- a/Source/DoxygenTranslator/src/.deps/Token.Po +++ b/Source/DoxygenTranslator/src/.deps/Token.Po @@ -72,27 +72,7 @@ DoxygenTranslator/src/Token.o DoxygenTranslator/src/Token.o: \ /usr/include/c++/4.2/algorithm /usr/include/c++/4.2/bits/stl_algo.h \ /usr/include/c++/4.2/bits/stl_heap.h \ /usr/include/c++/4.2/bits/stl_tempbuf.h \ - /usr/include/c++/4.2/bits/basic_string.tcc \ - /usr/include/c++/4.2/iostream /usr/include/c++/4.2/ostream \ - /usr/include/c++/4.2/ios /usr/include/c++/4.2/bits/localefwd.h \ - /usr/include/c++/4.2/bits/ios_base.h \ - /usr/include/c++/4.2/bits/locale_classes.h \ - /usr/include/c++/4.2/streambuf /usr/include/c++/4.2/bits/streambuf.tcc \ - /usr/include/c++/4.2/bits/basic_ios.h \ - /usr/include/c++/4.2/bits/streambuf_iterator.h \ - /usr/include/c++/4.2/bits/locale_facets.h /usr/include/c++/4.2/cwctype \ - /usr/include/wctype.h \ - /usr/include/c++/4.2/i486-linux-gnu/bits/ctype_base.h \ - /usr/include/c++/4.2/i486-linux-gnu/bits/ctype_inline.h \ - /usr/include/c++/4.2/bits/codecvt.h \ - /usr/include/c++/4.2/i486-linux-gnu/bits/time_members.h \ - /usr/include/c++/4.2/i486-linux-gnu/bits/messages_members.h \ - /usr/include/c++/4.2/bits/basic_ios.tcc \ - /usr/include/c++/4.2/bits/ostream.tcc /usr/include/c++/4.2/locale \ - /usr/include/c++/4.2/bits/locale_facets.tcc \ - /usr/include/c++/4.2/typeinfo /usr/include/c++/4.2/istream \ - /usr/include/c++/4.2/bits/istream.tcc /usr/include/c++/4.2/list \ - /usr/include/c++/4.2/bits/stl_list.h /usr/include/c++/4.2/bits/list.tcc + /usr/include/c++/4.2/bits/basic_string.tcc DoxygenTranslator/src/Token.h: @@ -321,59 +301,3 @@ DoxygenTranslator/src/Token.h: /usr/include/c++/4.2/bits/stl_tempbuf.h: /usr/include/c++/4.2/bits/basic_string.tcc: - -/usr/include/c++/4.2/iostream: - -/usr/include/c++/4.2/ostream: - -/usr/include/c++/4.2/ios: - -/usr/include/c++/4.2/bits/localefwd.h: - -/usr/include/c++/4.2/bits/ios_base.h: - -/usr/include/c++/4.2/bits/locale_classes.h: - -/usr/include/c++/4.2/streambuf: - -/usr/include/c++/4.2/bits/streambuf.tcc: - -/usr/include/c++/4.2/bits/basic_ios.h: - -/usr/include/c++/4.2/bits/streambuf_iterator.h: - -/usr/include/c++/4.2/bits/locale_facets.h: - -/usr/include/c++/4.2/cwctype: - -/usr/include/wctype.h: - -/usr/include/c++/4.2/i486-linux-gnu/bits/ctype_base.h: - -/usr/include/c++/4.2/i486-linux-gnu/bits/ctype_inline.h: - -/usr/include/c++/4.2/bits/codecvt.h: - -/usr/include/c++/4.2/i486-linux-gnu/bits/time_members.h: - -/usr/include/c++/4.2/i486-linux-gnu/bits/messages_members.h: - -/usr/include/c++/4.2/bits/basic_ios.tcc: - -/usr/include/c++/4.2/bits/ostream.tcc: - -/usr/include/c++/4.2/locale: - -/usr/include/c++/4.2/bits/locale_facets.tcc: - -/usr/include/c++/4.2/typeinfo: - -/usr/include/c++/4.2/istream: - -/usr/include/c++/4.2/bits/istream.tcc: - -/usr/include/c++/4.2/list: - -/usr/include/c++/4.2/bits/stl_list.h: - -/usr/include/c++/4.2/bits/list.tcc: diff --git a/Source/DoxygenTranslator/src/DoxygenEntity.cpp b/Source/DoxygenTranslator/src/DoxygenEntity.cpp index 6b8755592..a2faf67db 100644 --- a/Source/DoxygenTranslator/src/DoxygenEntity.cpp +++ b/Source/DoxygenTranslator/src/DoxygenEntity.cpp @@ -1,6 +1,6 @@ #include "DoxygenEntity.h" #include - +#include /* Little data class for Doxygen Commands */ diff --git a/Source/DoxygenTranslator/src/DoxygenEntity.h b/Source/DoxygenTranslator/src/DoxygenEntity.h index 0605b1cc9..4313bfb2a 100644 --- a/Source/DoxygenTranslator/src/DoxygenEntity.h +++ b/Source/DoxygenTranslator/src/DoxygenEntity.h @@ -1,8 +1,7 @@ #ifndef DOXYGENENTITY_H_ #define DOXYGENENTITY_H_ -#include -#include + #include #include diff --git a/Source/DoxygenTranslator/src/DoxygenParser.cpp b/Source/DoxygenTranslator/src/DoxygenParser.cpp index 226c60720..920b7c794 100644 --- a/Source/DoxygenTranslator/src/DoxygenParser.cpp +++ b/Source/DoxygenTranslator/src/DoxygenParser.cpp @@ -1,13 +1,5 @@ #include "DoxygenParser.h" - -#include -#include -#include -#include -#include -#include "DoxygenEntity.h" #include "TokenList.h" -#include "JavaDocConverter.h" #define SIMPLECOMMAND 1 #define IGNOREDSIMPLECOMMAND 2 #define COMMANDWORD 3 @@ -29,12 +21,6 @@ #define COMMAND 104 using namespace std; -////////////////////////////////////////// -/*Set these to pick what internal functions -to test. */ - -//int testCommandParsingFunctions = 1;// not implemented - DoxygenParser::DoxygenParser() { @@ -44,7 +30,8 @@ DoxygenParser::~DoxygenParser() { } -int noisy = 0; // set this to 1 for extra chatter from the parsing stage. +////////////////////////////////////////// +int noisy = 1; // set this to 1 for extra chatter from the parsing stage. int addCommand(string currCommand, TokenList &tokList, list &aNewList); list parse(list::iterator endParsingIndex, TokenList &tokList); @@ -101,32 +88,25 @@ string commandUniques[] = {"xrefitem", "arg", "ingroup", "par", "headerfile", "o "subpage", "dotfile", "image", "addtogroup", "li"}; -/* Changes a string to all lower case*/ -string StringToLower(string stringToConvert) - -{ - - for(unsigned int i=0;i &rootList){ - - list::iterator p = rootList.begin(); - while (p != rootList.end()){ - (*p).printEntity(0); - p++; + list::iterator p = rootList.begin(); + while (p != rootList.end()){ + (*p).printEntity(0); + p++; } - -} + } /* Determines how a command should be handled (what group it belongs to * for parsing rules */ - int commandBelongs(string theCommand){ - string smallString = StringToLower(theCommand ); + string smallString = StringToLower(theCommand); //cout << " Looking for command " << theCommand << endl; int i = 0; for ( i = 0; i < sizeof(simpleCommands)/sizeof(*simpleCommands); i++){ - if(smallString.compare(simpleCommands[i]) == 0){return SIMPLECOMMAND ;} + if(smallString.compare(simpleCommands[i]) == 0){return SIMPLECOMMAND;} } for ( i = 0; i < sizeof(ignoredSimpleCommands)/sizeof(*ignoredSimpleCommands); i++){ if(smallString.compare(ignoredSimpleCommands[i]) == 0){return IGNOREDSIMPLECOMMAND;} @@ -187,7 +161,6 @@ int commandBelongs(string theCommand){ for ( i = 0; i < sizeof(commandParagraph)/sizeof(*commandParagraph); i++){ if(smallString.compare( commandParagraph[i]) == 0){return COMMANDPARAGRAPH;} } - /* IgnoreCommandParagraph */ for ( i = 0; i < sizeof(ignoreCommandParagraphs)/sizeof(*ignoreCommandParagraphs); i++){ if(smallString.compare( ignoreCommandParagraphs[i]) == 0){return IGNORECOMMANDPARAGRAPH;} } @@ -211,16 +184,14 @@ int commandBelongs(string theCommand){ } for ( i = 0; i < sizeof(commandUniques)/sizeof(*commandUniques); i++){ if(smallString.compare( commandUniques[i]) == 0){return COMMANDUNIQUE;} - } - - return 0; - + } + return 0; } + /* Returns the next word ON THE CURRENT LINE ONLY * if a new line is encountered, returns a blank string. * Updates the index it is given if success. */ - string getNextWord(TokenList &tokList){ Token nextToken = tokList.peek(); if (nextToken.tokenType == PLAINSTRING ){ @@ -234,17 +205,17 @@ string getNextWord(TokenList &tokList){ * an iterator. */ list::iterator getOneLine(TokenList &tokList){ - list::iterator endOfParagraph = tokList.iteratorCopy(); - while(endOfParagraph != tokList.end()){ - if ((* endOfParagraph).tokenType == END_LINE){ - return endOfParagraph; + list::iterator endOfLine = tokList.iteratorCopy(); + while(endOfLine!= tokList.end()){ + if ((* endOfLine).tokenType == END_LINE){ + endOfLine++; + return endOfLine; + } + endOfLine++; } - endOfParagraph++; - } + cout << "REACHED END" << endl; return tokList.end(); -} - - + } /* Returns a properly formatted string * up til ANY command or end of paragraph is encountered. @@ -256,12 +227,11 @@ string getStringTilCommand(TokenList &tokList){ Token currentToken = tokList.next(); if(currentToken.tokenType == PLAINSTRING) { description = description + currentToken.tokenString + " "; - } + } else if (tokList.peek().tokenType == END_LINE) break; - } - + } return description; -} + } /* Returns a properly formatted string * up til the command specified is encountered @@ -274,69 +244,67 @@ string getStringTilEndCommand(string theCommand, TokenList &tokList){ while(tokList.peek().tokenString.compare(theCommand) != 0 ){ Token currentToken = tokList.next(); description = description + currentToken.tokenString + " "; - - } - + } return description; -} + } /* Returns the end of a Paragraph as an iterator- * Paragraph is defined in Doxygen to be a paragraph of text * seperate by either a structural command or a blank line */ - list::iterator getEndOfParagraph(TokenList &tokList){ list::iterator endOfParagraph = tokList.iteratorCopy(); while(endOfParagraph != tokList.end()){ - if ((* endOfParagraph).tokenType == COMMAND){ - if(isSectionIndicator((* endOfParagraph).tokenString)) return endOfParagraph; - else endOfParagraph++; - } - else if((* endOfParagraph).tokenType == PLAINSTRING) { - endOfParagraph++; - } - else if ((* endOfParagraph).tokenType == END_LINE){ + if ((* endOfParagraph).tokenType == END_LINE){ endOfParagraph++; if ((* endOfParagraph).tokenType == END_LINE){ endOfParagraph++; + cout << "ENCOUNTERED END OF PARA" << endl; return endOfParagraph; + } } - } - + else if ((* endOfParagraph).tokenType == COMMAND){ + if(isSectionIndicator((* endOfParagraph).tokenString)) return endOfParagraph; + else endOfParagraph++; + } + else if((* endOfParagraph).tokenType == PLAINSTRING) { + endOfParagraph++; + } + else return tokList.end(); + } + return tokList.end(); } - - return tokList.end(); - -} /* Returns the end of a section, defined as the first blank line OR first encounter of the same * command. Example of this behaviour is \arg +* if no end is encountered, returns the last token of the list. */ - list::iterator getEndOfSection(string theCommand, TokenList &tokList){ list::iterator endOfParagraph = tokList.iteratorCopy(); while(endOfParagraph != tokList.end()){ if ((* endOfParagraph).tokenType == COMMAND){ if(theCommand.compare((*endOfParagraph).tokenString) == 0) return endOfParagraph; else endOfParagraph++; - } + } else if((* endOfParagraph).tokenType == PLAINSTRING) { endOfParagraph++; - } + } else if ((* endOfParagraph).tokenType == END_LINE){ endOfParagraph++; if ((* endOfParagraph).tokenType == END_LINE){ endOfParagraph++; return endOfParagraph; + } } - } - + } + return tokList.end(); } -} + /* This method is for returning the end of 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", tokenList); + * If the end is never encountered, it returns the end of the list. */ list::iterator getEndCommand(string theCommand, TokenList &tokList){ list::iterator endOfCommand = tokList.iteratorCopy(); @@ -354,11 +322,11 @@ list::iterator getEndCommand(string theCommand, TokenList &tokList){ /* A specialty method for commands such as \arg that end at the end of a paragraph OR when another \arg is encountered */ - +//TODO getTilAnyCommand list::iterator getTilAnyCommand(string theCommand, TokenList &tokList){ list::iterator anIterator; return anIterator; -} + } @@ -369,21 +337,19 @@ list::iterator getTilAnyCommand(string theCommand, TokenList &tokList){ * \n \\ \@ \& \$ \# \< \> \% */ int addSimpleCommand(string theCommand, list &doxyList){ - if (noisy) cout << "Parsing " << theCommand << endl; doxyList.push_back(DoxygenEntity(theCommand)); return 1; -} + } /* NOT INCLUDED Simple Commands * Format: @command * Plain commands, such as newline etc, they contain no other data */ int ignoreSimpleCommand(string theCommand, list &doxyList){ - if (noisy) cout << "Not Adding " << theCommand << endl; return 1; -} + } /* CommandWord * Format: @command @@ -397,10 +363,11 @@ list::iterator getTilAnyCommand(string theCommand, TokenList &tokList){ if (!name.empty()){ doxyList.push_back(DoxygenEntity(theCommand, name)); return 1; - } + } else cout << "No word followed " << theCommand << " command. Not added" << endl; return 0; -} + } + /* NOT INCLUDED CommandWord * Format: @command * Commands with a single WORD after then such as @b @@ -411,10 +378,10 @@ list::iterator getTilAnyCommand(string theCommand, TokenList &tokList){ string name = getNextWord(tokList); if (!name.empty()){ return 1; - } + } else cout << "WARNING: No word followed " << theCommand << " command." << endl; return 0; -} + } /* CommandLine * Format: @command (line) @@ -424,12 +391,11 @@ list::iterator getTilAnyCommand(string theCommand, TokenList &tokList){ int addCommandLine(string theCommand, TokenList &tokList, list &doxyList){ if (noisy) cout << "Parsing " << theCommand << endl; list::iterator endOfLine = getOneLine(tokList); - list aNewList; - aNewList = parse(endOfLine, tokList); - doxyList.push_back( DoxygenEntity(theCommand, aNewList)); - return 1; - -} + list aNewList; + aNewList = parse(endOfLine, tokList); + doxyList.push_back( DoxygenEntity(theCommand, aNewList)); + return 1; + } /* NOT INCLUDED CommandLine * Format: @command (line) @@ -452,14 +418,12 @@ list::iterator getTilAnyCommand(string theCommand, TokenList &tokList){ int addCommandParagraph(string theCommand, TokenList &tokList, list &doxyList){ if (noisy) cout << "Parsing " << theCommand << endl; list::iterator endOfParagraph = getEndOfParagraph(tokList); - //if(!restOfParagraph.empty()){ list aNewList; aNewList = parse(endOfParagraph, tokList); doxyList.push_back( DoxygenEntity(theCommand, aNewList)); return 1; - // } - //else cout << "No line followed " << theCommand << " command. Not added" << endl; -} + } + /* CommandParagraph * Format: @command {paragraph} * Commands with a single LINE after then such as @var @@ -469,9 +433,9 @@ list::iterator getTilAnyCommand(string theCommand, TokenList &tokList){ if (noisy) cout << "Not Adding " << theCommand << endl; list::iterator endOfParagraph = getEndOfParagraph(tokList); tokList.setIterator(endOfParagraph); - //else cout << "WARNING: No line followed " << theCommand << " command." << endl; return 1; } + /* Command EndCommand * Format: @command and ends at @endcommand * Commands that take in a block of text such as @code @@ -479,13 +443,12 @@ list::iterator getTilAnyCommand(string theCommand, TokenList &tokList){ * "verbatim", "xmlonly", "cond", "if", "ifnot", "link" * Returns 1 if success, 0 if the endcommand is never encountered. */ - int addCommandEndCommand(string theCommand, TokenList &tokList, list &doxyList){ if (noisy) cout << "Not Adding " << theCommand << endl; string description = getStringTilEndCommand( "end" + theCommand, tokList); doxyList.push_back(DoxygenEntity(theCommand, description)); return 1; - } + } /* CommandWordParagraph * Format: @command {paragraph} @@ -499,14 +462,14 @@ list::iterator getTilAnyCommand(string theCommand, TokenList &tokList){ cout << "No word followed " << theCommand << " command. Not added" << endl; return 0; } - list::iterator endOfParagraph = getEndOfParagraph(tokList); - //if(!restOfParagraph.empty()){ - list aNewList; - aNewList = parse(endOfParagraph, tokList); - aNewList.push_front(DoxygenEntity("plainstring", name)); - doxyList.push_back(DoxygenEntity(theCommand, aNewList)); - return 0; - } + list::iterator endOfParagraph = getEndOfParagraph(tokList); + list aNewList; + aNewList = parse(endOfParagraph, tokList); + aNewList.push_front(DoxygenEntity("plainstring", name)); + doxyList.push_back(DoxygenEntity(theCommand, aNewList)); + return 1; + } + /* CommandWordLine * Format: @command (line) * Commands such as param @@ -549,7 +512,7 @@ list::iterator getTilAnyCommand(string theCommand, TokenList &tokList){ if (!headername.empty()) aNewList.push_back(DoxygenEntity("plainstring", headername)); doxyList.push_back(DoxygenEntity(theCommand, aNewList)); return 1; - } + } /* Command Optional Word * Format: @command [] @@ -564,13 +527,17 @@ list::iterator getTilAnyCommand(string theCommand, TokenList &tokList){ } /* Commands that should not be encountered (such as PHP only) + * goes til the end of line then returns */ int addCommandErrorThrow(string theCommand, TokenList &tokList, list &doxyList){ cout << "Encountered :" << theCommand << endl; cout << "This command should not have been encountered. Behaviour past this may be unpredictable " << endl; + list::iterator endOfLine = getOneLine(tokList); + tokList.setIterator(endOfLine); + return 0; } - +/* Adds the unique commands- different process for each unique command */ int addCommandUnique(string theCommand, TokenList &tokList, list &doxyList){ list aNewList; if (theCommand.compare("arg") == 0 || theCommand.compare("li") == 0){ @@ -578,8 +545,7 @@ list::iterator getTilAnyCommand(string theCommand, TokenList &tokList){ list aNewList; aNewList = parse(endOfSection, tokList); doxyList.push_back( DoxygenEntity(theCommand, aNewList)); - } - + } // \xrefitem "(heading)" "(list title)" {text} else if (theCommand.compare("xrefitem") == 0){ //TODO Implement xrefitem @@ -587,7 +553,7 @@ list::iterator getTilAnyCommand(string theCommand, TokenList &tokList){ list::iterator endOfParagraph = getEndOfParagraph(tokList); tokList.setIterator(endOfParagraph); return 1; - } + } // \ingroup ( [ ]) else if (theCommand.compare("ingroup") == 0){ string name = getNextWord(tokList); @@ -598,7 +564,7 @@ list::iterator getTilAnyCommand(string theCommand, TokenList &tokList){ if(!name.empty()) aNewList.push_back(DoxygenEntity("plainstring", name)); doxyList.push_back(DoxygenEntity(theCommand, aNewList)); return 1; - } + } // \par [(paragraph title)] { paragraph } else if (theCommand.compare("par") == 0){ list::iterator endOfLine = getOneLine(tokList); @@ -608,7 +574,7 @@ list::iterator getTilAnyCommand(string theCommand, TokenList &tokList){ aNewList.splice(aNewList.end(), aNewList2); doxyList.push_back(DoxygenEntity(theCommand, aNewList)); return 1; - } + } // \headerfile [] else if (theCommand.compare("headerfile") == 0){ list aNewList; @@ -618,17 +584,18 @@ list::iterator getTilAnyCommand(string theCommand, TokenList &tokList){ if(!name.empty()) aNewList.push_back(DoxygenEntity("plainstring", name)); doxyList.push_back(DoxygenEntity(theCommand, aNewList)); return 1; - } + } // \overload [(function declaration)] else if (theCommand.compare("overload") == 0){ list::iterator endOfLine = getOneLine(tokList); if (endOfLine != tokList.current()){ - list aNewList; - aNewList = parse(endOfLine, tokList); - doxyList.push_back(DoxygenEntity(theCommand, aNewList)); - } + list aNewList; + aNewList = parse(endOfLine, tokList); + doxyList.push_back(DoxygenEntity(theCommand, aNewList)); + } else doxyList.push_back(DoxygenEntity(theCommand)); - } + return 1; + } // \weakgroup [(title)] else if (theCommand.compare("weakgroup") == 0){ if (noisy) cout << "Parsing " << theCommand << endl; @@ -641,35 +608,35 @@ list::iterator getTilAnyCommand(string theCommand, TokenList &tokList){ list::iterator endOfLine = getOneLine(tokList); if (endOfLine != tokList.current()) { aNewList = parse(endOfLine, tokList); - } + } aNewList.push_front(DoxygenEntity("plainstring", name)); doxyList.push_back(DoxygenEntity(theCommand, aNewList)); - } + } // \ref ["(text)"] else if (theCommand.compare("ref") == 0){ //TODO Implement ref if (noisy) cout << "Not Adding " << theCommand << endl; list::iterator endOfParagraph = getEndOfParagraph(tokList); tokList.setIterator(endOfParagraph); - } + } // \subpage ["(text)"] else if (theCommand.compare("subpage") == 0){ //TODO implement subpage if (noisy) cout << "Not Adding " << theCommand << endl; list::iterator endOfParagraph = getEndOfParagraph(tokList); tokList.setIterator(endOfParagraph); - } + } // \dotfile ["caption"] else if (theCommand.compare("dotfile") == 0){ //TODO implement dotfile if (noisy) cout << "Not Adding " << theCommand << endl; list::iterator endOfParagraph = getEndOfParagraph(tokList); tokList.setIterator(endOfParagraph); - } + } // \image ["caption"] [=] else if (theCommand.compare("image") == 0){ //todo implement image - } + } // \addtogroup [(title)] else if (theCommand.compare("addtogroup") == 0){ if (noisy) cout << "Parsing " << theCommand << endl; @@ -682,12 +649,12 @@ list::iterator getTilAnyCommand(string theCommand, TokenList &tokList){ list::iterator endOfLine = getOneLine(tokList); if (endOfLine != tokList.current()) { aNewList = parse(endOfLine, tokList); - } + } aNewList.push_front(DoxygenEntity("plainstring", name)); doxyList.push_back(DoxygenEntity(theCommand, aNewList)); + } + return 0; } - - } /* The actual "meat" of the doxygen parser. This is not yet fully implemented * with my current design- however the skeletal outline is contained in @@ -697,13 +664,12 @@ list::iterator getTilAnyCommand(string theCommand, TokenList &tokList){ int addCommand(string commandString, TokenList &tokList,list &doxyList){ string theCommand = StringToLower(commandString); - if (theCommand.compare("plainstring") == 0){ string nextPhrase = getStringTilCommand( tokList); if (noisy) cout << "Parsing plain string :" << nextPhrase << endl; doxyList.push_back(DoxygenEntity("plainstring", nextPhrase )); return 1; - } + } int commandNumber = commandBelongs(theCommand); if (commandNumber == SIMPLECOMMAND){ return addSimpleCommand(theCommand, doxyList); @@ -751,8 +717,8 @@ int addCommand(string commandString, TokenList &tokList,list &do return addCommandUnique(theCommand, tokList, doxyList); } - return 0; -} + return 0; + } list parse(list::iterator endParsingIndex, TokenList &tokList){ list aNewList; @@ -762,36 +728,64 @@ list parse(list::iterator endParsingIndex, TokenList &tokL if(noisy) cout << "Parsing for phrase starting in:" << currToken.toString() << endl; if(currToken.tokenType == END_LINE ){ tokList.next(); - } + } else if(currToken.tokenType == COMMAND){ currCommand = findCommand(currToken.tokenString); - tokList.next(); - if (currCommand < 0 ){ if(noisy) cout << "BAD COMMAND: " << currToken.tokenString << endl;} + if (currCommand < 0 ){ + if(noisy) cout << "Unidentified Command " << currToken.tokenString << endl; + tokList.next(); + addCommand(string("plainstring"), tokList, aNewList);} //cout << "Command: " << currWord << " " << currCommand << endl; - - else addCommand(currToken.tokenString, tokList, aNewList); - } + else { tokList.next(); + addCommand(currToken.tokenString, tokList, aNewList); + } + } else if (currToken.tokenType == PLAINSTRING){ addCommand(string("plainstring"), tokList, aNewList); + } + else break; } - - + return aNewList; } +list parseRoot(list::iterator endParsingIndex, TokenList &tokList){ + list aNewList; + int currCommand; + while (tokList.current() != endParsingIndex){ + Token currToken = tokList.peek(); + if(noisy) cout << "Parsing for phrase starting in:" << currToken.toString() << endl; + if(currToken.tokenType == END_LINE ){ + tokList.next(); + } + else if(currToken.tokenType == COMMAND){ + currCommand = findCommand(currToken.tokenString); + if (currCommand < 0 ){ + if(noisy) cout << "Unidentified Command " << currToken.tokenString << endl; + tokList.next(); + addCommand(string("details"), tokList, aNewList);} + //cout << "Command: " << currWord << " " << currCommand << endl; + else { tokList.next(); + addCommand(currToken.tokenString, tokList, aNewList); + } + } + else if (currToken.tokenType == PLAINSTRING){ + addCommand(string("details"), tokList, aNewList); + } + } return aNewList; -} + } list DoxygenParser::createTree(string doxygenBlob){ TokenList tokList = TokenList(doxygenBlob); if(noisy) { cout << "---TOKEN LIST---" << endl; tokList.printList(); - } + } list rootList; - rootList = parse( tokList.end(), tokList); + rootList = parseRoot( tokList.end(), tokList); if(noisy) { cout << "PARSED LIST" << endl; printTree(rootList); - } + } return rootList; } diff --git a/Source/DoxygenTranslator/src/DoxygenParser.h b/Source/DoxygenTranslator/src/DoxygenParser.h index 776fcf123..638fdab72 100644 --- a/Source/DoxygenTranslator/src/DoxygenParser.h +++ b/Source/DoxygenTranslator/src/DoxygenParser.h @@ -1,13 +1,8 @@ #ifndef DOXYGENPARSER_H_ #define DOXYGENPARSER_H_ -#include -#include -#include #include #include #include "DoxygenEntity.h" -#include "TokenList.h" -#include "JavaDocConverter.h" class DoxygenParser { public: diff --git a/Source/DoxygenTranslator/src/DoxygenTranslator.cpp b/Source/DoxygenTranslator/src/DoxygenTranslator.cpp index 191057ae7..a1789eb74 100644 --- a/Source/DoxygenTranslator/src/DoxygenTranslator.cpp +++ b/Source/DoxygenTranslator/src/DoxygenTranslator.cpp @@ -11,6 +11,7 @@ #include "TokenList.h" #include "JavaDocConverter.h" + DoxygenParser doxyParse; JavaDocConverter jDC; @@ -27,7 +28,7 @@ DoxygenTranslator::~DoxygenTranslator(){ char *DoxygenTranslator::convert(char* doxygenBlob, char* option){ list rootList = doxyParse.createTree(string(doxygenBlob)); - rootList = doxyParse.createTree(string(doxygenBlob)); + string returnedString; if(strcmp(option, "JAVADOC") == 0){ returnedString = jDC.convertToJavaDoc(rootList); @@ -39,3 +40,32 @@ char *DoxygenTranslator::convert(char* doxygenBlob, char* option){ return nonConstString; } +int testCommands(){ + string exampleArray[] = { + "/**\n * \n * Random Line \n * \\@ \n * Random Line After */", + "/**\n * \n * Random Line Before \n * \\b bold \n * Random Line After */", + "/**\n * \n * Random Line \n * \\copydoc bold \n * Random Line After */", + "/**\n * \n * Random Line \n * \n * \\addindex An Entire Line\n * \\addindex An Entire Line\n * Random Line After */", + "/**\n * \n * Random Line \n * \n * \\return An Entire Paragraph \n * Including This Line \n * \n * Random Line After */", + "/**\n * \n * Random Line \n * \\return An Entire Paragraph \n * Including This Line \n * \\author Shouldn't be part of return */", + "/**\n * \n * Random Line \n * \\code this should continue \n * until here \\endcode \n * Random Line After */", + "/**\n * \n * Random Line \n * \\param singleword then the rest of \n * the description \n * \n * Random Line After */", + "/**\n * \n * Random Line \n * \\page singleword this should go til here \n * but not this */", + "/**\n * \n * Random Line \n * \\page singleword this should go til here \n * but not this */", + "/**\n * \n * Random Line \n * \\category singleword \n * but not this */", + "/**\n * \n * Random Line \n * \\category singleword oneword \n * but not this */", + "/**\n * \n * Random Line \n * \\category singleword oneword twoword \n * but not this */", + "/**\n * \n * Random Line \n * \\dir singleword \n * but not this */", + "/**\n * \n * Random Line \n * \\dir \n * but not this */", + "/**\n * \n * Random Line \n * \\fakecommand details \n * but not this */" + }; + //string exampleArrayUniques = {}; + DoxygenTranslator dT = DoxygenTranslator(); + for (int i = 0; i < 16; i ++ ){ + cout << "---ORIGINAL DOXYGEN--- " << endl << exampleArray[i] << endl; + char *nonConstString = (char *)malloc(exampleArray[i].length()+1); + strcpy(nonConstString, exampleArray[i].c_str()); + dT.convert(nonConstString, "JAVADOC"); + } + return 1; +} diff --git a/Source/DoxygenTranslator/src/JavaDocConverter.cpp b/Source/DoxygenTranslator/src/JavaDocConverter.cpp index 91f52662f..c1606cc77 100644 --- a/Source/DoxygenTranslator/src/JavaDocConverter.cpp +++ b/Source/DoxygenTranslator/src/JavaDocConverter.cpp @@ -1,8 +1,5 @@ #include "JavaDocConverter.h" -#include #include -#include -#include #define APPROX_LINE_LENGTH 64//characters per line allowed #define TAB_SIZE 8//characters per line allowed int printSortedTree2 = 0; @@ -20,6 +17,10 @@ JavaDocConverter::~JavaDocConverter() * such as brief descriptions are TAGGED as such */ bool compare_DoxygenEntities(DoxygenEntity first, DoxygenEntity second){ + if(first.typeOfEntity.compare("brief") == 0) return true; + if(second.typeOfEntity.compare("brief") == 0) return false; + if(first.typeOfEntity.compare("details") == 0) return true; + if(second.typeOfEntity.compare("details") == 0) return false; if(first.typeOfEntity.compare("plainstring") == 0) return true; if(second.typeOfEntity.compare("plainstring") == 0) return false; if(first.typeOfEntity.compare("param") == 0){ @@ -54,11 +55,11 @@ bool compare_DoxygenEntities(DoxygenEntity first, DoxygenEntity second){ return false; } if(first.typeOfEntity.compare("author")== 0){ - if(first.typeOfEntity.compare("author")== 0) return true; - if(first.typeOfEntity.compare("version")== 0)return true; - if(first.typeOfEntity.compare("see")== 0)return true; - if(first.typeOfEntity.compare("since")== 0)return true; - if(first.typeOfEntity.compare("deprecated")== 0)return true; + if(second.typeOfEntity.compare("author")== 0) return true; + if(second.typeOfEntity.compare("version")== 0)return true; + if(second.typeOfEntity.compare("see")== 0)return true; + if(second.typeOfEntity.compare("since")== 0)return true; + if(second.typeOfEntity.compare("deprecated")== 0)return true; return false; } if(first.typeOfEntity.compare("version")== 0){ @@ -134,17 +135,11 @@ string javaDocFormat(DoxygenEntity &doxygenEntity){ if (doxygenEntity.typeOfEntity.compare("plainstring") == 0){ return doxygenEntity.data; } - else if (doxygenEntity.typeOfEntity.compare("brief") == 0){ - return doxygenEntity.data; - } - if (doxygenEntity.typeOfEntity.compare("detailed") == 0){ - return doxygenEntity.data; - } else if (doxygenEntity.typeOfEntity.compare("b") == 0){ - return "" + doxygenEntity.data + ""; + return "\b" + doxygenEntity.data + ""; } else if (doxygenEntity.typeOfEntity.compare("c") == 0){ - return "" + doxygenEntity.data + ""; + return "\b" + doxygenEntity.data + ""; } return ""; } @@ -165,7 +160,9 @@ string translateSubtree( DoxygenEntity &doxygenEntity){ } string translateEntity(DoxygenEntity &doxyEntity){ - if(doxyEntity.typeOfEntity.compare("plainstring")== 0 || doxyEntity.typeOfEntity.compare("deprecated")== 0 || doxyEntity.typeOfEntity.compare("brief")== 0) + if ((doxyEntity.typeOfEntity.compare("brief") == 0)||(doxyEntity.typeOfEntity.compare("details") == 0)){ + return formatCommand(string(translateSubtree(doxyEntity)), 0) + "\n * ";} + else if(doxyEntity.typeOfEntity.compare("plainstring")== 0 || doxyEntity.typeOfEntity.compare("deprecated")== 0 || doxyEntity.typeOfEntity.compare("brief")== 0) return formatCommand(doxyEntity.data, 0) + "\n * "; else if(doxyEntity.typeOfEntity.compare("see") == 0){ return formatCommand(string("@" + doxyEntity.typeOfEntity + "\t\t" + translateSubtree(doxyEntity)), 2); @@ -207,4 +204,4 @@ string JavaDocConverter:: convertToJavaDoc(list entityList){ cout << "\n---RESULT IN JAVADOC---" << endl; cout << javaDocString; return javaDocString; -} \ No newline at end of file +} diff --git a/Source/DoxygenTranslator/src/Token.cpp b/Source/DoxygenTranslator/src/Token.cpp index e85799546..198b3e442 100644 --- a/Source/DoxygenTranslator/src/Token.cpp +++ b/Source/DoxygenTranslator/src/Token.cpp @@ -1,8 +1,4 @@ #include "Token.h" -#include -#include -#include -#include using namespace std; @@ -21,7 +17,7 @@ string Token::toString() return "{END OF PARAGRAPH}"; } if (tokenType == PLAINSTRING){ - return tokenString; + return "{PLAINSTRING :" + tokenString + "}"; } if (tokenType == COMMAND){ return "{COMMAND : " + tokenString+ "}"; diff --git a/Source/DoxygenTranslator/src/TokenList.cpp b/Source/DoxygenTranslator/src/TokenList.cpp index eeec6da46..a05d2ceef 100644 --- a/Source/DoxygenTranslator/src/TokenList.cpp +++ b/Source/DoxygenTranslator/src/TokenList.cpp @@ -59,7 +59,7 @@ TokenList::TokenList(string doxygenString){ if(!isFluff) tokenList.push_back(Token(PLAINSTRING, currentWord)); } - else tokenList.push_back(Token(PLAINSTRING, currentWord)); + else if (!currentWord.empty())tokenList.push_back(Token(PLAINSTRING, currentWord)); currentIndex = nextIndex; } } From ac7887a940c40f39b45529b9535a6a4de54a4ac3 Mon Sep 17 00:00:00 2001 From: Cheryl Foil Date: Mon, 18 Aug 2008 04:57:05 +0000 Subject: [PATCH 016/314] Cleaning up unneeded files git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2008-cherylfoil@10778 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Source/DoxygenTranslator/src/.deps/.dirstamp | 0 .../src/.deps/DoxygenEntity.Po | 380 ----------------- .../src/.deps/DoxygenParser.Po | 387 ----------------- .../src/.deps/DoxygenTranslator.Po | 401 ------------------ .../src/.deps/JavaDocConverter.Po | 385 ----------------- Source/DoxygenTranslator/src/.deps/Token.Po | 303 ------------- .../DoxygenTranslator/src/.deps/TokenList.Po | 382 ----------------- 7 files changed, 2238 deletions(-) delete mode 100644 Source/DoxygenTranslator/src/.deps/.dirstamp delete mode 100644 Source/DoxygenTranslator/src/.deps/DoxygenEntity.Po delete mode 100644 Source/DoxygenTranslator/src/.deps/DoxygenParser.Po delete mode 100644 Source/DoxygenTranslator/src/.deps/DoxygenTranslator.Po delete mode 100644 Source/DoxygenTranslator/src/.deps/JavaDocConverter.Po delete mode 100644 Source/DoxygenTranslator/src/.deps/Token.Po delete mode 100644 Source/DoxygenTranslator/src/.deps/TokenList.Po diff --git a/Source/DoxygenTranslator/src/.deps/.dirstamp b/Source/DoxygenTranslator/src/.deps/.dirstamp deleted file mode 100644 index e69de29bb..000000000 diff --git a/Source/DoxygenTranslator/src/.deps/DoxygenEntity.Po b/Source/DoxygenTranslator/src/.deps/DoxygenEntity.Po deleted file mode 100644 index 7a6dbd296..000000000 --- a/Source/DoxygenTranslator/src/.deps/DoxygenEntity.Po +++ /dev/null @@ -1,380 +0,0 @@ -DoxygenTranslator/src/DoxygenEntity.o \ - DoxygenTranslator/src/DoxygenEntity.o: \ - DoxygenTranslator/src/DoxygenEntity.cpp \ - DoxygenTranslator/src/DoxygenEntity.h /usr/include/c++/4.2/string \ - /usr/include/c++/4.2/i486-linux-gnu/bits/c++config.h \ - /usr/include/c++/4.2/i486-linux-gnu/bits/os_defines.h \ - /usr/include/features.h /usr/include/sys/cdefs.h \ - /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ - /usr/include/gnu/stubs-32.h \ - /usr/include/c++/4.2/i486-linux-gnu/bits/cpu_defines.h \ - /usr/include/c++/4.2/bits/stringfwd.h \ - /usr/include/c++/4.2/bits/char_traits.h /usr/include/c++/4.2/cstring \ - /usr/include/c++/4.2/cstddef \ - /usr/lib/gcc/i486-linux-gnu/4.2.3/include/stddef.h \ - /usr/include/string.h /usr/include/xlocale.h \ - /usr/include/c++/4.2/bits/stl_algobase.h /usr/include/c++/4.2/climits \ - /usr/lib/gcc/i486-linux-gnu/4.2.3/include/limits.h \ - /usr/lib/gcc/i486-linux-gnu/4.2.3/include/syslimits.h \ - /usr/include/limits.h /usr/include/bits/posix1_lim.h \ - /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ - /usr/include/bits/posix2_lim.h /usr/include/bits/xopen_lim.h \ - /usr/include/bits/stdio_lim.h /usr/include/c++/4.2/cstdlib \ - /usr/include/stdlib.h /usr/include/bits/waitflags.h \ - /usr/include/bits/waitstatus.h /usr/include/endian.h \ - /usr/include/bits/endian.h /usr/include/sys/types.h \ - /usr/include/bits/types.h /usr/include/bits/typesizes.h \ - /usr/include/time.h /usr/include/sys/select.h \ - /usr/include/bits/select.h /usr/include/bits/sigset.h \ - /usr/include/bits/time.h /usr/include/sys/sysmacros.h \ - /usr/include/bits/pthreadtypes.h /usr/include/alloca.h \ - /usr/include/c++/4.2/iosfwd \ - /usr/include/c++/4.2/i486-linux-gnu/bits/c++locale.h \ - /usr/include/c++/4.2/cstdio /usr/include/stdio.h /usr/include/libio.h \ - /usr/include/_G_config.h /usr/include/wchar.h \ - /usr/lib/gcc/i486-linux-gnu/4.2.3/include/stdarg.h \ - /usr/include/bits/sys_errlist.h /usr/include/c++/4.2/clocale \ - /usr/include/locale.h /usr/include/bits/locale.h \ - /usr/include/langinfo.h /usr/include/nl_types.h /usr/include/iconv.h \ - /usr/include/libintl.h /usr/include/c++/4.2/cstdarg \ - /usr/include/c++/4.2/i486-linux-gnu/bits/c++io.h \ - /usr/include/c++/4.2/i486-linux-gnu/bits/gthr.h \ - /usr/include/c++/4.2/i486-linux-gnu/bits/gthr-default.h \ - /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ - /usr/include/signal.h /usr/include/bits/setjmp.h /usr/include/unistd.h \ - /usr/include/bits/posix_opt.h /usr/include/bits/environments.h \ - /usr/include/bits/confname.h /usr/include/getopt.h \ - /usr/include/c++/4.2/cctype /usr/include/ctype.h \ - /usr/include/c++/4.2/bits/postypes.h /usr/include/c++/4.2/cwchar \ - /usr/include/c++/4.2/ctime /usr/include/bits/wchar.h \ - /usr/include/stdint.h /usr/include/c++/4.2/bits/functexcept.h \ - /usr/include/c++/4.2/exception_defines.h \ - /usr/include/c++/4.2/bits/stl_pair.h \ - /usr/include/c++/4.2/bits/cpp_type_traits.h \ - /usr/include/c++/4.2/ext/type_traits.h /usr/include/c++/4.2/utility \ - /usr/include/c++/4.2/bits/stl_relops.h \ - /usr/include/c++/4.2/bits/stl_iterator_base_types.h \ - /usr/include/c++/4.2/bits/stl_iterator_base_funcs.h \ - /usr/include/c++/4.2/bits/concept_check.h \ - /usr/include/c++/4.2/bits/stl_iterator.h \ - /usr/include/c++/4.2/debug/debug.h /usr/include/c++/4.2/memory \ - /usr/include/c++/4.2/bits/allocator.h \ - /usr/include/c++/4.2/i486-linux-gnu/bits/c++allocator.h \ - /usr/include/c++/4.2/ext/new_allocator.h /usr/include/c++/4.2/new \ - /usr/include/c++/4.2/exception \ - /usr/include/c++/4.2/bits/stl_construct.h \ - /usr/include/c++/4.2/bits/stl_uninitialized.h \ - /usr/include/c++/4.2/bits/stl_raw_storage_iter.h \ - /usr/include/c++/4.2/limits /usr/include/c++/4.2/bits/ostream_insert.h \ - /usr/include/c++/4.2/bits/stl_function.h \ - /usr/include/c++/4.2/bits/basic_string.h \ - /usr/include/c++/4.2/ext/atomicity.h \ - /usr/include/c++/4.2/i486-linux-gnu/bits/atomic_word.h \ - /usr/include/c++/4.2/algorithm /usr/include/c++/4.2/bits/stl_algo.h \ - /usr/include/c++/4.2/bits/stl_heap.h \ - /usr/include/c++/4.2/bits/stl_tempbuf.h \ - /usr/include/c++/4.2/bits/basic_string.tcc /usr/include/c++/4.2/list \ - /usr/include/c++/4.2/bits/stl_list.h /usr/include/c++/4.2/bits/list.tcc \ - /usr/include/c++/4.2/iostream /usr/include/c++/4.2/ostream \ - /usr/include/c++/4.2/ios /usr/include/c++/4.2/bits/localefwd.h \ - /usr/include/c++/4.2/bits/ios_base.h \ - /usr/include/c++/4.2/bits/locale_classes.h \ - /usr/include/c++/4.2/streambuf /usr/include/c++/4.2/bits/streambuf.tcc \ - /usr/include/c++/4.2/bits/basic_ios.h \ - /usr/include/c++/4.2/bits/streambuf_iterator.h \ - /usr/include/c++/4.2/bits/locale_facets.h /usr/include/c++/4.2/cwctype \ - /usr/include/wctype.h \ - /usr/include/c++/4.2/i486-linux-gnu/bits/ctype_base.h \ - /usr/include/c++/4.2/i486-linux-gnu/bits/ctype_inline.h \ - /usr/include/c++/4.2/bits/codecvt.h \ - /usr/include/c++/4.2/i486-linux-gnu/bits/time_members.h \ - /usr/include/c++/4.2/i486-linux-gnu/bits/messages_members.h \ - /usr/include/c++/4.2/bits/basic_ios.tcc \ - /usr/include/c++/4.2/bits/ostream.tcc /usr/include/c++/4.2/locale \ - /usr/include/c++/4.2/bits/locale_facets.tcc \ - /usr/include/c++/4.2/typeinfo /usr/include/c++/4.2/istream \ - /usr/include/c++/4.2/bits/istream.tcc - -DoxygenTranslator/src/DoxygenEntity.h: - -/usr/include/c++/4.2/string: - -/usr/include/c++/4.2/i486-linux-gnu/bits/c++config.h: - -/usr/include/c++/4.2/i486-linux-gnu/bits/os_defines.h: - -/usr/include/features.h: - -/usr/include/sys/cdefs.h: - -/usr/include/bits/wordsize.h: - -/usr/include/gnu/stubs.h: - -/usr/include/gnu/stubs-32.h: - -/usr/include/c++/4.2/i486-linux-gnu/bits/cpu_defines.h: - -/usr/include/c++/4.2/bits/stringfwd.h: - -/usr/include/c++/4.2/bits/char_traits.h: - -/usr/include/c++/4.2/cstring: - -/usr/include/c++/4.2/cstddef: - -/usr/lib/gcc/i486-linux-gnu/4.2.3/include/stddef.h: - -/usr/include/string.h: - -/usr/include/xlocale.h: - -/usr/include/c++/4.2/bits/stl_algobase.h: - -/usr/include/c++/4.2/climits: - -/usr/lib/gcc/i486-linux-gnu/4.2.3/include/limits.h: - -/usr/lib/gcc/i486-linux-gnu/4.2.3/include/syslimits.h: - -/usr/include/limits.h: - -/usr/include/bits/posix1_lim.h: - -/usr/include/bits/local_lim.h: - -/usr/include/linux/limits.h: - -/usr/include/bits/posix2_lim.h: - -/usr/include/bits/xopen_lim.h: - -/usr/include/bits/stdio_lim.h: - -/usr/include/c++/4.2/cstdlib: - -/usr/include/stdlib.h: - -/usr/include/bits/waitflags.h: - -/usr/include/bits/waitstatus.h: - -/usr/include/endian.h: - -/usr/include/bits/endian.h: - -/usr/include/sys/types.h: - -/usr/include/bits/types.h: - -/usr/include/bits/typesizes.h: - -/usr/include/time.h: - -/usr/include/sys/select.h: - -/usr/include/bits/select.h: - -/usr/include/bits/sigset.h: - -/usr/include/bits/time.h: - -/usr/include/sys/sysmacros.h: - -/usr/include/bits/pthreadtypes.h: - -/usr/include/alloca.h: - -/usr/include/c++/4.2/iosfwd: - -/usr/include/c++/4.2/i486-linux-gnu/bits/c++locale.h: - -/usr/include/c++/4.2/cstdio: - -/usr/include/stdio.h: - -/usr/include/libio.h: - -/usr/include/_G_config.h: - -/usr/include/wchar.h: - -/usr/lib/gcc/i486-linux-gnu/4.2.3/include/stdarg.h: - -/usr/include/bits/sys_errlist.h: - -/usr/include/c++/4.2/clocale: - -/usr/include/locale.h: - -/usr/include/bits/locale.h: - -/usr/include/langinfo.h: - -/usr/include/nl_types.h: - -/usr/include/iconv.h: - -/usr/include/libintl.h: - -/usr/include/c++/4.2/cstdarg: - -/usr/include/c++/4.2/i486-linux-gnu/bits/c++io.h: - -/usr/include/c++/4.2/i486-linux-gnu/bits/gthr.h: - -/usr/include/c++/4.2/i486-linux-gnu/bits/gthr-default.h: - -/usr/include/pthread.h: - -/usr/include/sched.h: - -/usr/include/bits/sched.h: - -/usr/include/signal.h: - -/usr/include/bits/setjmp.h: - -/usr/include/unistd.h: - -/usr/include/bits/posix_opt.h: - -/usr/include/bits/environments.h: - -/usr/include/bits/confname.h: - -/usr/include/getopt.h: - -/usr/include/c++/4.2/cctype: - -/usr/include/ctype.h: - -/usr/include/c++/4.2/bits/postypes.h: - -/usr/include/c++/4.2/cwchar: - -/usr/include/c++/4.2/ctime: - -/usr/include/bits/wchar.h: - -/usr/include/stdint.h: - -/usr/include/c++/4.2/bits/functexcept.h: - -/usr/include/c++/4.2/exception_defines.h: - -/usr/include/c++/4.2/bits/stl_pair.h: - -/usr/include/c++/4.2/bits/cpp_type_traits.h: - -/usr/include/c++/4.2/ext/type_traits.h: - -/usr/include/c++/4.2/utility: - -/usr/include/c++/4.2/bits/stl_relops.h: - -/usr/include/c++/4.2/bits/stl_iterator_base_types.h: - -/usr/include/c++/4.2/bits/stl_iterator_base_funcs.h: - -/usr/include/c++/4.2/bits/concept_check.h: - -/usr/include/c++/4.2/bits/stl_iterator.h: - -/usr/include/c++/4.2/debug/debug.h: - -/usr/include/c++/4.2/memory: - -/usr/include/c++/4.2/bits/allocator.h: - -/usr/include/c++/4.2/i486-linux-gnu/bits/c++allocator.h: - -/usr/include/c++/4.2/ext/new_allocator.h: - -/usr/include/c++/4.2/new: - -/usr/include/c++/4.2/exception: - -/usr/include/c++/4.2/bits/stl_construct.h: - -/usr/include/c++/4.2/bits/stl_uninitialized.h: - -/usr/include/c++/4.2/bits/stl_raw_storage_iter.h: - -/usr/include/c++/4.2/limits: - -/usr/include/c++/4.2/bits/ostream_insert.h: - -/usr/include/c++/4.2/bits/stl_function.h: - -/usr/include/c++/4.2/bits/basic_string.h: - -/usr/include/c++/4.2/ext/atomicity.h: - -/usr/include/c++/4.2/i486-linux-gnu/bits/atomic_word.h: - -/usr/include/c++/4.2/algorithm: - -/usr/include/c++/4.2/bits/stl_algo.h: - -/usr/include/c++/4.2/bits/stl_heap.h: - -/usr/include/c++/4.2/bits/stl_tempbuf.h: - -/usr/include/c++/4.2/bits/basic_string.tcc: - -/usr/include/c++/4.2/list: - -/usr/include/c++/4.2/bits/stl_list.h: - -/usr/include/c++/4.2/bits/list.tcc: - -/usr/include/c++/4.2/iostream: - -/usr/include/c++/4.2/ostream: - -/usr/include/c++/4.2/ios: - -/usr/include/c++/4.2/bits/localefwd.h: - -/usr/include/c++/4.2/bits/ios_base.h: - -/usr/include/c++/4.2/bits/locale_classes.h: - -/usr/include/c++/4.2/streambuf: - -/usr/include/c++/4.2/bits/streambuf.tcc: - -/usr/include/c++/4.2/bits/basic_ios.h: - -/usr/include/c++/4.2/bits/streambuf_iterator.h: - -/usr/include/c++/4.2/bits/locale_facets.h: - -/usr/include/c++/4.2/cwctype: - -/usr/include/wctype.h: - -/usr/include/c++/4.2/i486-linux-gnu/bits/ctype_base.h: - -/usr/include/c++/4.2/i486-linux-gnu/bits/ctype_inline.h: - -/usr/include/c++/4.2/bits/codecvt.h: - -/usr/include/c++/4.2/i486-linux-gnu/bits/time_members.h: - -/usr/include/c++/4.2/i486-linux-gnu/bits/messages_members.h: - -/usr/include/c++/4.2/bits/basic_ios.tcc: - -/usr/include/c++/4.2/bits/ostream.tcc: - -/usr/include/c++/4.2/locale: - -/usr/include/c++/4.2/bits/locale_facets.tcc: - -/usr/include/c++/4.2/typeinfo: - -/usr/include/c++/4.2/istream: - -/usr/include/c++/4.2/bits/istream.tcc: diff --git a/Source/DoxygenTranslator/src/.deps/DoxygenParser.Po b/Source/DoxygenTranslator/src/.deps/DoxygenParser.Po deleted file mode 100644 index 8ec874c8c..000000000 --- a/Source/DoxygenTranslator/src/.deps/DoxygenParser.Po +++ /dev/null @@ -1,387 +0,0 @@ -DoxygenTranslator/src/DoxygenParser.o \ - DoxygenTranslator/src/DoxygenParser.o: \ - DoxygenTranslator/src/DoxygenParser.cpp \ - DoxygenTranslator/src/DoxygenParser.h /usr/include/c++/4.2/string \ - /usr/include/c++/4.2/i486-linux-gnu/bits/c++config.h \ - /usr/include/c++/4.2/i486-linux-gnu/bits/os_defines.h \ - /usr/include/features.h /usr/include/sys/cdefs.h \ - /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ - /usr/include/gnu/stubs-32.h \ - /usr/include/c++/4.2/i486-linux-gnu/bits/cpu_defines.h \ - /usr/include/c++/4.2/bits/stringfwd.h \ - /usr/include/c++/4.2/bits/char_traits.h /usr/include/c++/4.2/cstring \ - /usr/include/c++/4.2/cstddef \ - /usr/lib/gcc/i486-linux-gnu/4.2.3/include/stddef.h \ - /usr/include/string.h /usr/include/xlocale.h \ - /usr/include/c++/4.2/bits/stl_algobase.h /usr/include/c++/4.2/climits \ - /usr/lib/gcc/i486-linux-gnu/4.2.3/include/limits.h \ - /usr/lib/gcc/i486-linux-gnu/4.2.3/include/syslimits.h \ - /usr/include/limits.h /usr/include/bits/posix1_lim.h \ - /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ - /usr/include/bits/posix2_lim.h /usr/include/bits/xopen_lim.h \ - /usr/include/bits/stdio_lim.h /usr/include/c++/4.2/cstdlib \ - /usr/include/stdlib.h /usr/include/bits/waitflags.h \ - /usr/include/bits/waitstatus.h /usr/include/endian.h \ - /usr/include/bits/endian.h /usr/include/sys/types.h \ - /usr/include/bits/types.h /usr/include/bits/typesizes.h \ - /usr/include/time.h /usr/include/sys/select.h \ - /usr/include/bits/select.h /usr/include/bits/sigset.h \ - /usr/include/bits/time.h /usr/include/sys/sysmacros.h \ - /usr/include/bits/pthreadtypes.h /usr/include/alloca.h \ - /usr/include/c++/4.2/iosfwd \ - /usr/include/c++/4.2/i486-linux-gnu/bits/c++locale.h \ - /usr/include/c++/4.2/cstdio /usr/include/stdio.h /usr/include/libio.h \ - /usr/include/_G_config.h /usr/include/wchar.h \ - /usr/lib/gcc/i486-linux-gnu/4.2.3/include/stdarg.h \ - /usr/include/bits/sys_errlist.h /usr/include/c++/4.2/clocale \ - /usr/include/locale.h /usr/include/bits/locale.h \ - /usr/include/langinfo.h /usr/include/nl_types.h /usr/include/iconv.h \ - /usr/include/libintl.h /usr/include/c++/4.2/cstdarg \ - /usr/include/c++/4.2/i486-linux-gnu/bits/c++io.h \ - /usr/include/c++/4.2/i486-linux-gnu/bits/gthr.h \ - /usr/include/c++/4.2/i486-linux-gnu/bits/gthr-default.h \ - /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ - /usr/include/signal.h /usr/include/bits/setjmp.h /usr/include/unistd.h \ - /usr/include/bits/posix_opt.h /usr/include/bits/environments.h \ - /usr/include/bits/confname.h /usr/include/getopt.h \ - /usr/include/c++/4.2/cctype /usr/include/ctype.h \ - /usr/include/c++/4.2/bits/postypes.h /usr/include/c++/4.2/cwchar \ - /usr/include/c++/4.2/ctime /usr/include/bits/wchar.h \ - /usr/include/stdint.h /usr/include/c++/4.2/bits/functexcept.h \ - /usr/include/c++/4.2/exception_defines.h \ - /usr/include/c++/4.2/bits/stl_pair.h \ - /usr/include/c++/4.2/bits/cpp_type_traits.h \ - /usr/include/c++/4.2/ext/type_traits.h /usr/include/c++/4.2/utility \ - /usr/include/c++/4.2/bits/stl_relops.h \ - /usr/include/c++/4.2/bits/stl_iterator_base_types.h \ - /usr/include/c++/4.2/bits/stl_iterator_base_funcs.h \ - /usr/include/c++/4.2/bits/concept_check.h \ - /usr/include/c++/4.2/bits/stl_iterator.h \ - /usr/include/c++/4.2/debug/debug.h /usr/include/c++/4.2/memory \ - /usr/include/c++/4.2/bits/allocator.h \ - /usr/include/c++/4.2/i486-linux-gnu/bits/c++allocator.h \ - /usr/include/c++/4.2/ext/new_allocator.h /usr/include/c++/4.2/new \ - /usr/include/c++/4.2/exception \ - /usr/include/c++/4.2/bits/stl_construct.h \ - /usr/include/c++/4.2/bits/stl_uninitialized.h \ - /usr/include/c++/4.2/bits/stl_raw_storage_iter.h \ - /usr/include/c++/4.2/limits /usr/include/c++/4.2/bits/ostream_insert.h \ - /usr/include/c++/4.2/bits/stl_function.h \ - /usr/include/c++/4.2/bits/basic_string.h \ - /usr/include/c++/4.2/ext/atomicity.h \ - /usr/include/c++/4.2/i486-linux-gnu/bits/atomic_word.h \ - /usr/include/c++/4.2/algorithm /usr/include/c++/4.2/bits/stl_algo.h \ - /usr/include/c++/4.2/bits/stl_heap.h \ - /usr/include/c++/4.2/bits/stl_tempbuf.h \ - /usr/include/c++/4.2/bits/basic_string.tcc /usr/include/c++/4.2/list \ - /usr/include/c++/4.2/bits/stl_list.h /usr/include/c++/4.2/bits/list.tcc \ - DoxygenTranslator/src/DoxygenEntity.h DoxygenTranslator/src/TokenList.h \ - /usr/include/c++/4.2/iostream /usr/include/c++/4.2/ostream \ - /usr/include/c++/4.2/ios /usr/include/c++/4.2/bits/localefwd.h \ - /usr/include/c++/4.2/bits/ios_base.h \ - /usr/include/c++/4.2/bits/locale_classes.h \ - /usr/include/c++/4.2/streambuf /usr/include/c++/4.2/bits/streambuf.tcc \ - /usr/include/c++/4.2/bits/basic_ios.h \ - /usr/include/c++/4.2/bits/streambuf_iterator.h \ - /usr/include/c++/4.2/bits/locale_facets.h /usr/include/c++/4.2/cwctype \ - /usr/include/wctype.h \ - /usr/include/c++/4.2/i486-linux-gnu/bits/ctype_base.h \ - /usr/include/c++/4.2/i486-linux-gnu/bits/ctype_inline.h \ - /usr/include/c++/4.2/bits/codecvt.h \ - /usr/include/c++/4.2/i486-linux-gnu/bits/time_members.h \ - /usr/include/c++/4.2/i486-linux-gnu/bits/messages_members.h \ - /usr/include/c++/4.2/bits/basic_ios.tcc \ - /usr/include/c++/4.2/bits/ostream.tcc /usr/include/c++/4.2/locale \ - /usr/include/c++/4.2/bits/locale_facets.tcc \ - /usr/include/c++/4.2/typeinfo /usr/include/c++/4.2/istream \ - /usr/include/c++/4.2/bits/istream.tcc DoxygenTranslator/src/Token.h - -DoxygenTranslator/src/DoxygenParser.h: - -/usr/include/c++/4.2/string: - -/usr/include/c++/4.2/i486-linux-gnu/bits/c++config.h: - -/usr/include/c++/4.2/i486-linux-gnu/bits/os_defines.h: - -/usr/include/features.h: - -/usr/include/sys/cdefs.h: - -/usr/include/bits/wordsize.h: - -/usr/include/gnu/stubs.h: - -/usr/include/gnu/stubs-32.h: - -/usr/include/c++/4.2/i486-linux-gnu/bits/cpu_defines.h: - -/usr/include/c++/4.2/bits/stringfwd.h: - -/usr/include/c++/4.2/bits/char_traits.h: - -/usr/include/c++/4.2/cstring: - -/usr/include/c++/4.2/cstddef: - -/usr/lib/gcc/i486-linux-gnu/4.2.3/include/stddef.h: - -/usr/include/string.h: - -/usr/include/xlocale.h: - -/usr/include/c++/4.2/bits/stl_algobase.h: - -/usr/include/c++/4.2/climits: - -/usr/lib/gcc/i486-linux-gnu/4.2.3/include/limits.h: - -/usr/lib/gcc/i486-linux-gnu/4.2.3/include/syslimits.h: - -/usr/include/limits.h: - -/usr/include/bits/posix1_lim.h: - -/usr/include/bits/local_lim.h: - -/usr/include/linux/limits.h: - -/usr/include/bits/posix2_lim.h: - -/usr/include/bits/xopen_lim.h: - -/usr/include/bits/stdio_lim.h: - -/usr/include/c++/4.2/cstdlib: - -/usr/include/stdlib.h: - -/usr/include/bits/waitflags.h: - -/usr/include/bits/waitstatus.h: - -/usr/include/endian.h: - -/usr/include/bits/endian.h: - -/usr/include/sys/types.h: - -/usr/include/bits/types.h: - -/usr/include/bits/typesizes.h: - -/usr/include/time.h: - -/usr/include/sys/select.h: - -/usr/include/bits/select.h: - -/usr/include/bits/sigset.h: - -/usr/include/bits/time.h: - -/usr/include/sys/sysmacros.h: - -/usr/include/bits/pthreadtypes.h: - -/usr/include/alloca.h: - -/usr/include/c++/4.2/iosfwd: - -/usr/include/c++/4.2/i486-linux-gnu/bits/c++locale.h: - -/usr/include/c++/4.2/cstdio: - -/usr/include/stdio.h: - -/usr/include/libio.h: - -/usr/include/_G_config.h: - -/usr/include/wchar.h: - -/usr/lib/gcc/i486-linux-gnu/4.2.3/include/stdarg.h: - -/usr/include/bits/sys_errlist.h: - -/usr/include/c++/4.2/clocale: - -/usr/include/locale.h: - -/usr/include/bits/locale.h: - -/usr/include/langinfo.h: - -/usr/include/nl_types.h: - -/usr/include/iconv.h: - -/usr/include/libintl.h: - -/usr/include/c++/4.2/cstdarg: - -/usr/include/c++/4.2/i486-linux-gnu/bits/c++io.h: - -/usr/include/c++/4.2/i486-linux-gnu/bits/gthr.h: - -/usr/include/c++/4.2/i486-linux-gnu/bits/gthr-default.h: - -/usr/include/pthread.h: - -/usr/include/sched.h: - -/usr/include/bits/sched.h: - -/usr/include/signal.h: - -/usr/include/bits/setjmp.h: - -/usr/include/unistd.h: - -/usr/include/bits/posix_opt.h: - -/usr/include/bits/environments.h: - -/usr/include/bits/confname.h: - -/usr/include/getopt.h: - -/usr/include/c++/4.2/cctype: - -/usr/include/ctype.h: - -/usr/include/c++/4.2/bits/postypes.h: - -/usr/include/c++/4.2/cwchar: - -/usr/include/c++/4.2/ctime: - -/usr/include/bits/wchar.h: - -/usr/include/stdint.h: - -/usr/include/c++/4.2/bits/functexcept.h: - -/usr/include/c++/4.2/exception_defines.h: - -/usr/include/c++/4.2/bits/stl_pair.h: - -/usr/include/c++/4.2/bits/cpp_type_traits.h: - -/usr/include/c++/4.2/ext/type_traits.h: - -/usr/include/c++/4.2/utility: - -/usr/include/c++/4.2/bits/stl_relops.h: - -/usr/include/c++/4.2/bits/stl_iterator_base_types.h: - -/usr/include/c++/4.2/bits/stl_iterator_base_funcs.h: - -/usr/include/c++/4.2/bits/concept_check.h: - -/usr/include/c++/4.2/bits/stl_iterator.h: - -/usr/include/c++/4.2/debug/debug.h: - -/usr/include/c++/4.2/memory: - -/usr/include/c++/4.2/bits/allocator.h: - -/usr/include/c++/4.2/i486-linux-gnu/bits/c++allocator.h: - -/usr/include/c++/4.2/ext/new_allocator.h: - -/usr/include/c++/4.2/new: - -/usr/include/c++/4.2/exception: - -/usr/include/c++/4.2/bits/stl_construct.h: - -/usr/include/c++/4.2/bits/stl_uninitialized.h: - -/usr/include/c++/4.2/bits/stl_raw_storage_iter.h: - -/usr/include/c++/4.2/limits: - -/usr/include/c++/4.2/bits/ostream_insert.h: - -/usr/include/c++/4.2/bits/stl_function.h: - -/usr/include/c++/4.2/bits/basic_string.h: - -/usr/include/c++/4.2/ext/atomicity.h: - -/usr/include/c++/4.2/i486-linux-gnu/bits/atomic_word.h: - -/usr/include/c++/4.2/algorithm: - -/usr/include/c++/4.2/bits/stl_algo.h: - -/usr/include/c++/4.2/bits/stl_heap.h: - -/usr/include/c++/4.2/bits/stl_tempbuf.h: - -/usr/include/c++/4.2/bits/basic_string.tcc: - -/usr/include/c++/4.2/list: - -/usr/include/c++/4.2/bits/stl_list.h: - -/usr/include/c++/4.2/bits/list.tcc: - -DoxygenTranslator/src/DoxygenEntity.h: - -DoxygenTranslator/src/TokenList.h: - -/usr/include/c++/4.2/iostream: - -/usr/include/c++/4.2/ostream: - -/usr/include/c++/4.2/ios: - -/usr/include/c++/4.2/bits/localefwd.h: - -/usr/include/c++/4.2/bits/ios_base.h: - -/usr/include/c++/4.2/bits/locale_classes.h: - -/usr/include/c++/4.2/streambuf: - -/usr/include/c++/4.2/bits/streambuf.tcc: - -/usr/include/c++/4.2/bits/basic_ios.h: - -/usr/include/c++/4.2/bits/streambuf_iterator.h: - -/usr/include/c++/4.2/bits/locale_facets.h: - -/usr/include/c++/4.2/cwctype: - -/usr/include/wctype.h: - -/usr/include/c++/4.2/i486-linux-gnu/bits/ctype_base.h: - -/usr/include/c++/4.2/i486-linux-gnu/bits/ctype_inline.h: - -/usr/include/c++/4.2/bits/codecvt.h: - -/usr/include/c++/4.2/i486-linux-gnu/bits/time_members.h: - -/usr/include/c++/4.2/i486-linux-gnu/bits/messages_members.h: - -/usr/include/c++/4.2/bits/basic_ios.tcc: - -/usr/include/c++/4.2/bits/ostream.tcc: - -/usr/include/c++/4.2/locale: - -/usr/include/c++/4.2/bits/locale_facets.tcc: - -/usr/include/c++/4.2/typeinfo: - -/usr/include/c++/4.2/istream: - -/usr/include/c++/4.2/bits/istream.tcc: - -DoxygenTranslator/src/Token.h: diff --git a/Source/DoxygenTranslator/src/.deps/DoxygenTranslator.Po b/Source/DoxygenTranslator/src/.deps/DoxygenTranslator.Po deleted file mode 100644 index 4cec6c648..000000000 --- a/Source/DoxygenTranslator/src/.deps/DoxygenTranslator.Po +++ /dev/null @@ -1,401 +0,0 @@ -DoxygenTranslator/src/DoxygenTranslator.o \ - DoxygenTranslator/src/DoxygenTranslator.o: \ - DoxygenTranslator/src/DoxygenTranslator.cpp \ - DoxygenTranslator/src/DoxygenParser.h /usr/include/c++/4.2/string \ - /usr/include/c++/4.2/i486-linux-gnu/bits/c++config.h \ - /usr/include/c++/4.2/i486-linux-gnu/bits/os_defines.h \ - /usr/include/features.h /usr/include/sys/cdefs.h \ - /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ - /usr/include/gnu/stubs-32.h \ - /usr/include/c++/4.2/i486-linux-gnu/bits/cpu_defines.h \ - /usr/include/c++/4.2/bits/stringfwd.h \ - /usr/include/c++/4.2/bits/char_traits.h /usr/include/c++/4.2/cstring \ - /usr/include/c++/4.2/cstddef \ - /usr/lib/gcc/i486-linux-gnu/4.2.3/include/stddef.h \ - /usr/include/string.h /usr/include/xlocale.h \ - /usr/include/c++/4.2/bits/stl_algobase.h /usr/include/c++/4.2/climits \ - /usr/lib/gcc/i486-linux-gnu/4.2.3/include/limits.h \ - /usr/lib/gcc/i486-linux-gnu/4.2.3/include/syslimits.h \ - /usr/include/limits.h /usr/include/bits/posix1_lim.h \ - /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ - /usr/include/bits/posix2_lim.h /usr/include/bits/xopen_lim.h \ - /usr/include/bits/stdio_lim.h /usr/include/c++/4.2/cstdlib \ - /usr/include/stdlib.h /usr/include/bits/waitflags.h \ - /usr/include/bits/waitstatus.h /usr/include/endian.h \ - /usr/include/bits/endian.h /usr/include/sys/types.h \ - /usr/include/bits/types.h /usr/include/bits/typesizes.h \ - /usr/include/time.h /usr/include/sys/select.h \ - /usr/include/bits/select.h /usr/include/bits/sigset.h \ - /usr/include/bits/time.h /usr/include/sys/sysmacros.h \ - /usr/include/bits/pthreadtypes.h /usr/include/alloca.h \ - /usr/include/c++/4.2/iosfwd \ - /usr/include/c++/4.2/i486-linux-gnu/bits/c++locale.h \ - /usr/include/c++/4.2/cstdio /usr/include/stdio.h /usr/include/libio.h \ - /usr/include/_G_config.h /usr/include/wchar.h \ - /usr/lib/gcc/i486-linux-gnu/4.2.3/include/stdarg.h \ - /usr/include/bits/sys_errlist.h /usr/include/c++/4.2/clocale \ - /usr/include/locale.h /usr/include/bits/locale.h \ - /usr/include/langinfo.h /usr/include/nl_types.h /usr/include/iconv.h \ - /usr/include/libintl.h /usr/include/c++/4.2/cstdarg \ - /usr/include/c++/4.2/i486-linux-gnu/bits/c++io.h \ - /usr/include/c++/4.2/i486-linux-gnu/bits/gthr.h \ - /usr/include/c++/4.2/i486-linux-gnu/bits/gthr-default.h \ - /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ - /usr/include/signal.h /usr/include/bits/setjmp.h /usr/include/unistd.h \ - /usr/include/bits/posix_opt.h /usr/include/bits/environments.h \ - /usr/include/bits/confname.h /usr/include/getopt.h \ - /usr/include/c++/4.2/cctype /usr/include/ctype.h \ - /usr/include/c++/4.2/bits/postypes.h /usr/include/c++/4.2/cwchar \ - /usr/include/c++/4.2/ctime /usr/include/bits/wchar.h \ - /usr/include/stdint.h /usr/include/c++/4.2/bits/functexcept.h \ - /usr/include/c++/4.2/exception_defines.h \ - /usr/include/c++/4.2/bits/stl_pair.h \ - /usr/include/c++/4.2/bits/cpp_type_traits.h \ - /usr/include/c++/4.2/ext/type_traits.h /usr/include/c++/4.2/utility \ - /usr/include/c++/4.2/bits/stl_relops.h \ - /usr/include/c++/4.2/bits/stl_iterator_base_types.h \ - /usr/include/c++/4.2/bits/stl_iterator_base_funcs.h \ - /usr/include/c++/4.2/bits/concept_check.h \ - /usr/include/c++/4.2/bits/stl_iterator.h \ - /usr/include/c++/4.2/debug/debug.h /usr/include/c++/4.2/memory \ - /usr/include/c++/4.2/bits/allocator.h \ - /usr/include/c++/4.2/i486-linux-gnu/bits/c++allocator.h \ - /usr/include/c++/4.2/ext/new_allocator.h /usr/include/c++/4.2/new \ - /usr/include/c++/4.2/exception \ - /usr/include/c++/4.2/bits/stl_construct.h \ - /usr/include/c++/4.2/bits/stl_uninitialized.h \ - /usr/include/c++/4.2/bits/stl_raw_storage_iter.h \ - /usr/include/c++/4.2/limits /usr/include/c++/4.2/bits/ostream_insert.h \ - /usr/include/c++/4.2/bits/stl_function.h \ - /usr/include/c++/4.2/bits/basic_string.h \ - /usr/include/c++/4.2/ext/atomicity.h \ - /usr/include/c++/4.2/i486-linux-gnu/bits/atomic_word.h \ - /usr/include/c++/4.2/algorithm /usr/include/c++/4.2/bits/stl_algo.h \ - /usr/include/c++/4.2/bits/stl_heap.h \ - /usr/include/c++/4.2/bits/stl_tempbuf.h \ - /usr/include/c++/4.2/bits/basic_string.tcc /usr/include/c++/4.2/list \ - /usr/include/c++/4.2/bits/stl_list.h /usr/include/c++/4.2/bits/list.tcc \ - DoxygenTranslator/src/DoxygenEntity.h \ - DoxygenTranslator/src/DoxygenTranslator.h /usr/include/c++/4.2/iostream \ - /usr/include/c++/4.2/ostream /usr/include/c++/4.2/ios \ - /usr/include/c++/4.2/bits/localefwd.h \ - /usr/include/c++/4.2/bits/ios_base.h \ - /usr/include/c++/4.2/bits/locale_classes.h \ - /usr/include/c++/4.2/streambuf /usr/include/c++/4.2/bits/streambuf.tcc \ - /usr/include/c++/4.2/bits/basic_ios.h \ - /usr/include/c++/4.2/bits/streambuf_iterator.h \ - /usr/include/c++/4.2/bits/locale_facets.h /usr/include/c++/4.2/cwctype \ - /usr/include/wctype.h \ - /usr/include/c++/4.2/i486-linux-gnu/bits/ctype_base.h \ - /usr/include/c++/4.2/i486-linux-gnu/bits/ctype_inline.h \ - /usr/include/c++/4.2/bits/codecvt.h \ - /usr/include/c++/4.2/i486-linux-gnu/bits/time_members.h \ - /usr/include/c++/4.2/i486-linux-gnu/bits/messages_members.h \ - /usr/include/c++/4.2/bits/basic_ios.tcc \ - /usr/include/c++/4.2/bits/ostream.tcc /usr/include/c++/4.2/locale \ - /usr/include/c++/4.2/bits/locale_facets.tcc \ - /usr/include/c++/4.2/typeinfo /usr/include/c++/4.2/istream \ - /usr/include/c++/4.2/bits/istream.tcc /usr/include/c++/4.2/fstream \ - /usr/include/c++/4.2/i486-linux-gnu/bits/basic_file.h \ - /usr/include/c++/4.2/bits/fstream.tcc DoxygenTranslator/src/TokenList.h \ - DoxygenTranslator/src/Token.h DoxygenTranslator/src/JavaDocConverter.h - -DoxygenTranslator/src/DoxygenParser.h: - -/usr/include/c++/4.2/string: - -/usr/include/c++/4.2/i486-linux-gnu/bits/c++config.h: - -/usr/include/c++/4.2/i486-linux-gnu/bits/os_defines.h: - -/usr/include/features.h: - -/usr/include/sys/cdefs.h: - -/usr/include/bits/wordsize.h: - -/usr/include/gnu/stubs.h: - -/usr/include/gnu/stubs-32.h: - -/usr/include/c++/4.2/i486-linux-gnu/bits/cpu_defines.h: - -/usr/include/c++/4.2/bits/stringfwd.h: - -/usr/include/c++/4.2/bits/char_traits.h: - -/usr/include/c++/4.2/cstring: - -/usr/include/c++/4.2/cstddef: - -/usr/lib/gcc/i486-linux-gnu/4.2.3/include/stddef.h: - -/usr/include/string.h: - -/usr/include/xlocale.h: - -/usr/include/c++/4.2/bits/stl_algobase.h: - -/usr/include/c++/4.2/climits: - -/usr/lib/gcc/i486-linux-gnu/4.2.3/include/limits.h: - -/usr/lib/gcc/i486-linux-gnu/4.2.3/include/syslimits.h: - -/usr/include/limits.h: - -/usr/include/bits/posix1_lim.h: - -/usr/include/bits/local_lim.h: - -/usr/include/linux/limits.h: - -/usr/include/bits/posix2_lim.h: - -/usr/include/bits/xopen_lim.h: - -/usr/include/bits/stdio_lim.h: - -/usr/include/c++/4.2/cstdlib: - -/usr/include/stdlib.h: - -/usr/include/bits/waitflags.h: - -/usr/include/bits/waitstatus.h: - -/usr/include/endian.h: - -/usr/include/bits/endian.h: - -/usr/include/sys/types.h: - -/usr/include/bits/types.h: - -/usr/include/bits/typesizes.h: - -/usr/include/time.h: - -/usr/include/sys/select.h: - -/usr/include/bits/select.h: - -/usr/include/bits/sigset.h: - -/usr/include/bits/time.h: - -/usr/include/sys/sysmacros.h: - -/usr/include/bits/pthreadtypes.h: - -/usr/include/alloca.h: - -/usr/include/c++/4.2/iosfwd: - -/usr/include/c++/4.2/i486-linux-gnu/bits/c++locale.h: - -/usr/include/c++/4.2/cstdio: - -/usr/include/stdio.h: - -/usr/include/libio.h: - -/usr/include/_G_config.h: - -/usr/include/wchar.h: - -/usr/lib/gcc/i486-linux-gnu/4.2.3/include/stdarg.h: - -/usr/include/bits/sys_errlist.h: - -/usr/include/c++/4.2/clocale: - -/usr/include/locale.h: - -/usr/include/bits/locale.h: - -/usr/include/langinfo.h: - -/usr/include/nl_types.h: - -/usr/include/iconv.h: - -/usr/include/libintl.h: - -/usr/include/c++/4.2/cstdarg: - -/usr/include/c++/4.2/i486-linux-gnu/bits/c++io.h: - -/usr/include/c++/4.2/i486-linux-gnu/bits/gthr.h: - -/usr/include/c++/4.2/i486-linux-gnu/bits/gthr-default.h: - -/usr/include/pthread.h: - -/usr/include/sched.h: - -/usr/include/bits/sched.h: - -/usr/include/signal.h: - -/usr/include/bits/setjmp.h: - -/usr/include/unistd.h: - -/usr/include/bits/posix_opt.h: - -/usr/include/bits/environments.h: - -/usr/include/bits/confname.h: - -/usr/include/getopt.h: - -/usr/include/c++/4.2/cctype: - -/usr/include/ctype.h: - -/usr/include/c++/4.2/bits/postypes.h: - -/usr/include/c++/4.2/cwchar: - -/usr/include/c++/4.2/ctime: - -/usr/include/bits/wchar.h: - -/usr/include/stdint.h: - -/usr/include/c++/4.2/bits/functexcept.h: - -/usr/include/c++/4.2/exception_defines.h: - -/usr/include/c++/4.2/bits/stl_pair.h: - -/usr/include/c++/4.2/bits/cpp_type_traits.h: - -/usr/include/c++/4.2/ext/type_traits.h: - -/usr/include/c++/4.2/utility: - -/usr/include/c++/4.2/bits/stl_relops.h: - -/usr/include/c++/4.2/bits/stl_iterator_base_types.h: - -/usr/include/c++/4.2/bits/stl_iterator_base_funcs.h: - -/usr/include/c++/4.2/bits/concept_check.h: - -/usr/include/c++/4.2/bits/stl_iterator.h: - -/usr/include/c++/4.2/debug/debug.h: - -/usr/include/c++/4.2/memory: - -/usr/include/c++/4.2/bits/allocator.h: - -/usr/include/c++/4.2/i486-linux-gnu/bits/c++allocator.h: - -/usr/include/c++/4.2/ext/new_allocator.h: - -/usr/include/c++/4.2/new: - -/usr/include/c++/4.2/exception: - -/usr/include/c++/4.2/bits/stl_construct.h: - -/usr/include/c++/4.2/bits/stl_uninitialized.h: - -/usr/include/c++/4.2/bits/stl_raw_storage_iter.h: - -/usr/include/c++/4.2/limits: - -/usr/include/c++/4.2/bits/ostream_insert.h: - -/usr/include/c++/4.2/bits/stl_function.h: - -/usr/include/c++/4.2/bits/basic_string.h: - -/usr/include/c++/4.2/ext/atomicity.h: - -/usr/include/c++/4.2/i486-linux-gnu/bits/atomic_word.h: - -/usr/include/c++/4.2/algorithm: - -/usr/include/c++/4.2/bits/stl_algo.h: - -/usr/include/c++/4.2/bits/stl_heap.h: - -/usr/include/c++/4.2/bits/stl_tempbuf.h: - -/usr/include/c++/4.2/bits/basic_string.tcc: - -/usr/include/c++/4.2/list: - -/usr/include/c++/4.2/bits/stl_list.h: - -/usr/include/c++/4.2/bits/list.tcc: - -DoxygenTranslator/src/DoxygenEntity.h: - -DoxygenTranslator/src/DoxygenTranslator.h: - -/usr/include/c++/4.2/iostream: - -/usr/include/c++/4.2/ostream: - -/usr/include/c++/4.2/ios: - -/usr/include/c++/4.2/bits/localefwd.h: - -/usr/include/c++/4.2/bits/ios_base.h: - -/usr/include/c++/4.2/bits/locale_classes.h: - -/usr/include/c++/4.2/streambuf: - -/usr/include/c++/4.2/bits/streambuf.tcc: - -/usr/include/c++/4.2/bits/basic_ios.h: - -/usr/include/c++/4.2/bits/streambuf_iterator.h: - -/usr/include/c++/4.2/bits/locale_facets.h: - -/usr/include/c++/4.2/cwctype: - -/usr/include/wctype.h: - -/usr/include/c++/4.2/i486-linux-gnu/bits/ctype_base.h: - -/usr/include/c++/4.2/i486-linux-gnu/bits/ctype_inline.h: - -/usr/include/c++/4.2/bits/codecvt.h: - -/usr/include/c++/4.2/i486-linux-gnu/bits/time_members.h: - -/usr/include/c++/4.2/i486-linux-gnu/bits/messages_members.h: - -/usr/include/c++/4.2/bits/basic_ios.tcc: - -/usr/include/c++/4.2/bits/ostream.tcc: - -/usr/include/c++/4.2/locale: - -/usr/include/c++/4.2/bits/locale_facets.tcc: - -/usr/include/c++/4.2/typeinfo: - -/usr/include/c++/4.2/istream: - -/usr/include/c++/4.2/bits/istream.tcc: - -/usr/include/c++/4.2/fstream: - -/usr/include/c++/4.2/i486-linux-gnu/bits/basic_file.h: - -/usr/include/c++/4.2/bits/fstream.tcc: - -DoxygenTranslator/src/TokenList.h: - -DoxygenTranslator/src/Token.h: - -DoxygenTranslator/src/JavaDocConverter.h: diff --git a/Source/DoxygenTranslator/src/.deps/JavaDocConverter.Po b/Source/DoxygenTranslator/src/.deps/JavaDocConverter.Po deleted file mode 100644 index 79a3133a3..000000000 --- a/Source/DoxygenTranslator/src/.deps/JavaDocConverter.Po +++ /dev/null @@ -1,385 +0,0 @@ -DoxygenTranslator/src/JavaDocConverter.o \ - DoxygenTranslator/src/JavaDocConverter.o: \ - DoxygenTranslator/src/JavaDocConverter.cpp \ - DoxygenTranslator/src/JavaDocConverter.h /usr/include/c++/4.2/list \ - /usr/include/c++/4.2/bits/functexcept.h \ - /usr/include/c++/4.2/i486-linux-gnu/bits/c++config.h \ - /usr/include/c++/4.2/i486-linux-gnu/bits/os_defines.h \ - /usr/include/features.h /usr/include/sys/cdefs.h \ - /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ - /usr/include/gnu/stubs-32.h \ - /usr/include/c++/4.2/i486-linux-gnu/bits/cpu_defines.h \ - /usr/include/c++/4.2/exception_defines.h \ - /usr/include/c++/4.2/bits/stl_algobase.h /usr/include/c++/4.2/cstring \ - /usr/include/c++/4.2/cstddef \ - /usr/lib/gcc/i486-linux-gnu/4.2.3/include/stddef.h \ - /usr/include/string.h /usr/include/xlocale.h \ - /usr/include/c++/4.2/climits \ - /usr/lib/gcc/i486-linux-gnu/4.2.3/include/limits.h \ - /usr/lib/gcc/i486-linux-gnu/4.2.3/include/syslimits.h \ - /usr/include/limits.h /usr/include/bits/posix1_lim.h \ - /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ - /usr/include/bits/posix2_lim.h /usr/include/bits/xopen_lim.h \ - /usr/include/bits/stdio_lim.h /usr/include/c++/4.2/cstdlib \ - /usr/include/stdlib.h /usr/include/bits/waitflags.h \ - /usr/include/bits/waitstatus.h /usr/include/endian.h \ - /usr/include/bits/endian.h /usr/include/sys/types.h \ - /usr/include/bits/types.h /usr/include/bits/typesizes.h \ - /usr/include/time.h /usr/include/sys/select.h \ - /usr/include/bits/select.h /usr/include/bits/sigset.h \ - /usr/include/bits/time.h /usr/include/sys/sysmacros.h \ - /usr/include/bits/pthreadtypes.h /usr/include/alloca.h \ - /usr/include/c++/4.2/iosfwd \ - /usr/include/c++/4.2/i486-linux-gnu/bits/c++locale.h \ - /usr/include/c++/4.2/cstdio /usr/include/stdio.h /usr/include/libio.h \ - /usr/include/_G_config.h /usr/include/wchar.h \ - /usr/lib/gcc/i486-linux-gnu/4.2.3/include/stdarg.h \ - /usr/include/bits/sys_errlist.h /usr/include/c++/4.2/clocale \ - /usr/include/locale.h /usr/include/bits/locale.h \ - /usr/include/langinfo.h /usr/include/nl_types.h /usr/include/iconv.h \ - /usr/include/libintl.h /usr/include/c++/4.2/cstdarg \ - /usr/include/c++/4.2/i486-linux-gnu/bits/c++io.h \ - /usr/include/c++/4.2/i486-linux-gnu/bits/gthr.h \ - /usr/include/c++/4.2/i486-linux-gnu/bits/gthr-default.h \ - /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ - /usr/include/signal.h /usr/include/bits/setjmp.h /usr/include/unistd.h \ - /usr/include/bits/posix_opt.h /usr/include/bits/environments.h \ - /usr/include/bits/confname.h /usr/include/getopt.h \ - /usr/include/c++/4.2/cctype /usr/include/ctype.h \ - /usr/include/c++/4.2/bits/stringfwd.h \ - /usr/include/c++/4.2/bits/postypes.h /usr/include/c++/4.2/cwchar \ - /usr/include/c++/4.2/ctime /usr/include/bits/wchar.h \ - /usr/include/stdint.h /usr/include/c++/4.2/bits/stl_pair.h \ - /usr/include/c++/4.2/bits/cpp_type_traits.h \ - /usr/include/c++/4.2/ext/type_traits.h /usr/include/c++/4.2/utility \ - /usr/include/c++/4.2/bits/stl_relops.h \ - /usr/include/c++/4.2/bits/stl_iterator_base_types.h \ - /usr/include/c++/4.2/bits/stl_iterator_base_funcs.h \ - /usr/include/c++/4.2/bits/concept_check.h \ - /usr/include/c++/4.2/bits/stl_iterator.h \ - /usr/include/c++/4.2/debug/debug.h \ - /usr/include/c++/4.2/bits/allocator.h \ - /usr/include/c++/4.2/i486-linux-gnu/bits/c++allocator.h \ - /usr/include/c++/4.2/ext/new_allocator.h /usr/include/c++/4.2/new \ - /usr/include/c++/4.2/exception \ - /usr/include/c++/4.2/bits/stl_construct.h \ - /usr/include/c++/4.2/bits/stl_uninitialized.h \ - /usr/include/c++/4.2/bits/stl_list.h /usr/include/c++/4.2/bits/list.tcc \ - /usr/include/c++/4.2/string /usr/include/c++/4.2/bits/char_traits.h \ - /usr/include/c++/4.2/memory \ - /usr/include/c++/4.2/bits/stl_raw_storage_iter.h \ - /usr/include/c++/4.2/limits /usr/include/c++/4.2/bits/ostream_insert.h \ - /usr/include/c++/4.2/bits/stl_function.h \ - /usr/include/c++/4.2/bits/basic_string.h \ - /usr/include/c++/4.2/ext/atomicity.h \ - /usr/include/c++/4.2/i486-linux-gnu/bits/atomic_word.h \ - /usr/include/c++/4.2/algorithm /usr/include/c++/4.2/bits/stl_algo.h \ - /usr/include/c++/4.2/bits/stl_heap.h \ - /usr/include/c++/4.2/bits/stl_tempbuf.h \ - /usr/include/c++/4.2/bits/basic_string.tcc \ - DoxygenTranslator/src/DoxygenEntity.h /usr/include/c++/4.2/iostream \ - /usr/include/c++/4.2/ostream /usr/include/c++/4.2/ios \ - /usr/include/c++/4.2/bits/localefwd.h \ - /usr/include/c++/4.2/bits/ios_base.h \ - /usr/include/c++/4.2/bits/locale_classes.h \ - /usr/include/c++/4.2/streambuf /usr/include/c++/4.2/bits/streambuf.tcc \ - /usr/include/c++/4.2/bits/basic_ios.h \ - /usr/include/c++/4.2/bits/streambuf_iterator.h \ - /usr/include/c++/4.2/bits/locale_facets.h /usr/include/c++/4.2/cwctype \ - /usr/include/wctype.h \ - /usr/include/c++/4.2/i486-linux-gnu/bits/ctype_base.h \ - /usr/include/c++/4.2/i486-linux-gnu/bits/ctype_inline.h \ - /usr/include/c++/4.2/bits/codecvt.h \ - /usr/include/c++/4.2/i486-linux-gnu/bits/time_members.h \ - /usr/include/c++/4.2/i486-linux-gnu/bits/messages_members.h \ - /usr/include/c++/4.2/bits/basic_ios.tcc \ - /usr/include/c++/4.2/bits/ostream.tcc /usr/include/c++/4.2/locale \ - /usr/include/c++/4.2/bits/locale_facets.tcc \ - /usr/include/c++/4.2/typeinfo /usr/include/c++/4.2/istream \ - /usr/include/c++/4.2/bits/istream.tcc - -DoxygenTranslator/src/JavaDocConverter.h: - -/usr/include/c++/4.2/list: - -/usr/include/c++/4.2/bits/functexcept.h: - -/usr/include/c++/4.2/i486-linux-gnu/bits/c++config.h: - -/usr/include/c++/4.2/i486-linux-gnu/bits/os_defines.h: - -/usr/include/features.h: - -/usr/include/sys/cdefs.h: - -/usr/include/bits/wordsize.h: - -/usr/include/gnu/stubs.h: - -/usr/include/gnu/stubs-32.h: - -/usr/include/c++/4.2/i486-linux-gnu/bits/cpu_defines.h: - -/usr/include/c++/4.2/exception_defines.h: - -/usr/include/c++/4.2/bits/stl_algobase.h: - -/usr/include/c++/4.2/cstring: - -/usr/include/c++/4.2/cstddef: - -/usr/lib/gcc/i486-linux-gnu/4.2.3/include/stddef.h: - -/usr/include/string.h: - -/usr/include/xlocale.h: - -/usr/include/c++/4.2/climits: - -/usr/lib/gcc/i486-linux-gnu/4.2.3/include/limits.h: - -/usr/lib/gcc/i486-linux-gnu/4.2.3/include/syslimits.h: - -/usr/include/limits.h: - -/usr/include/bits/posix1_lim.h: - -/usr/include/bits/local_lim.h: - -/usr/include/linux/limits.h: - -/usr/include/bits/posix2_lim.h: - -/usr/include/bits/xopen_lim.h: - -/usr/include/bits/stdio_lim.h: - -/usr/include/c++/4.2/cstdlib: - -/usr/include/stdlib.h: - -/usr/include/bits/waitflags.h: - -/usr/include/bits/waitstatus.h: - -/usr/include/endian.h: - -/usr/include/bits/endian.h: - -/usr/include/sys/types.h: - -/usr/include/bits/types.h: - -/usr/include/bits/typesizes.h: - -/usr/include/time.h: - -/usr/include/sys/select.h: - -/usr/include/bits/select.h: - -/usr/include/bits/sigset.h: - -/usr/include/bits/time.h: - -/usr/include/sys/sysmacros.h: - -/usr/include/bits/pthreadtypes.h: - -/usr/include/alloca.h: - -/usr/include/c++/4.2/iosfwd: - -/usr/include/c++/4.2/i486-linux-gnu/bits/c++locale.h: - -/usr/include/c++/4.2/cstdio: - -/usr/include/stdio.h: - -/usr/include/libio.h: - -/usr/include/_G_config.h: - -/usr/include/wchar.h: - -/usr/lib/gcc/i486-linux-gnu/4.2.3/include/stdarg.h: - -/usr/include/bits/sys_errlist.h: - -/usr/include/c++/4.2/clocale: - -/usr/include/locale.h: - -/usr/include/bits/locale.h: - -/usr/include/langinfo.h: - -/usr/include/nl_types.h: - -/usr/include/iconv.h: - -/usr/include/libintl.h: - -/usr/include/c++/4.2/cstdarg: - -/usr/include/c++/4.2/i486-linux-gnu/bits/c++io.h: - -/usr/include/c++/4.2/i486-linux-gnu/bits/gthr.h: - -/usr/include/c++/4.2/i486-linux-gnu/bits/gthr-default.h: - -/usr/include/pthread.h: - -/usr/include/sched.h: - -/usr/include/bits/sched.h: - -/usr/include/signal.h: - -/usr/include/bits/setjmp.h: - -/usr/include/unistd.h: - -/usr/include/bits/posix_opt.h: - -/usr/include/bits/environments.h: - -/usr/include/bits/confname.h: - -/usr/include/getopt.h: - -/usr/include/c++/4.2/cctype: - -/usr/include/ctype.h: - -/usr/include/c++/4.2/bits/stringfwd.h: - -/usr/include/c++/4.2/bits/postypes.h: - -/usr/include/c++/4.2/cwchar: - -/usr/include/c++/4.2/ctime: - -/usr/include/bits/wchar.h: - -/usr/include/stdint.h: - -/usr/include/c++/4.2/bits/stl_pair.h: - -/usr/include/c++/4.2/bits/cpp_type_traits.h: - -/usr/include/c++/4.2/ext/type_traits.h: - -/usr/include/c++/4.2/utility: - -/usr/include/c++/4.2/bits/stl_relops.h: - -/usr/include/c++/4.2/bits/stl_iterator_base_types.h: - -/usr/include/c++/4.2/bits/stl_iterator_base_funcs.h: - -/usr/include/c++/4.2/bits/concept_check.h: - -/usr/include/c++/4.2/bits/stl_iterator.h: - -/usr/include/c++/4.2/debug/debug.h: - -/usr/include/c++/4.2/bits/allocator.h: - -/usr/include/c++/4.2/i486-linux-gnu/bits/c++allocator.h: - -/usr/include/c++/4.2/ext/new_allocator.h: - -/usr/include/c++/4.2/new: - -/usr/include/c++/4.2/exception: - -/usr/include/c++/4.2/bits/stl_construct.h: - -/usr/include/c++/4.2/bits/stl_uninitialized.h: - -/usr/include/c++/4.2/bits/stl_list.h: - -/usr/include/c++/4.2/bits/list.tcc: - -/usr/include/c++/4.2/string: - -/usr/include/c++/4.2/bits/char_traits.h: - -/usr/include/c++/4.2/memory: - -/usr/include/c++/4.2/bits/stl_raw_storage_iter.h: - -/usr/include/c++/4.2/limits: - -/usr/include/c++/4.2/bits/ostream_insert.h: - -/usr/include/c++/4.2/bits/stl_function.h: - -/usr/include/c++/4.2/bits/basic_string.h: - -/usr/include/c++/4.2/ext/atomicity.h: - -/usr/include/c++/4.2/i486-linux-gnu/bits/atomic_word.h: - -/usr/include/c++/4.2/algorithm: - -/usr/include/c++/4.2/bits/stl_algo.h: - -/usr/include/c++/4.2/bits/stl_heap.h: - -/usr/include/c++/4.2/bits/stl_tempbuf.h: - -/usr/include/c++/4.2/bits/basic_string.tcc: - -DoxygenTranslator/src/DoxygenEntity.h: - -/usr/include/c++/4.2/iostream: - -/usr/include/c++/4.2/ostream: - -/usr/include/c++/4.2/ios: - -/usr/include/c++/4.2/bits/localefwd.h: - -/usr/include/c++/4.2/bits/ios_base.h: - -/usr/include/c++/4.2/bits/locale_classes.h: - -/usr/include/c++/4.2/streambuf: - -/usr/include/c++/4.2/bits/streambuf.tcc: - -/usr/include/c++/4.2/bits/basic_ios.h: - -/usr/include/c++/4.2/bits/streambuf_iterator.h: - -/usr/include/c++/4.2/bits/locale_facets.h: - -/usr/include/c++/4.2/cwctype: - -/usr/include/wctype.h: - -/usr/include/c++/4.2/i486-linux-gnu/bits/ctype_base.h: - -/usr/include/c++/4.2/i486-linux-gnu/bits/ctype_inline.h: - -/usr/include/c++/4.2/bits/codecvt.h: - -/usr/include/c++/4.2/i486-linux-gnu/bits/time_members.h: - -/usr/include/c++/4.2/i486-linux-gnu/bits/messages_members.h: - -/usr/include/c++/4.2/bits/basic_ios.tcc: - -/usr/include/c++/4.2/bits/ostream.tcc: - -/usr/include/c++/4.2/locale: - -/usr/include/c++/4.2/bits/locale_facets.tcc: - -/usr/include/c++/4.2/typeinfo: - -/usr/include/c++/4.2/istream: - -/usr/include/c++/4.2/bits/istream.tcc: diff --git a/Source/DoxygenTranslator/src/.deps/Token.Po b/Source/DoxygenTranslator/src/.deps/Token.Po deleted file mode 100644 index dbfe541b1..000000000 --- a/Source/DoxygenTranslator/src/.deps/Token.Po +++ /dev/null @@ -1,303 +0,0 @@ -DoxygenTranslator/src/Token.o DoxygenTranslator/src/Token.o: \ - DoxygenTranslator/src/Token.cpp DoxygenTranslator/src/Token.h \ - /usr/include/c++/4.2/string \ - /usr/include/c++/4.2/i486-linux-gnu/bits/c++config.h \ - /usr/include/c++/4.2/i486-linux-gnu/bits/os_defines.h \ - /usr/include/features.h /usr/include/sys/cdefs.h \ - /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ - /usr/include/gnu/stubs-32.h \ - /usr/include/c++/4.2/i486-linux-gnu/bits/cpu_defines.h \ - /usr/include/c++/4.2/bits/stringfwd.h \ - /usr/include/c++/4.2/bits/char_traits.h /usr/include/c++/4.2/cstring \ - /usr/include/c++/4.2/cstddef \ - /usr/lib/gcc/i486-linux-gnu/4.2.3/include/stddef.h \ - /usr/include/string.h /usr/include/xlocale.h \ - /usr/include/c++/4.2/bits/stl_algobase.h /usr/include/c++/4.2/climits \ - /usr/lib/gcc/i486-linux-gnu/4.2.3/include/limits.h \ - /usr/lib/gcc/i486-linux-gnu/4.2.3/include/syslimits.h \ - /usr/include/limits.h /usr/include/bits/posix1_lim.h \ - /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ - /usr/include/bits/posix2_lim.h /usr/include/bits/xopen_lim.h \ - /usr/include/bits/stdio_lim.h /usr/include/c++/4.2/cstdlib \ - /usr/include/stdlib.h /usr/include/bits/waitflags.h \ - /usr/include/bits/waitstatus.h /usr/include/endian.h \ - /usr/include/bits/endian.h /usr/include/sys/types.h \ - /usr/include/bits/types.h /usr/include/bits/typesizes.h \ - /usr/include/time.h /usr/include/sys/select.h \ - /usr/include/bits/select.h /usr/include/bits/sigset.h \ - /usr/include/bits/time.h /usr/include/sys/sysmacros.h \ - /usr/include/bits/pthreadtypes.h /usr/include/alloca.h \ - /usr/include/c++/4.2/iosfwd \ - /usr/include/c++/4.2/i486-linux-gnu/bits/c++locale.h \ - /usr/include/c++/4.2/cstdio /usr/include/stdio.h /usr/include/libio.h \ - /usr/include/_G_config.h /usr/include/wchar.h \ - /usr/lib/gcc/i486-linux-gnu/4.2.3/include/stdarg.h \ - /usr/include/bits/sys_errlist.h /usr/include/c++/4.2/clocale \ - /usr/include/locale.h /usr/include/bits/locale.h \ - /usr/include/langinfo.h /usr/include/nl_types.h /usr/include/iconv.h \ - /usr/include/libintl.h /usr/include/c++/4.2/cstdarg \ - /usr/include/c++/4.2/i486-linux-gnu/bits/c++io.h \ - /usr/include/c++/4.2/i486-linux-gnu/bits/gthr.h \ - /usr/include/c++/4.2/i486-linux-gnu/bits/gthr-default.h \ - /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ - /usr/include/signal.h /usr/include/bits/setjmp.h /usr/include/unistd.h \ - /usr/include/bits/posix_opt.h /usr/include/bits/environments.h \ - /usr/include/bits/confname.h /usr/include/getopt.h \ - /usr/include/c++/4.2/cctype /usr/include/ctype.h \ - /usr/include/c++/4.2/bits/postypes.h /usr/include/c++/4.2/cwchar \ - /usr/include/c++/4.2/ctime /usr/include/bits/wchar.h \ - /usr/include/stdint.h /usr/include/c++/4.2/bits/functexcept.h \ - /usr/include/c++/4.2/exception_defines.h \ - /usr/include/c++/4.2/bits/stl_pair.h \ - /usr/include/c++/4.2/bits/cpp_type_traits.h \ - /usr/include/c++/4.2/ext/type_traits.h /usr/include/c++/4.2/utility \ - /usr/include/c++/4.2/bits/stl_relops.h \ - /usr/include/c++/4.2/bits/stl_iterator_base_types.h \ - /usr/include/c++/4.2/bits/stl_iterator_base_funcs.h \ - /usr/include/c++/4.2/bits/concept_check.h \ - /usr/include/c++/4.2/bits/stl_iterator.h \ - /usr/include/c++/4.2/debug/debug.h /usr/include/c++/4.2/memory \ - /usr/include/c++/4.2/bits/allocator.h \ - /usr/include/c++/4.2/i486-linux-gnu/bits/c++allocator.h \ - /usr/include/c++/4.2/ext/new_allocator.h /usr/include/c++/4.2/new \ - /usr/include/c++/4.2/exception \ - /usr/include/c++/4.2/bits/stl_construct.h \ - /usr/include/c++/4.2/bits/stl_uninitialized.h \ - /usr/include/c++/4.2/bits/stl_raw_storage_iter.h \ - /usr/include/c++/4.2/limits /usr/include/c++/4.2/bits/ostream_insert.h \ - /usr/include/c++/4.2/bits/stl_function.h \ - /usr/include/c++/4.2/bits/basic_string.h \ - /usr/include/c++/4.2/ext/atomicity.h \ - /usr/include/c++/4.2/i486-linux-gnu/bits/atomic_word.h \ - /usr/include/c++/4.2/algorithm /usr/include/c++/4.2/bits/stl_algo.h \ - /usr/include/c++/4.2/bits/stl_heap.h \ - /usr/include/c++/4.2/bits/stl_tempbuf.h \ - /usr/include/c++/4.2/bits/basic_string.tcc - -DoxygenTranslator/src/Token.h: - -/usr/include/c++/4.2/string: - -/usr/include/c++/4.2/i486-linux-gnu/bits/c++config.h: - -/usr/include/c++/4.2/i486-linux-gnu/bits/os_defines.h: - -/usr/include/features.h: - -/usr/include/sys/cdefs.h: - -/usr/include/bits/wordsize.h: - -/usr/include/gnu/stubs.h: - -/usr/include/gnu/stubs-32.h: - -/usr/include/c++/4.2/i486-linux-gnu/bits/cpu_defines.h: - -/usr/include/c++/4.2/bits/stringfwd.h: - -/usr/include/c++/4.2/bits/char_traits.h: - -/usr/include/c++/4.2/cstring: - -/usr/include/c++/4.2/cstddef: - -/usr/lib/gcc/i486-linux-gnu/4.2.3/include/stddef.h: - -/usr/include/string.h: - -/usr/include/xlocale.h: - -/usr/include/c++/4.2/bits/stl_algobase.h: - -/usr/include/c++/4.2/climits: - -/usr/lib/gcc/i486-linux-gnu/4.2.3/include/limits.h: - -/usr/lib/gcc/i486-linux-gnu/4.2.3/include/syslimits.h: - -/usr/include/limits.h: - -/usr/include/bits/posix1_lim.h: - -/usr/include/bits/local_lim.h: - -/usr/include/linux/limits.h: - -/usr/include/bits/posix2_lim.h: - -/usr/include/bits/xopen_lim.h: - -/usr/include/bits/stdio_lim.h: - -/usr/include/c++/4.2/cstdlib: - -/usr/include/stdlib.h: - -/usr/include/bits/waitflags.h: - -/usr/include/bits/waitstatus.h: - -/usr/include/endian.h: - -/usr/include/bits/endian.h: - -/usr/include/sys/types.h: - -/usr/include/bits/types.h: - -/usr/include/bits/typesizes.h: - -/usr/include/time.h: - -/usr/include/sys/select.h: - -/usr/include/bits/select.h: - -/usr/include/bits/sigset.h: - -/usr/include/bits/time.h: - -/usr/include/sys/sysmacros.h: - -/usr/include/bits/pthreadtypes.h: - -/usr/include/alloca.h: - -/usr/include/c++/4.2/iosfwd: - -/usr/include/c++/4.2/i486-linux-gnu/bits/c++locale.h: - -/usr/include/c++/4.2/cstdio: - -/usr/include/stdio.h: - -/usr/include/libio.h: - -/usr/include/_G_config.h: - -/usr/include/wchar.h: - -/usr/lib/gcc/i486-linux-gnu/4.2.3/include/stdarg.h: - -/usr/include/bits/sys_errlist.h: - -/usr/include/c++/4.2/clocale: - -/usr/include/locale.h: - -/usr/include/bits/locale.h: - -/usr/include/langinfo.h: - -/usr/include/nl_types.h: - -/usr/include/iconv.h: - -/usr/include/libintl.h: - -/usr/include/c++/4.2/cstdarg: - -/usr/include/c++/4.2/i486-linux-gnu/bits/c++io.h: - -/usr/include/c++/4.2/i486-linux-gnu/bits/gthr.h: - -/usr/include/c++/4.2/i486-linux-gnu/bits/gthr-default.h: - -/usr/include/pthread.h: - -/usr/include/sched.h: - -/usr/include/bits/sched.h: - -/usr/include/signal.h: - -/usr/include/bits/setjmp.h: - -/usr/include/unistd.h: - -/usr/include/bits/posix_opt.h: - -/usr/include/bits/environments.h: - -/usr/include/bits/confname.h: - -/usr/include/getopt.h: - -/usr/include/c++/4.2/cctype: - -/usr/include/ctype.h: - -/usr/include/c++/4.2/bits/postypes.h: - -/usr/include/c++/4.2/cwchar: - -/usr/include/c++/4.2/ctime: - -/usr/include/bits/wchar.h: - -/usr/include/stdint.h: - -/usr/include/c++/4.2/bits/functexcept.h: - -/usr/include/c++/4.2/exception_defines.h: - -/usr/include/c++/4.2/bits/stl_pair.h: - -/usr/include/c++/4.2/bits/cpp_type_traits.h: - -/usr/include/c++/4.2/ext/type_traits.h: - -/usr/include/c++/4.2/utility: - -/usr/include/c++/4.2/bits/stl_relops.h: - -/usr/include/c++/4.2/bits/stl_iterator_base_types.h: - -/usr/include/c++/4.2/bits/stl_iterator_base_funcs.h: - -/usr/include/c++/4.2/bits/concept_check.h: - -/usr/include/c++/4.2/bits/stl_iterator.h: - -/usr/include/c++/4.2/debug/debug.h: - -/usr/include/c++/4.2/memory: - -/usr/include/c++/4.2/bits/allocator.h: - -/usr/include/c++/4.2/i486-linux-gnu/bits/c++allocator.h: - -/usr/include/c++/4.2/ext/new_allocator.h: - -/usr/include/c++/4.2/new: - -/usr/include/c++/4.2/exception: - -/usr/include/c++/4.2/bits/stl_construct.h: - -/usr/include/c++/4.2/bits/stl_uninitialized.h: - -/usr/include/c++/4.2/bits/stl_raw_storage_iter.h: - -/usr/include/c++/4.2/limits: - -/usr/include/c++/4.2/bits/ostream_insert.h: - -/usr/include/c++/4.2/bits/stl_function.h: - -/usr/include/c++/4.2/bits/basic_string.h: - -/usr/include/c++/4.2/ext/atomicity.h: - -/usr/include/c++/4.2/i486-linux-gnu/bits/atomic_word.h: - -/usr/include/c++/4.2/algorithm: - -/usr/include/c++/4.2/bits/stl_algo.h: - -/usr/include/c++/4.2/bits/stl_heap.h: - -/usr/include/c++/4.2/bits/stl_tempbuf.h: - -/usr/include/c++/4.2/bits/basic_string.tcc: diff --git a/Source/DoxygenTranslator/src/.deps/TokenList.Po b/Source/DoxygenTranslator/src/.deps/TokenList.Po deleted file mode 100644 index 74d0e1c79..000000000 --- a/Source/DoxygenTranslator/src/.deps/TokenList.Po +++ /dev/null @@ -1,382 +0,0 @@ -DoxygenTranslator/src/TokenList.o DoxygenTranslator/src/TokenList.o: \ - DoxygenTranslator/src/TokenList.cpp DoxygenTranslator/src/TokenList.h \ - /usr/include/c++/4.2/cstdlib \ - /usr/include/c++/4.2/i486-linux-gnu/bits/c++config.h \ - /usr/include/c++/4.2/i486-linux-gnu/bits/os_defines.h \ - /usr/include/features.h /usr/include/sys/cdefs.h \ - /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ - /usr/include/gnu/stubs-32.h \ - /usr/include/c++/4.2/i486-linux-gnu/bits/cpu_defines.h \ - /usr/include/c++/4.2/cstddef \ - /usr/lib/gcc/i486-linux-gnu/4.2.3/include/stddef.h \ - /usr/include/stdlib.h /usr/include/bits/waitflags.h \ - /usr/include/bits/waitstatus.h /usr/include/endian.h \ - /usr/include/bits/endian.h /usr/include/xlocale.h \ - /usr/include/sys/types.h /usr/include/bits/types.h \ - /usr/include/bits/typesizes.h /usr/include/time.h \ - /usr/include/sys/select.h /usr/include/bits/select.h \ - /usr/include/bits/sigset.h /usr/include/bits/time.h \ - /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ - /usr/include/alloca.h /usr/include/c++/4.2/iostream \ - /usr/include/c++/4.2/ostream /usr/include/c++/4.2/ios \ - /usr/include/c++/4.2/iosfwd \ - /usr/include/c++/4.2/i486-linux-gnu/bits/c++locale.h \ - /usr/include/c++/4.2/cstring /usr/include/string.h \ - /usr/include/c++/4.2/cstdio /usr/include/stdio.h /usr/include/libio.h \ - /usr/include/_G_config.h /usr/include/wchar.h \ - /usr/lib/gcc/i486-linux-gnu/4.2.3/include/stdarg.h \ - /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ - /usr/include/c++/4.2/clocale /usr/include/locale.h \ - /usr/include/bits/locale.h /usr/include/langinfo.h \ - /usr/include/nl_types.h /usr/include/iconv.h /usr/include/libintl.h \ - /usr/include/c++/4.2/cstdarg \ - /usr/include/c++/4.2/i486-linux-gnu/bits/c++io.h \ - /usr/include/c++/4.2/i486-linux-gnu/bits/gthr.h \ - /usr/include/c++/4.2/i486-linux-gnu/bits/gthr-default.h \ - /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ - /usr/include/signal.h /usr/include/bits/setjmp.h /usr/include/unistd.h \ - /usr/include/bits/posix_opt.h /usr/include/bits/environments.h \ - /usr/include/bits/confname.h /usr/include/getopt.h \ - /usr/include/c++/4.2/cctype /usr/include/ctype.h \ - /usr/include/c++/4.2/bits/stringfwd.h \ - /usr/include/c++/4.2/bits/postypes.h /usr/include/c++/4.2/cwchar \ - /usr/include/c++/4.2/ctime /usr/include/bits/wchar.h \ - /usr/include/stdint.h /usr/include/c++/4.2/bits/functexcept.h \ - /usr/include/c++/4.2/exception_defines.h /usr/include/c++/4.2/exception \ - /usr/include/c++/4.2/bits/char_traits.h \ - /usr/include/c++/4.2/bits/stl_algobase.h /usr/include/c++/4.2/climits \ - /usr/lib/gcc/i486-linux-gnu/4.2.3/include/limits.h \ - /usr/lib/gcc/i486-linux-gnu/4.2.3/include/syslimits.h \ - /usr/include/limits.h /usr/include/bits/posix1_lim.h \ - /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ - /usr/include/bits/posix2_lim.h /usr/include/bits/xopen_lim.h \ - /usr/include/c++/4.2/bits/stl_pair.h \ - /usr/include/c++/4.2/bits/cpp_type_traits.h \ - /usr/include/c++/4.2/ext/type_traits.h /usr/include/c++/4.2/utility \ - /usr/include/c++/4.2/bits/stl_relops.h \ - /usr/include/c++/4.2/bits/stl_iterator_base_types.h \ - /usr/include/c++/4.2/bits/stl_iterator_base_funcs.h \ - /usr/include/c++/4.2/bits/concept_check.h \ - /usr/include/c++/4.2/bits/stl_iterator.h \ - /usr/include/c++/4.2/debug/debug.h \ - /usr/include/c++/4.2/bits/localefwd.h \ - /usr/include/c++/4.2/bits/ios_base.h \ - /usr/include/c++/4.2/ext/atomicity.h \ - /usr/include/c++/4.2/i486-linux-gnu/bits/atomic_word.h \ - /usr/include/c++/4.2/bits/locale_classes.h /usr/include/c++/4.2/string \ - /usr/include/c++/4.2/memory /usr/include/c++/4.2/bits/allocator.h \ - /usr/include/c++/4.2/i486-linux-gnu/bits/c++allocator.h \ - /usr/include/c++/4.2/ext/new_allocator.h /usr/include/c++/4.2/new \ - /usr/include/c++/4.2/bits/stl_construct.h \ - /usr/include/c++/4.2/bits/stl_uninitialized.h \ - /usr/include/c++/4.2/bits/stl_raw_storage_iter.h \ - /usr/include/c++/4.2/limits /usr/include/c++/4.2/bits/ostream_insert.h \ - /usr/include/c++/4.2/bits/stl_function.h \ - /usr/include/c++/4.2/bits/basic_string.h /usr/include/c++/4.2/algorithm \ - /usr/include/c++/4.2/bits/stl_algo.h \ - /usr/include/c++/4.2/bits/stl_heap.h \ - /usr/include/c++/4.2/bits/stl_tempbuf.h \ - /usr/include/c++/4.2/bits/basic_string.tcc \ - /usr/include/c++/4.2/streambuf /usr/include/c++/4.2/bits/streambuf.tcc \ - /usr/include/c++/4.2/bits/basic_ios.h \ - /usr/include/c++/4.2/bits/streambuf_iterator.h \ - /usr/include/c++/4.2/bits/locale_facets.h /usr/include/c++/4.2/cwctype \ - /usr/include/wctype.h \ - /usr/include/c++/4.2/i486-linux-gnu/bits/ctype_base.h \ - /usr/include/c++/4.2/i486-linux-gnu/bits/ctype_inline.h \ - /usr/include/c++/4.2/bits/codecvt.h \ - /usr/include/c++/4.2/i486-linux-gnu/bits/time_members.h \ - /usr/include/c++/4.2/i486-linux-gnu/bits/messages_members.h \ - /usr/include/c++/4.2/bits/basic_ios.tcc \ - /usr/include/c++/4.2/bits/ostream.tcc /usr/include/c++/4.2/locale \ - /usr/include/c++/4.2/bits/locale_facets.tcc \ - /usr/include/c++/4.2/typeinfo /usr/include/c++/4.2/istream \ - /usr/include/c++/4.2/bits/istream.tcc /usr/include/c++/4.2/list \ - /usr/include/c++/4.2/bits/stl_list.h /usr/include/c++/4.2/bits/list.tcc \ - DoxygenTranslator/src/Token.h - -DoxygenTranslator/src/TokenList.h: - -/usr/include/c++/4.2/cstdlib: - -/usr/include/c++/4.2/i486-linux-gnu/bits/c++config.h: - -/usr/include/c++/4.2/i486-linux-gnu/bits/os_defines.h: - -/usr/include/features.h: - -/usr/include/sys/cdefs.h: - -/usr/include/bits/wordsize.h: - -/usr/include/gnu/stubs.h: - -/usr/include/gnu/stubs-32.h: - -/usr/include/c++/4.2/i486-linux-gnu/bits/cpu_defines.h: - -/usr/include/c++/4.2/cstddef: - -/usr/lib/gcc/i486-linux-gnu/4.2.3/include/stddef.h: - -/usr/include/stdlib.h: - -/usr/include/bits/waitflags.h: - -/usr/include/bits/waitstatus.h: - -/usr/include/endian.h: - -/usr/include/bits/endian.h: - -/usr/include/xlocale.h: - -/usr/include/sys/types.h: - -/usr/include/bits/types.h: - -/usr/include/bits/typesizes.h: - -/usr/include/time.h: - -/usr/include/sys/select.h: - -/usr/include/bits/select.h: - -/usr/include/bits/sigset.h: - -/usr/include/bits/time.h: - -/usr/include/sys/sysmacros.h: - -/usr/include/bits/pthreadtypes.h: - -/usr/include/alloca.h: - -/usr/include/c++/4.2/iostream: - -/usr/include/c++/4.2/ostream: - -/usr/include/c++/4.2/ios: - -/usr/include/c++/4.2/iosfwd: - -/usr/include/c++/4.2/i486-linux-gnu/bits/c++locale.h: - -/usr/include/c++/4.2/cstring: - -/usr/include/string.h: - -/usr/include/c++/4.2/cstdio: - -/usr/include/stdio.h: - -/usr/include/libio.h: - -/usr/include/_G_config.h: - -/usr/include/wchar.h: - -/usr/lib/gcc/i486-linux-gnu/4.2.3/include/stdarg.h: - -/usr/include/bits/stdio_lim.h: - -/usr/include/bits/sys_errlist.h: - -/usr/include/c++/4.2/clocale: - -/usr/include/locale.h: - -/usr/include/bits/locale.h: - -/usr/include/langinfo.h: - -/usr/include/nl_types.h: - -/usr/include/iconv.h: - -/usr/include/libintl.h: - -/usr/include/c++/4.2/cstdarg: - -/usr/include/c++/4.2/i486-linux-gnu/bits/c++io.h: - -/usr/include/c++/4.2/i486-linux-gnu/bits/gthr.h: - -/usr/include/c++/4.2/i486-linux-gnu/bits/gthr-default.h: - -/usr/include/pthread.h: - -/usr/include/sched.h: - -/usr/include/bits/sched.h: - -/usr/include/signal.h: - -/usr/include/bits/setjmp.h: - -/usr/include/unistd.h: - -/usr/include/bits/posix_opt.h: - -/usr/include/bits/environments.h: - -/usr/include/bits/confname.h: - -/usr/include/getopt.h: - -/usr/include/c++/4.2/cctype: - -/usr/include/ctype.h: - -/usr/include/c++/4.2/bits/stringfwd.h: - -/usr/include/c++/4.2/bits/postypes.h: - -/usr/include/c++/4.2/cwchar: - -/usr/include/c++/4.2/ctime: - -/usr/include/bits/wchar.h: - -/usr/include/stdint.h: - -/usr/include/c++/4.2/bits/functexcept.h: - -/usr/include/c++/4.2/exception_defines.h: - -/usr/include/c++/4.2/exception: - -/usr/include/c++/4.2/bits/char_traits.h: - -/usr/include/c++/4.2/bits/stl_algobase.h: - -/usr/include/c++/4.2/climits: - -/usr/lib/gcc/i486-linux-gnu/4.2.3/include/limits.h: - -/usr/lib/gcc/i486-linux-gnu/4.2.3/include/syslimits.h: - -/usr/include/limits.h: - -/usr/include/bits/posix1_lim.h: - -/usr/include/bits/local_lim.h: - -/usr/include/linux/limits.h: - -/usr/include/bits/posix2_lim.h: - -/usr/include/bits/xopen_lim.h: - -/usr/include/c++/4.2/bits/stl_pair.h: - -/usr/include/c++/4.2/bits/cpp_type_traits.h: - -/usr/include/c++/4.2/ext/type_traits.h: - -/usr/include/c++/4.2/utility: - -/usr/include/c++/4.2/bits/stl_relops.h: - -/usr/include/c++/4.2/bits/stl_iterator_base_types.h: - -/usr/include/c++/4.2/bits/stl_iterator_base_funcs.h: - -/usr/include/c++/4.2/bits/concept_check.h: - -/usr/include/c++/4.2/bits/stl_iterator.h: - -/usr/include/c++/4.2/debug/debug.h: - -/usr/include/c++/4.2/bits/localefwd.h: - -/usr/include/c++/4.2/bits/ios_base.h: - -/usr/include/c++/4.2/ext/atomicity.h: - -/usr/include/c++/4.2/i486-linux-gnu/bits/atomic_word.h: - -/usr/include/c++/4.2/bits/locale_classes.h: - -/usr/include/c++/4.2/string: - -/usr/include/c++/4.2/memory: - -/usr/include/c++/4.2/bits/allocator.h: - -/usr/include/c++/4.2/i486-linux-gnu/bits/c++allocator.h: - -/usr/include/c++/4.2/ext/new_allocator.h: - -/usr/include/c++/4.2/new: - -/usr/include/c++/4.2/bits/stl_construct.h: - -/usr/include/c++/4.2/bits/stl_uninitialized.h: - -/usr/include/c++/4.2/bits/stl_raw_storage_iter.h: - -/usr/include/c++/4.2/limits: - -/usr/include/c++/4.2/bits/ostream_insert.h: - -/usr/include/c++/4.2/bits/stl_function.h: - -/usr/include/c++/4.2/bits/basic_string.h: - -/usr/include/c++/4.2/algorithm: - -/usr/include/c++/4.2/bits/stl_algo.h: - -/usr/include/c++/4.2/bits/stl_heap.h: - -/usr/include/c++/4.2/bits/stl_tempbuf.h: - -/usr/include/c++/4.2/bits/basic_string.tcc: - -/usr/include/c++/4.2/streambuf: - -/usr/include/c++/4.2/bits/streambuf.tcc: - -/usr/include/c++/4.2/bits/basic_ios.h: - -/usr/include/c++/4.2/bits/streambuf_iterator.h: - -/usr/include/c++/4.2/bits/locale_facets.h: - -/usr/include/c++/4.2/cwctype: - -/usr/include/wctype.h: - -/usr/include/c++/4.2/i486-linux-gnu/bits/ctype_base.h: - -/usr/include/c++/4.2/i486-linux-gnu/bits/ctype_inline.h: - -/usr/include/c++/4.2/bits/codecvt.h: - -/usr/include/c++/4.2/i486-linux-gnu/bits/time_members.h: - -/usr/include/c++/4.2/i486-linux-gnu/bits/messages_members.h: - -/usr/include/c++/4.2/bits/basic_ios.tcc: - -/usr/include/c++/4.2/bits/ostream.tcc: - -/usr/include/c++/4.2/locale: - -/usr/include/c++/4.2/bits/locale_facets.tcc: - -/usr/include/c++/4.2/typeinfo: - -/usr/include/c++/4.2/istream: - -/usr/include/c++/4.2/bits/istream.tcc: - -/usr/include/c++/4.2/list: - -/usr/include/c++/4.2/bits/stl_list.h: - -/usr/include/c++/4.2/bits/list.tcc: - -DoxygenTranslator/src/Token.h: From 293747e8c529c635b324e38a94765ef4d611767a Mon Sep 17 00:00:00 2001 From: Cheryl Foil Date: Mon, 18 Aug 2008 05:08:01 +0000 Subject: [PATCH 017/314] Silencing of some diagnostic print statements for what method generated what javadoc git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2008-cherylfoil@10779 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Source/Modules/java.cxx | 40 +++++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/Source/Modules/java.cxx b/Source/Modules/java.cxx index 23e233071..ac8bfe13d 100644 --- a/Source/Modules/java.cxx +++ b/Source/Modules/java.cxx @@ -91,6 +91,7 @@ class JAVA:public Language { } /* DOXYGEN TO JAVADOC globals */ bool doxygen_javadoc_flag; //flag for converting found doxygen to javadoc + bool comment_creation_chatter; //flag for getting information about where comments were created in java.cxx //TODO make this bool a command line option DoxygenTranslator doxyTranslator; @@ -123,6 +124,7 @@ public: global_variable_flag(false), old_variable_names(false), member_func_flag(false), + comment_creation_chatter(true), imclass_name(NULL), module_class_name(NULL), imclass_class_code(NULL), @@ -507,8 +509,8 @@ public: if (doxygen_javadoc_flag){ if (Getattr(n,"DoxygenComment")){ - Printf(f_module, "/* This was generated from top() */"); - Printf(f_module, doxyTranslator.convert(Char((String *)Getattr(n,"DoxygenComment")),"JAVADOC")); + if(comment_creation_chatter) Printf(f_module, "/* This was generated from top() */"); + Printf(f_module, doxyTranslator.convert(Char(Getattr(n,"DoxygenComment")),"JAVADOC")); } } if (Len(module_class_modifiers) > 0) @@ -1231,9 +1233,9 @@ public: //translate and write javadoc comment if flagged if (doxygen_javadoc_flag){ if (Getattr(n,"DoxygenComment")){ - Printv(proxy_class_constants_code, "/* This was generated from enumvalueDeclaration */", NIL ); - - Printv(proxy_class_constants_code, doxyTranslator.convert(Char((const String *)Getattr(n,"DoxygenComment")),"JAVADOC"), NIL); + if(comment_creation_chatter) Printv(proxy_class_constants_code, "/* This was generated from enumvalueDeclaration */", NIL ); + Printv(proxy_class_constants_code, + doxyTranslator.convert(Char(Getattr(n,"DoxygenComment")),"JAVADOC"), NIL); } } @@ -1302,8 +1304,8 @@ public: //translate and write javadoc comment if flagged if (doxygen_javadoc_flag){ if (Getattr(n,"DoxygenComment")){ - Printf(enum_code, "/* This was generated from enumvalueDeclaration() */" ); - Printf(enum_code, doxyTranslator.convert(Char((String *)Getattr(n,"DoxygenComment")),"JAVADOC")); + if(comment_creation_chatter) Printf(enum_code, "/* This was generated from enumvalueDeclaration() */" ); + Printf(enum_code, doxyTranslator.convert(Char(Getattr(n,"DoxygenComment")),"JAVADOC")); } } { @@ -1372,8 +1374,8 @@ public: virtual int doxygenComment(Node *n){ if (doxygen_javadoc_flag){ if (Getattr(n,"DoxygenComment")){ - Printv(structuralComments, "/* This was generated from doxygenComment() */\n", NIL); - Printv(structuralComments, doxyTranslator.convert(Char((String *)Getattr(n,"DoxygenComment")),"JAVADOC"), NIL); + if(comment_creation_chatter) Printv(structuralComments, "/* This was generated from doxygenComment() */\n", NIL); + Printv(structuralComments, doxyTranslator.convert(Char(Getattr(n,"DoxygenComment")),"JAVADOC"), NIL); } } return SWIG_OK; @@ -1400,8 +1402,8 @@ public: //translate and write javadoc comment if flagged if (doxygen_javadoc_flag){ if (Getattr(n,"DoxygenComment")){ - Printf(constants_code, "/* This was generated from enumvalueDeclaration */\n"); - Printf(constants_code, doxyTranslator.convert(Char((String *)Getattr(n,"DoxygenComment")),"JAVADOC")); + if(comment_creation_chatter) Printf(constants_code, "/* This was generated from enumvalueDeclaration */\n"); + Printf(constants_code, doxyTranslator.convert(Char(Getattr(n,"DoxygenComment")),"JAVADOC")); } } @@ -1669,8 +1671,8 @@ public: //translate and write javadoc comment if flagged if (doxygen_javadoc_flag){ if (Getattr(n,"DoxygenComment")){ - Printv(proxy_class_def, "/* This was generated from emitProxyClassDefAndCPPCasts() */\n", NIL ); - Printv(proxy_class_def, doxyTranslator.convert(Char((String *)Getattr(n,"DoxygenComment")),"JAVADOC"), NIL); + if(comment_creation_chatter) Printv(proxy_class_def, "/* This was generated from emitProxyClassDefAndCPPCasts() */\n", NIL ); + Printv(proxy_class_def, doxyTranslator.convert(Char(Getattr(n,"DoxygenComment")),"JAVADOC"), NIL); } } @@ -2010,8 +2012,8 @@ public: //translate and write javadoc comment if flagged if (doxygen_javadoc_flag){ if (Getattr(n,"DoxygenComment")){ - Printf(function_code, "/* This was generated from proxyclassfunctionhandler */"); - Printf(function_code, doxyTranslator.convert(Char((String *)Getattr(n,"DoxygenComment")),"JAVADOC")); + if(comment_creation_chatter) Printf(function_code, "/* This was generated from proxyclassfunctionhandler */"); + Printf(function_code, doxyTranslator.convert(Char(Getattr(n,"DoxygenComment")),"JAVADOC")); } } @@ -2240,8 +2242,8 @@ public: //translate and write javadoc comment if flagged if (doxygen_javadoc_flag){ if (Getattr(n,"DoxygenComment")){ - Printf(function_code, "/* This was generated from constructionhandler */\n" ); - Printf(function_code, doxyTranslator.convert(Char((String *)Getattr(n,"DoxygenComment")),"JAVADOC")); + if(comment_creation_chatter) Printf(function_code, "/* This was generated from constructionhandler */\n" ); + Printf(function_code, doxyTranslator.convert(Char(Getattr(n,"DoxygenComment")),"JAVADOC")); } } @@ -2509,8 +2511,8 @@ public: //translate and write javadoc comment if flagged if (doxygen_javadoc_flag){ if (Getattr(n,"DoxygenComment")){ - Printf(function_code, "/* This was generated from moduleClassFunctionHandler() */\n" ); - Printf(function_code, doxyTranslator.convert(Char((String *)Getattr(n,"DoxygenComment")),"JAVADOC")); + if(comment_creation_chatter) Printf(function_code, "/* This was generated from moduleClassFunctionHandler() */\n" ); + Printf(function_code, doxyTranslator.convert(Char(Getattr(n,"DoxygenComment")),"JAVADOC")); } } From d08245c7f997646795cf1e1f85072140230ae79d Mon Sep 17 00:00:00 2001 From: Cheryl Foil Date: Mon, 18 Aug 2008 07:23:41 +0000 Subject: [PATCH 018/314] memory leak fix for a test method git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2008-cherylfoil@10781 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Source/DoxygenTranslator/src/DoxygenTranslator.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/Source/DoxygenTranslator/src/DoxygenTranslator.cpp b/Source/DoxygenTranslator/src/DoxygenTranslator.cpp index a1789eb74..77090573a 100644 --- a/Source/DoxygenTranslator/src/DoxygenTranslator.cpp +++ b/Source/DoxygenTranslator/src/DoxygenTranslator.cpp @@ -1,17 +1,11 @@ - - #include "DoxygenParser.h" #include "DoxygenTranslator.h" #include #include -#include #include -#include #include "DoxygenEntity.h" -#include "TokenList.h" #include "JavaDocConverter.h" - DoxygenParser doxyParse; JavaDocConverter jDC; @@ -65,7 +59,10 @@ int testCommands(){ cout << "---ORIGINAL DOXYGEN--- " << endl << exampleArray[i] << endl; char *nonConstString = (char *)malloc(exampleArray[i].length()+1); strcpy(nonConstString, exampleArray[i].c_str()); - dT.convert(nonConstString, "JAVADOC"); + char * result = dT.convert(nonConstString, "JAVADOC"); + free(nonConstString); + free(result); } return 1; } + From 4af0c994992b29e264eb3f2cddd486872112fc92 Mon Sep 17 00:00:00 2001 From: Cheryl Foil Date: Mon, 18 Aug 2008 07:34:27 +0000 Subject: [PATCH 019/314] Memory usage fix in java.cxx git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2008-cherylfoil@10782 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Source/Modules/java.cxx | 41 ++++++++++++++++++++++++++++++----------- 1 file changed, 30 insertions(+), 11 deletions(-) diff --git a/Source/Modules/java.cxx b/Source/Modules/java.cxx index ac8bfe13d..025cfc1c8 100644 --- a/Source/Modules/java.cxx +++ b/Source/Modules/java.cxx @@ -124,7 +124,7 @@ public: global_variable_flag(false), old_variable_names(false), member_func_flag(false), - comment_creation_chatter(true), + comment_creation_chatter(false), imclass_name(NULL), module_class_name(NULL), imclass_class_code(NULL), @@ -510,7 +510,9 @@ public: if (doxygen_javadoc_flag){ if (Getattr(n,"DoxygenComment")){ if(comment_creation_chatter) Printf(f_module, "/* This was generated from top() */"); - Printf(f_module, doxyTranslator.convert(Char(Getattr(n,"DoxygenComment")),"JAVADOC")); + char *convertedString = doxyTranslator.convert(Char(Getattr(n,"DoxygenComment")),"JAVADOC"); + Printf(f_module, convertedString); + free(convertedString); } } if (Len(module_class_modifiers) > 0) @@ -640,6 +642,8 @@ public: module_imports = NULL; Delete(module_class_modifiers); module_class_modifiers = NULL; + Delete(structuralComments); + structuralComments = NULL; Delete(imclass_imports); imclass_imports = NULL; Delete(imclass_cppcasts_code); @@ -1234,8 +1238,9 @@ public: if (doxygen_javadoc_flag){ if (Getattr(n,"DoxygenComment")){ if(comment_creation_chatter) Printv(proxy_class_constants_code, "/* This was generated from enumvalueDeclaration */", NIL ); - Printv(proxy_class_constants_code, - doxyTranslator.convert(Char(Getattr(n,"DoxygenComment")),"JAVADOC"), NIL); + char *convertedString = doxyTranslator.convert(Char(Getattr(n,"DoxygenComment")),"JAVADOC"); + Printv(proxy_class_constants_code, convertedString, NIL); + free(convertedString); } } @@ -1305,7 +1310,9 @@ public: if (doxygen_javadoc_flag){ if (Getattr(n,"DoxygenComment")){ if(comment_creation_chatter) Printf(enum_code, "/* This was generated from enumvalueDeclaration() */" ); - Printf(enum_code, doxyTranslator.convert(Char(Getattr(n,"DoxygenComment")),"JAVADOC")); + char *convertedString = doxyTranslator.convert(Char(Getattr(n,"DoxygenComment")),"JAVADOC"); + Printf(enum_code, convertedString); + free(convertedString); } } { @@ -1375,7 +1382,9 @@ public: if (doxygen_javadoc_flag){ if (Getattr(n,"DoxygenComment")){ if(comment_creation_chatter) Printv(structuralComments, "/* This was generated from doxygenComment() */\n", NIL); - Printv(structuralComments, doxyTranslator.convert(Char(Getattr(n,"DoxygenComment")),"JAVADOC"), NIL); + char *convertedString = doxyTranslator.convert(Char(Getattr(n,"DoxygenComment")),"JAVADOC"); + Printv(structuralComments, convertedString, NIL); + free(convertedString); } } return SWIG_OK; @@ -1403,7 +1412,9 @@ public: if (doxygen_javadoc_flag){ if (Getattr(n,"DoxygenComment")){ if(comment_creation_chatter) Printf(constants_code, "/* This was generated from enumvalueDeclaration */\n"); - Printf(constants_code, doxyTranslator.convert(Char(Getattr(n,"DoxygenComment")),"JAVADOC")); + char *convertedString = doxyTranslator.convert(Char(Getattr(n,"DoxygenComment")),"JAVADOC"); + Printf(constants_code, convertedString); + free(convertedString); } } @@ -1672,7 +1683,9 @@ public: if (doxygen_javadoc_flag){ if (Getattr(n,"DoxygenComment")){ if(comment_creation_chatter) Printv(proxy_class_def, "/* This was generated from emitProxyClassDefAndCPPCasts() */\n", NIL ); - Printv(proxy_class_def, doxyTranslator.convert(Char(Getattr(n,"DoxygenComment")),"JAVADOC"), NIL); + char *convertedString = doxyTranslator.convert(Char(Getattr(n,"DoxygenComment")),"JAVADOC"); + Printv(proxy_class_def, convertedString, NIL); + free(convertedString); } } @@ -2013,7 +2026,9 @@ public: if (doxygen_javadoc_flag){ if (Getattr(n,"DoxygenComment")){ if(comment_creation_chatter) Printf(function_code, "/* This was generated from proxyclassfunctionhandler */"); - Printf(function_code, doxyTranslator.convert(Char(Getattr(n,"DoxygenComment")),"JAVADOC")); + char *convertedString = doxyTranslator.convert(Char(Getattr(n,"DoxygenComment")),"JAVADOC"); + Printf(function_code, convertedString); + free(convertedString); } } @@ -2243,7 +2258,9 @@ public: if (doxygen_javadoc_flag){ if (Getattr(n,"DoxygenComment")){ if(comment_creation_chatter) Printf(function_code, "/* This was generated from constructionhandler */\n" ); - Printf(function_code, doxyTranslator.convert(Char(Getattr(n,"DoxygenComment")),"JAVADOC")); + char *convertedString = doxyTranslator.convert(Char(Getattr(n,"DoxygenComment")),"JAVADOC"); + Printf(function_code, convertedString); + free(convertedString); } } @@ -2512,7 +2529,9 @@ public: if (doxygen_javadoc_flag){ if (Getattr(n,"DoxygenComment")){ if(comment_creation_chatter) Printf(function_code, "/* This was generated from moduleClassFunctionHandler() */\n" ); - Printf(function_code, doxyTranslator.convert(Char(Getattr(n,"DoxygenComment")),"JAVADOC")); + char *convertedString = doxyTranslator.convert(Char(Getattr(n,"DoxygenComment")),"JAVADOC"); + Printf(function_code, convertedString); + free(convertedString); } } From d621d21617759e346653a57db28c83c1d9c1da71 Mon Sep 17 00:00:00 2001 From: Cheryl Foil Date: Mon, 18 Aug 2008 12:18:01 +0000 Subject: [PATCH 020/314] Documentation Page (draft) written. Not yet added to table of contents. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2008-cherylfoil@10783 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Doc/Manual/DoxygenTranslation.html | 257 +++++++++++++++++++++++++++++ Doc/Manual/chapters | 2 +- 2 files changed, 258 insertions(+), 1 deletion(-) create mode 100644 Doc/Manual/DoxygenTranslation.html diff --git a/Doc/Manual/DoxygenTranslation.html b/Doc/Manual/DoxygenTranslation.html new file mode 100644 index 000000000..e3797b56f --- /dev/null +++ b/Doc/Manual/DoxygenTranslation.html @@ -0,0 +1,257 @@ + + + +SWIG and Doxygen Translation + + + +

SWIG and Doxgeyn Translation

+ + + + +

+This chapter describes SWIG's support for translating Doxygen comments found in interface and header files into a target language's normal documentation language. Currently only JavaDoc is supported. +

+ +

Doxygen Translation Overview

+ +

+The Doxygen Translation Module of SWIG is an ongoing effort from a Google Summer of Code proposal from Summer 2008. It adds an extra layer of functionality to SWIG, allowing automated translation of Doxygen formatted comments from interface files into a documentation language more suited for the target language. Currently this module only translates into JavaDoc for the SWIG Java Module, but other extensions are to be added in time. +

+ +

+Questions about running SWIG are best answered in the SWIG Basics chapter as well as the target language modules. (For now, only Java). The behaviour of this functionality is wildly unpredictable if the interface file is not proper to begin with! +

+ +

Preparations

+ + +

+To make use of the comment translation system, your documentation comments must be in properly formatted Doxygen. They can be present in your main interface file or any header file that it imports. It is advised that you are certain your comments compile properly with Doxygen before you try to translate them. Doxygen itself is a deeper tool and can provide you better feedback for correct any syntax errors that may be present. Please look at Doxygen's Documenting the code for proper specificatons for comment format. +

+ +
+/*! This is describing class Shape
+ \author Bob
+ */
+
+class Shape {
+
+ +

+Because this functionality is currently only extended to java, you must be able to run SWIG's Java Module in order to make use of this tool.

+

Enabling Doxygen Translation

+ + +

+NOT YET ADDED (current development branch has this feature automatically enabled). +

+ +

Additional Commandline Options

+ +

+ALSO TO BE ADDED (JavaDoc Autobrief?) +

+ +

Doxygen To JavaDoc

+ + +

+If translation is enabled, JavaDoc formatted comments should be automatically placed in the correct locations in the resulting module and proxy files.

+ +

Basic Example

+ +

Here is an example segment from an included header file

+
+/*! This is describing class Shape
+ \author Bob
+ */
+
+class Shape {
+public:
+  Shape() {
+    nshapes++;
+  }
+  virtual ~Shape() {
+    nshapes--;
+  };
+  double  x, y; /*!< Important Variables */
+  void    move(double dx, double dy); /*!< Moves the Shape */
+  virtual double area(void) = 0; /*!< \return the area */
+  virtual double perimeter(void) = 0; /*!< \return the perimeter */
+  static  int nshapes;
+};
+
+ +

Simply running SWIG should result in the following code being present in Shapes.java

+ +
+
+/**
+ * This is describing class Shape  
+ * 
+ * @author	Bob  
+ */
+
+public class Shape {
+
+...
+
+/**
+ * Important things  
+ * 
+ */
+  public void setX(double value) {
+    exampleJNI.Shape_x_set(swigCPtr, this, value);
+  }
+
+...
+
+/**
+ * @return	the area  
+ */
+  public double area() {
+    return exampleJNI.Shape_area(swigCPtr, this);
+  }
+
+/**
+ * @return	the perimeter  
+ */
+  public double perimeter() {
+    return exampleJNI.Shape_perimeter(swigCPtr, this);
+  }
+
+
+ + + +

+The code Java-wise should be identical to what would have been generated without this feature enabled. When the Doxygen Translator Module encounters a comment it finds nothing useful in or cannot parse, it should not effect the functionality of the SWIG generated code.

+ + +

JavaDoc Tags

+ + +

+Doxygen has a wealth of tags such as @latexonly that have no equivalent in JavaDoc. As a result several tags that have no translation (or particular use, such as some linking and section tags) are supressed. If you are interested in more if the specifics of JavaDoc, please visit How to Write Doc Comments for the Javadoc Tool.

+Doxygen and JavaDoc Equivalent Tags +
+* @param      
+* @return      
+* @exception   
+* @author      
+* @version     
+* @see         
+* @since       
+* @serial      
+* @deprecated  
+
+ +

Other Tags

+ + +

+Because there are no specific JavaDoc tag for some important information, some tags are given plain-english descriptions of their presence, such as @bug. This is a feature currently still being developed and it is likely that more information from the original Doxygen Comments will be reproduced as this module matures. +

+

Bad Behaviour

+ + +

+There are some tags that the Doxygen Translator Module currently does not expect to encounter. This includes the PHP-only Doxygen commands such as @publicsection: +

+ Completely Unsupported Tags +
+"annotatedclasslist", "classhierarchy", "define", "functionindex", 
+"header", "headerfilelist", "inherit", "l", "postheader", "private",
+ "privatesection", "protected", "protectedsection", "public", "publicsection"
+
+ +

+The parsing behaviour will be unpredictable if any of these are encountered for now. This should eventually be changed so that they are simply ignored. +

+

+In general parsing errors should not interfere with the operation of SWIG itself. Blank comments or lack of comments could be indication of either a parsing error or a lack of meaningful tags in a specific blob of doxygen. +

+ + +

Further Details

+ + +

+TO BE ADDED. +

+ + +

Developer Information

+ + +

+Currently a good deal of this Module still needs some reworking, particularly on the side of the parser and JavaDoc producer.

+ +

Module Design

+ + +

+If this functionality is turned on, SWIG places all comments found into the SWIG parse tree. Nodes contain an additional attribute called DoxygenComment when a comment is present. Individual nodes containing Doxygen with Structural Indicators, such as @file, as their first command, are also present in the parse tree. These indivudal "blobs" of Doxygen such as :

+
+/*! This is describing function Foo
+ \param x some random variable
+ \author Bob
+ \return Foo
+ */
+
+ +

+are passed on individually to the DoxygenTranslator Module. This module builds it's own private parse tree and hands it, similar to SWIG itself, to a seperate class to translate into the target documentation language. For example, JavaDocConverter is the JavaDoc module class. +

+ +

Extending to Other Languages

+ + +

+In general, extension to another language requires a fairly deep understanding of the target language module- such as Modules/python.cxx for python. Searching for "doxygen" in the java.cxx module can give you a good idea of the process for placing in documentation comments into the correct areas. The basic gist is that anywhere a comment may reside on a node, there needs to be a catch for it in front of where that function, class, or other object is written out to a target language file. The other half of extension is building a target documentation language comment generator that handles 1 blob at a time. However, this is relatively simple- nowhere near as complex as the wrapper generating modules in SWIG. See DoxygenTranslator/JavaDocConverter.cpp for a good example. The target language module hands DoxygenTranslator the blob to translate, and receives back a translated text. +

+ What is given to Doxygen Translator +
+/*! This is describing function Foo
+ \param x some random variable
+ \author Bob
+ \return Foo
+ */
+
+ What is received back by java.cxx +
+/** This is describing function Foo
+ *
+ * @param x some random variable
+ * @author Bob
+ * @return Foo
+ */
+
+

Development of the comment translator itself is simplified by the fact that the DoxygenTranslator module can easily include a main in DoxygenTranslator and thus be developed, compiled, and tested independantly of SWIG.

+ + diff --git a/Doc/Manual/chapters b/Doc/Manual/chapters index 55a0aec13..2e5a16364 100644 --- a/Doc/Manual/chapters +++ b/Doc/Manual/chapters @@ -32,4 +32,4 @@ Ruby.html Tcl.html R.html Extending.html - +DoxygenTranslation.html From 719abc61cc26d208e5831043500b3d70014d282e Mon Sep 17 00:00:00 2001 From: Cheryl Foil Date: Mon, 18 Aug 2008 16:08:51 +0000 Subject: [PATCH 021/314] parsing fixes, helped behaviour of normal text descriptions in comments git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2008-cherylfoil@10788 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Examples/doxygencomments/java/class/example.h | 22 +++++--- .../DoxygenTranslator/src/DoxygenParser.cpp | 21 ++++---- .../src/DoxygenTranslator.cpp | 52 +++++++++++++------ .../src/JavaDocConverter.cpp | 43 ++++++++++++--- .../DoxygenTranslator/src/JavaDocConverter.h | 1 - Source/Modules/java.cxx | 6 +-- 6 files changed, 100 insertions(+), 45 deletions(-) diff --git a/Examples/doxygencomments/java/class/example.h b/Examples/doxygencomments/java/class/example.h index 7e3e7d540..ce9af23d3 100644 --- a/Examples/doxygencomments/java/class/example.h +++ b/Examples/doxygencomments/java/class/example.h @@ -1,8 +1,10 @@ -/** \file example.h +/*! \file example.h comments on example.h */ /*! This is describing class Shape \author Bob + \exception some sort of exception + \see OtherShapes() */ class Shape { @@ -13,11 +15,12 @@ public: virtual ~Shape() { nshapes--; }; - double x, y; /*!< Important things */ + double x, y; /*!< Important variables */ void move(double dx, double dy); - virtual double area(void) = 0; /*!< \return the area */ - virtual double perimeter(void) = 0; /*!< \return the perimeter */ - static int nshapes; + virtual double area(void) = 0; /*!< \return the area \exception exception description */ + virtual double perimeter(void) = 0; /*!< \exception exception description + \return the perimeter */ + static int nshapes; /*!< Details about nshapes. */ }; /*! This is describing class Circle */ class Circle : public Shape { @@ -25,8 +28,9 @@ private: double radius; public: Circle(double r) : radius(r) { }; - virtual double area(void); - virtual double perimeter(void); + virtual double area(void); /*!< \return the area \exception exception description */ + virtual double perimeter(void); /*!< \exception exception description + \return the perimeter */ }; /*! This is describing class square */ @@ -34,7 +38,9 @@ class Square : public Shape { private: double width; public: - Square(double w) : width(w) { }; + Square(double w) : width(w) { }; /*!< Create square + /param w the width + /exception some description */ virtual double area(void); virtual double perimeter(void); }; diff --git a/Source/DoxygenTranslator/src/DoxygenParser.cpp b/Source/DoxygenTranslator/src/DoxygenParser.cpp index 920b7c794..d953bc6d4 100644 --- a/Source/DoxygenTranslator/src/DoxygenParser.cpp +++ b/Source/DoxygenTranslator/src/DoxygenParser.cpp @@ -31,7 +31,7 @@ DoxygenParser::~DoxygenParser() } ////////////////////////////////////////// -int noisy = 1; // set this to 1 for extra chatter from the parsing stage. +int noisy = 0; // set this to 1 for extra chatter from the parsing stage. int addCommand(string currCommand, TokenList &tokList, list &aNewList); list parse(list::iterator endParsingIndex, TokenList &tokList); @@ -70,7 +70,7 @@ string commandWords[] = {"a", "b", "c", "e", "em", "p", "def", "enum", "example" string ignoredCommandWords[] = {"copydoc", "copybrief", "copydetails", "verbinclude", "htmlinclude"}; string commandLines[] = {"addindex", "fn", "name", "line", "var", "skipline", "typedef", "skip", "until", "property"}; string ignoreCommandLines[] = {"nothing at the moment"}; -string commandParagraph[] = {"return", "remarks", "since", "test", "sa", "see", "pre", "post", "details", "invariant", +string commandParagraph[] = {"partofdescription", "return", "remarks", "since", "test", "sa", "see", "pre", "post", "details", "invariant", "deprecated", "date", "note", "warning", "version", "todo", "bug", "attention", "brief", "author"}; string ignoreCommandParagraphs[] = {"nothing at the moment"}; string commandEndCommands[] = {"code", "dot", "msc", "f$", "f[", "f{environment}{", "htmlonly", "latexonly", "manonly", @@ -208,27 +208,28 @@ list::iterator getOneLine(TokenList &tokList){ list::iterator endOfLine = tokList.iteratorCopy(); while(endOfLine!= tokList.end()){ if ((* endOfLine).tokenType == END_LINE){ - endOfLine++; + //cout << "REACHED END" << endl; + //endOfLine++; return endOfLine; } + //cout << (* endOfLine).toString(); endOfLine++; } - cout << "REACHED END" << endl; + return tokList.end(); } /* Returns a properly formatted string -* up til ANY command or end of paragraph is encountered. +* up til ANY command or end of line is encountered. */ string getStringTilCommand(TokenList &tokList){ string description; if (tokList.peek().tokenType == 0) return ""; - while(tokList.peek().tokenType == PLAINSTRING || tokList.peek().tokenType == END_LINE ){ + while(tokList.peek().tokenType == PLAINSTRING){ Token currentToken = tokList.next(); if(currentToken.tokenType == PLAINSTRING) { description = description + currentToken.tokenString + " "; } - else if (tokList.peek().tokenType == END_LINE) break; } return description; } @@ -259,7 +260,7 @@ list::iterator getEndOfParagraph(TokenList &tokList){ endOfParagraph++; if ((* endOfParagraph).tokenType == END_LINE){ endOfParagraph++; - cout << "ENCOUNTERED END OF PARA" << endl; + //cout << "ENCOUNTERED END OF PARA" << endl; return endOfParagraph; } } @@ -762,14 +763,14 @@ list parseRoot(list::iterator endParsingIndex, TokenList & if (currCommand < 0 ){ if(noisy) cout << "Unidentified Command " << currToken.tokenString << endl; tokList.next(); - addCommand(string("details"), tokList, aNewList);} + addCommand(string("partofdescription"), tokList, aNewList);} //cout << "Command: " << currWord << " " << currCommand << endl; else { tokList.next(); addCommand(currToken.tokenString, tokList, aNewList); } } else if (currToken.tokenType == PLAINSTRING){ - addCommand(string("details"), tokList, aNewList); + addCommand(string("partofdescription"), tokList, aNewList); } } return aNewList; diff --git a/Source/DoxygenTranslator/src/DoxygenTranslator.cpp b/Source/DoxygenTranslator/src/DoxygenTranslator.cpp index 77090573a..d6f0ae152 100644 --- a/Source/DoxygenTranslator/src/DoxygenTranslator.cpp +++ b/Source/DoxygenTranslator/src/DoxygenTranslator.cpp @@ -36,27 +36,27 @@ char *DoxygenTranslator::convert(char* doxygenBlob, char* option){ int testCommands(){ string exampleArray[] = { - "/**\n * \n * Random Line \n * \\@ \n * Random Line After */", - "/**\n * \n * Random Line Before \n * \\b bold \n * Random Line After */", - "/**\n * \n * Random Line \n * \\copydoc bold \n * Random Line After */", - "/**\n * \n * Random Line \n * \n * \\addindex An Entire Line\n * \\addindex An Entire Line\n * Random Line After */", - "/**\n * \n * Random Line \n * \n * \\return An Entire Paragraph \n * Including This Line \n * \n * Random Line After */", - "/**\n * \n * Random Line \n * \\return An Entire Paragraph \n * Including This Line \n * \\author Shouldn't be part of return */", - "/**\n * \n * Random Line \n * \\code this should continue \n * until here \\endcode \n * Random Line After */", - "/**\n * \n * Random Line \n * \\param singleword then the rest of \n * the description \n * \n * Random Line After */", - "/**\n * \n * Random Line \n * \\page singleword this should go til here \n * but not this */", - "/**\n * \n * Random Line \n * \\page singleword this should go til here \n * but not this */", - "/**\n * \n * Random Line \n * \\category singleword \n * but not this */", - "/**\n * \n * Random Line \n * \\category singleword oneword \n * but not this */", - "/**\n * \n * Random Line \n * \\category singleword oneword twoword \n * but not this */", - "/**\n * \n * Random Line \n * \\dir singleword \n * but not this */", - "/**\n * \n * Random Line \n * \\dir \n * but not this */", - "/**\n * \n * Random Line \n * \\fakecommand details \n * but not this */" + "/**\n * Random Line \n * \\@ \n * Random Line After */", + "/**\n * Random Line Before \n * \n * \\b bold \n * Random Line After */", + "/**\n * Random Line \n * \n *\\copydoc bold \n * Random Line After */", + "/**\n * Random Line \n * \n * \\addindex An Entire Line\n * \\addindex An Entire Line\n * Random Line After */", + "/**\n * Random Line \n * \n * \\return An Entire Paragraph \n * Including This Line \n * \n * Random Line After */", + "/**\n * Random Line \n * \n * \\return An Entire Paragraph \n * Including This Line \n * \\author Shouldn't be part of return */", + "/**\n * Random Line \n * \n * \\code this should continue \n * until here \\endcode \n * Random Line After */", + "/**\n * Random Line \n * \n * \\param singleword then the rest of \n * the description \n * \n * Random Line After */", + "/**\n * Random Line \n * \n * \\page singleword this should go til here \n * but not this */", + "/**\n * Random Line \n * \n * \\page singleword this should go til here \n * but not this */", + "/**\n * Random Line \n * \n * \\category singleword \n * but not this */", + "/**\n * Random Line \n * \n * \\category singleword oneword \n * but not this */", + "/**\n * Random Line \n * \n * \\category singleword oneword twoword \n * but not this */", + "/**\n * Random Line \n * \n * \\dir singleword \n * but not this */", + "/**\n * Random Line \n * \n * \\dir \n * but not this */", + "/**\n * Random Line \n * \n * \\fakecommand details \n * but not this */" }; //string exampleArrayUniques = {}; DoxygenTranslator dT = DoxygenTranslator(); for (int i = 0; i < 16; i ++ ){ - cout << "---ORIGINAL DOXYGEN--- " << endl << exampleArray[i] << endl; + //cout << "---ORIGINAL DOXYGEN--- " << endl << exampleArray[i] << endl; char *nonConstString = (char *)malloc(exampleArray[i].length()+1); strcpy(nonConstString, exampleArray[i].c_str()); char * result = dT.convert(nonConstString, "JAVADOC"); @@ -66,3 +66,21 @@ int testCommands(){ return 1; } +//int main(int argc, char *argv[]){ + //string doxygenString1 = "//! \\brief a brief description \n\n A normal member taking two arguments and returning an \\b integer value. This is a very long description for the simple purpose of showing off formatting. Let's make it a bit longer just to be sure. \n/*!\n \\param a an \\b integer argument.\n \\return The test results\n \\param s a constant character pointer. Let's also make this a very long description! \n \\bug this command should, for now, be totally ignored\n \\author cheryl foil\n \\sa Test(), ~Test(), testMeToo() and publicVar()\n */"; + //cout << "---ORIGINAL DOXYGEN--- " << endl << doxygenString1 << endl; + //char *nonConstString = (char *)malloc(doxygenString1.length()+1); + //strcpy(nonConstString, doxygenString1.c_str()); + //DoxygenTranslator dT = DoxygenTranslator(); + //char *result = dT.convert("/**\n * \n * Random Line \n * \n * \\name An Entire Line \n * NOT This Line \n * \n * Random Line After */", "JAVADOC"); + //result = dT.convert(nonConstString, "JAVADOC"); + //cout << "End"; + //list rootList = doxyParse.createTree(doxygenString1); + //JavaDocConverter jDC = JavaDocConverter(); + //jDC.convertToJavaDoc(rootList); + //testCommands(); + //return 1; +//} + + + diff --git a/Source/DoxygenTranslator/src/JavaDocConverter.cpp b/Source/DoxygenTranslator/src/JavaDocConverter.cpp index c1606cc77..70c3bb731 100644 --- a/Source/DoxygenTranslator/src/JavaDocConverter.cpp +++ b/Source/DoxygenTranslator/src/JavaDocConverter.cpp @@ -21,6 +21,8 @@ bool compare_DoxygenEntities(DoxygenEntity first, DoxygenEntity second){ if(second.typeOfEntity.compare("brief") == 0) return false; if(first.typeOfEntity.compare("details") == 0) return true; if(second.typeOfEntity.compare("details") == 0) return false; + if(first.typeOfEntity.compare("partofdescription") == 0) return true; + if(first.typeOfEntity.compare("partofdescription") == 0) return false; if(first.typeOfEntity.compare("plainstring") == 0) return true; if(second.typeOfEntity.compare("plainstring") == 0) return false; if(first.typeOfEntity.compare("param") == 0){ @@ -132,14 +134,41 @@ string formatCommand(string unformattedLine, int indent){ * could probably be much more efficient... */ string javaDocFormat(DoxygenEntity &doxygenEntity){ + if(doxygenEntity.typeOfEntity.compare("partofdescription") == 0){ + return doxygenEntity.data; + } if (doxygenEntity.typeOfEntity.compare("plainstring") == 0){ - return doxygenEntity.data; + return doxygenEntity.data; } else if (doxygenEntity.typeOfEntity.compare("b") == 0){ - return "\b" + doxygenEntity.data + ""; + return "" + doxygenEntity.data + ""; } else if (doxygenEntity.typeOfEntity.compare("c") == 0){ - return "\b" + doxygenEntity.data + ""; + return "" + doxygenEntity.data + ""; + } + else if (doxygenEntity.typeOfEntity.compare("@") == 0){ + return "@"; + } + else if (doxygenEntity.typeOfEntity.compare("\\") == 0){ + return "\\"; + } + else if (doxygenEntity.typeOfEntity.compare("<") == 0){ + return "<"; + } + else if (doxygenEntity.typeOfEntity.compare(">") == 0){ + return ">"; + } + else if (doxygenEntity.typeOfEntity.compare("&") == 0){ + return "&"; + } + else if (doxygenEntity.typeOfEntity.compare("#") == 0){ + return "#"; + } + else if (doxygenEntity.typeOfEntity.compare("%") == 0){ + return "%"; + } + else if (doxygenEntity.typeOfEntity.compare("~") == 0){ + return "~"; } return ""; } @@ -160,6 +189,7 @@ string translateSubtree( DoxygenEntity &doxygenEntity){ } string translateEntity(DoxygenEntity &doxyEntity){ + if(doxyEntity.typeOfEntity.compare("partofdescription")== 0) return formatCommand(string(translateSubtree(doxyEntity)), 0); if ((doxyEntity.typeOfEntity.compare("brief") == 0)||(doxyEntity.typeOfEntity.compare("details") == 0)){ return formatCommand(string(translateSubtree(doxyEntity)), 0) + "\n * ";} else if(doxyEntity.typeOfEntity.compare("plainstring")== 0 || doxyEntity.typeOfEntity.compare("deprecated")== 0 || doxyEntity.typeOfEntity.compare("brief")== 0) @@ -179,7 +209,7 @@ string translateEntity(DoxygenEntity &doxyEntity){ else if(doxyEntity.typeOfEntity.compare("sa")== 0){ return formatCommand(string("@see\t\t" + translateSubtree(doxyEntity)), 2); } - + else return formatCommand(javaDocFormat(doxyEntity), 0 ); return ""; } @@ -201,7 +231,8 @@ string JavaDocConverter:: convertToJavaDoc(list entityList){ } javaDocString += "\n */\n"; + if(printSortedTree2){ cout << "\n---RESULT IN JAVADOC---" << endl; - cout << javaDocString; + cout << javaDocString; } return javaDocString; -} +} \ No newline at end of file diff --git a/Source/DoxygenTranslator/src/JavaDocConverter.h b/Source/DoxygenTranslator/src/JavaDocConverter.h index 81122bc5f..53a270ce4 100644 --- a/Source/DoxygenTranslator/src/JavaDocConverter.h +++ b/Source/DoxygenTranslator/src/JavaDocConverter.h @@ -1,7 +1,6 @@ #include #include #include "DoxygenEntity.h" - #ifndef JAVADOCCONVERTER_H_ #define JAVADOCCONVERTER_H_ diff --git a/Source/Modules/java.cxx b/Source/Modules/java.cxx index 025cfc1c8..a21e37bf4 100644 --- a/Source/Modules/java.cxx +++ b/Source/Modules/java.cxx @@ -44,6 +44,8 @@ class JAVA:public Language { bool global_variable_flag; // Flag for when wrapping a global variable bool old_variable_names; // Flag for old style variable names in the intermediary class bool member_func_flag; // flag set when wrapping a member function + bool doxygen_javadoc_flag; //flag for converting found doxygen to javadoc + bool comment_creation_chatter; //flag for getting information about where comments were created in java.cxx String *imclass_name; // intermediary class name String *module_class_name; // module class name @@ -90,8 +92,6 @@ class JAVA:public Language { return p; } /* DOXYGEN TO JAVADOC globals */ - bool doxygen_javadoc_flag; //flag for converting found doxygen to javadoc - bool comment_creation_chatter; //flag for getting information about where comments were created in java.cxx //TODO make this bool a command line option DoxygenTranslator doxyTranslator; @@ -124,6 +124,7 @@ public: global_variable_flag(false), old_variable_names(false), member_func_flag(false), + doxygen_javadoc_flag(true), comment_creation_chatter(false), imclass_name(NULL), module_class_name(NULL), @@ -213,7 +214,6 @@ public: virtual void main(int argc, char *argv[]) { - doxygen_javadoc_flag = true; SWIG_library_directory("java"); // Look for certain command line options From ad0a3d9179a8650d145c3db0e9b1c1bdc8de79ee Mon Sep 17 00:00:00 2001 From: Cheryl Foil Date: Mon, 18 Aug 2008 18:30:21 +0000 Subject: [PATCH 022/314] Extra Examples git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2008-cherylfoil@10790 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- .../doxygencomments/java/callback/example.h | 7 +++++-- Examples/doxygencomments/java/extend/example.h | 11 +++++++++-- Examples/doxygencomments/java/native/example.i | 11 +++++++++++ .../doxygencomments/java/pointer/example.i | 10 +++++++++- .../doxygencomments/java/reference/example.i | 18 +++++++++++++++--- Examples/doxygencomments/java/simple/example.i | 6 +++++- .../doxygencomments/java/template/example.h | 11 +++++++++-- Examples/java/pointer/example.i | 2 -- Examples/java/reference/example.i | 3 --- 9 files changed, 63 insertions(+), 16 deletions(-) diff --git a/Examples/doxygencomments/java/callback/example.h b/Examples/doxygencomments/java/callback/example.h index 38ada8b84..a0c5fc4d2 100644 --- a/Examples/doxygencomments/java/callback/example.h +++ b/Examples/doxygencomments/java/callback/example.h @@ -3,9 +3,12 @@ #include #include -/** Let's document class CALLBACK! */ +/*! Let's document class CALLBACK! + /author Alfred + */ class Callback { public: + /** Information about Callback */ virtual ~Callback() { std::cout << "Callback::~Callback()" << std:: endl; } virtual void run() { std::cout << "Callback::run()" << std::endl; } }; @@ -16,7 +19,7 @@ private: Callback *_callback; public: Caller(): _callback(0) {} - ~Caller() { delCallback(); } + ~Caller() { delCallback(); }/**< Deletes Callback */ void delCallback() { delete _callback; _callback = 0; } void setCallback(Callback *cb) { delCallback(); _callback = cb; } void call() { if (_callback) _callback->run(); } diff --git a/Examples/doxygencomments/java/extend/example.h b/Examples/doxygencomments/java/extend/example.h index db49ae747..9b882fd59 100644 --- a/Examples/doxygencomments/java/extend/example.h +++ b/Examples/doxygencomments/java/extend/example.h @@ -6,12 +6,15 @@ #include #include -/**This is describiing class Employee */ +/**This is describiing class Employee + /author Bob */ class Employee { private: std::string name; public: - /** TEST */ + /** Employee + \param n name of Employee + \throws some exception */ Employee(const char* n): name(n) {} /**This is describing method getTitle */ virtual std::string getTitle() { return getPosition() + " " + getName(); } @@ -31,11 +34,15 @@ public: class EmployeeList { std::vector list; public: + /** Initialises Employee List */ EmployeeList() { list.push_back(new Employee("Bob")); list.push_back(new Employee("Jane")); list.push_back(new Manager("Ted")); } + /** Add employee + * \param p employee p + * \return void */ void addEmployee(Employee *p) { list.push_back(p); std::cout << "New employee added. Current employees are:" << std::endl; diff --git a/Examples/doxygencomments/java/native/example.i b/Examples/doxygencomments/java/native/example.i index 851b6fdc2..21bcf528c 100644 --- a/Examples/doxygencomments/java/native/example.i +++ b/Examples/doxygencomments/java/native/example.i @@ -4,11 +4,16 @@ %{ #include +/*! Structure Point */ typedef struct point { int x; int y; } Point; +/*! Point_create Description + /param x integer x + /param y some integer y + /return a point */ Point *point_create(int x, int y) { Point *p = (Point *) malloc(sizeof(Point)); @@ -18,6 +23,11 @@ Point *point_create(int x, int y) { return p; } +/*! Point_create Description + /param format the format + /param p some p + /return a character string of the point p */ + static char *point_toString(char *format, Point *p) { static char buf[80]; @@ -54,3 +64,4 @@ char *point_toString1(Point *p); extern void free(void *memblock); %native(point_toString2) char *point_toString2(Point *p); + diff --git a/Examples/doxygencomments/java/pointer/example.i b/Examples/doxygencomments/java/pointer/example.i index a8ac79499..7ac3b8cf8 100644 --- a/Examples/doxygencomments/java/pointer/example.i +++ b/Examples/doxygencomments/java/pointer/example.i @@ -7,10 +7,16 @@ extern void sub(int *, int *, int *); extern int divide(int, int, int *); %} -/* This example illustrates a couple of different techniques +/** This example illustrates a couple of different techniques for manipulating C pointers */ /* First we'll use the pointer library */ + +/*! function add + \param x some int x + \param y some int y + \param result some result + */ extern void add(int *x, int *y, int *result); %include cpointer.i %pointer_functions(int, intp); @@ -28,3 +34,5 @@ extern int divide(int n, int d, int *r); + + diff --git a/Examples/doxygencomments/java/reference/example.i b/Examples/doxygencomments/java/reference/example.i index 6daa3b1f4..8e4d05239 100644 --- a/Examples/doxygencomments/java/reference/example.i +++ b/Examples/doxygencomments/java/reference/example.i @@ -8,6 +8,12 @@ #include "example.h" %} +/*! Class vector description + \author Fred + \exception something random + \since 1.0 + \name ignoreme + \see something */ class Vector { public: Vector(double x, double y, double z); @@ -15,15 +21,18 @@ public: char *print(); }; -/* This helper function calls an overloaded operator */ +/** This helper function calls an overloaded operator */ %inline %{ Vector addv(Vector &a, Vector &b) { return a+b; } %} -/* Wrapper around an array of vectors class */ - +/*! Class Vector Array + \exception something random + \since 1.3 + \see something + \author Fred */ class VectorArray { public: VectorArray(int maxsize); @@ -44,3 +53,6 @@ public: + + + diff --git a/Examples/doxygencomments/java/simple/example.i b/Examples/doxygencomments/java/simple/example.i index 24093b9bf..c823bc8b6 100644 --- a/Examples/doxygencomments/java/simple/example.i +++ b/Examples/doxygencomments/java/simple/example.i @@ -2,6 +2,10 @@ %module example %inline %{ +/*! Function foo + \param x int x + \param y int y + \return the gcd */ extern int gcd(int x, int y); -extern double Foo; +extern double Foo; /*!< description of double foo %} diff --git a/Examples/doxygencomments/java/template/example.h b/Examples/doxygencomments/java/template/example.h index 7401df650..9ec711391 100644 --- a/Examples/doxygencomments/java/template/example.h +++ b/Examples/doxygencomments/java/template/example.h @@ -2,8 +2,15 @@ // Some template definitions +/*! Template class T + \author cmfoil + \sa something something */ + template T max(T a, T b) { return a>b ? a : b; } +/*! Template class Vector + \author cmfoil + \sa something something */ template class vector { T *v; int sz; @@ -17,12 +24,12 @@ template class vector { } void set(int index, T &val) { v[index] = val; - } + } /*!< Something about set */ #ifdef SWIG %extend { T getitem(int index) { return $self->get(index); - } + }/*!< Something about get item */ void setitem(int index, T val) { $self->set(index,val); } diff --git a/Examples/java/pointer/example.i b/Examples/java/pointer/example.i index a8ac79499..5b725cee6 100644 --- a/Examples/java/pointer/example.i +++ b/Examples/java/pointer/example.i @@ -26,5 +26,3 @@ extern void sub(int *INPUT, int *INPUT, int *OUTPUT); extern int divide(int n, int d, int *r); - - diff --git a/Examples/java/reference/example.i b/Examples/java/reference/example.i index 6daa3b1f4..fd80f9a94 100644 --- a/Examples/java/reference/example.i +++ b/Examples/java/reference/example.i @@ -41,6 +41,3 @@ public: } }; - - - From 6c646831c3400c74ff87affceb7be96604864566 Mon Sep 17 00:00:00 2001 From: Cheryl Foil Date: Mon, 18 Aug 2008 18:37:41 +0000 Subject: [PATCH 023/314] syntax error git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2008-cherylfoil@10791 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Examples/doxygencomments/java/simple/example.i | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Examples/doxygencomments/java/simple/example.i b/Examples/doxygencomments/java/simple/example.i index c823bc8b6..d10fe5e19 100644 --- a/Examples/doxygencomments/java/simple/example.i +++ b/Examples/doxygencomments/java/simple/example.i @@ -7,5 +7,5 @@ \param y int y \return the gcd */ extern int gcd(int x, int y); -extern double Foo; /*!< description of double foo +extern double Foo; /*!< description of double foo */ %} From 52dd40260d3925d50b9cd672da3d23de38b3792b Mon Sep 17 00:00:00 2001 From: Cheryl Foil Date: Mon, 18 Aug 2008 18:49:13 +0000 Subject: [PATCH 024/314] One more example, for variables git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2008-cherylfoil@10792 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- .../doxygencomments/java/variables/example.h | 2 +- .../doxygencomments/java/variables/example.i | 44 +++++++++++-------- 2 files changed, 27 insertions(+), 19 deletions(-) diff --git a/Examples/doxygencomments/java/variables/example.h b/Examples/doxygencomments/java/variables/example.h index 0f7e89594..2265a45f3 100644 --- a/Examples/doxygencomments/java/variables/example.h +++ b/Examples/doxygencomments/java/variables/example.h @@ -2,5 +2,5 @@ typedef struct { int x,y; -} Point; +} Point; /*!< Description of struct Point */ diff --git a/Examples/doxygencomments/java/variables/example.i b/Examples/doxygencomments/java/variables/example.i index 591b871ed..b9794f0cf 100644 --- a/Examples/doxygencomments/java/variables/example.i +++ b/Examples/doxygencomments/java/variables/example.i @@ -6,24 +6,24 @@ /* Some global variable declarations */ %inline %{ -extern int ivar; -extern short svar; -extern long lvar; -extern unsigned int uivar; -extern unsigned short usvar; -extern unsigned long ulvar; -extern signed char scvar; -extern unsigned char ucvar; -extern char cvar; -extern float fvar; -extern double dvar; -extern char *strvar; -extern const char cstrvar[]; -extern int *iptrvar; -extern char name[256]; +extern int ivar; /*!< Description of ivar */ +extern short svar; /*!< Description of svar */ +extern long lvar; /*!< Description of lvar */ +extern unsigned int uivar; /*!< Description of uivar */ +extern unsigned short usvar; /*!< Description of usvar */ +extern unsigned long ulvar; /*!< Description of ulvar */ +extern signed char scvar; /*!< Description of scvar */ +extern unsigned char ucvar; /*!< Description of ucvar */ +extern char cvar; /*!< Description of cvar */ +extern float fvar; /*!< Description of fvar */ +extern double dvar; /*!< Description of dvar */ +extern char *strvar; /*!< Description of strvar */ +extern const char cstrvar[]; /*!< Description of cstrvar */ +extern int *iptrvar; /*!< Description of iptrvar */ +extern char name[256]; /*!< Description of name */ -extern Point *ptptr; -extern Point pt; +extern Point *ptptr; /*!< Description of ptrptr */ +extern Point pt; /*!< Description of pt */ %} @@ -40,8 +40,16 @@ extern char path[256]; /* Some helper functions to make it easier to test */ %inline %{ +/*! this function prints variables + \author someone */ extern void print_vars(); -extern int *new_int(int value); +extern int *new_int(int value); /*!< Description of new_int + \param value the value + \return a new int */ +/*! Description of new_point + \param x the value x + \param y the value y + \return a new point */ extern Point *new_Point(int x, int y); extern char *Point_print(Point *p); extern void pt_print(); From 9f4726743120be21e1675c09d32c963d8b683f2f Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Mon, 8 Sep 2008 19:38:06 +0000 Subject: [PATCH 025/314] Few formatting changes and a couple of minor edits after review git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2008-cherylfoil@10817 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Doc/Manual/DoxygenTranslation.html | 164 +++++++++++++++++++---------- 1 file changed, 111 insertions(+), 53 deletions(-) diff --git a/Doc/Manual/DoxygenTranslation.html b/Doc/Manual/DoxygenTranslation.html index e3797b56f..f53917e3a 100644 --- a/Doc/Manual/DoxygenTranslation.html +++ b/Doc/Manual/DoxygenTranslation.html @@ -5,53 +5,62 @@ -

SWIG and Doxgeyn Translation

+

35 SWIG and Doxgeyn Translation

+ +

-This chapter describes SWIG's support for translating Doxygen comments found in interface and header files into a target language's normal documentation language. Currently only JavaDoc is supported. +This chapter describes SWIG's support for translating Doxygen comments found in interface and header files into a target language's normal documentation language. +Currently only JavaDoc is supported.

-

Doxygen Translation Overview

+

35.1 Doxygen Translation Overview

+

-The Doxygen Translation Module of SWIG is an ongoing effort from a Google Summer of Code proposal from Summer 2008. It adds an extra layer of functionality to SWIG, allowing automated translation of Doxygen formatted comments from interface files into a documentation language more suited for the target language. Currently this module only translates into JavaDoc for the SWIG Java Module, but other extensions are to be added in time. +The Doxygen Translation Module of SWIG is an ongoing effort from a Google Summer of Code proposal from Summer 2008. +It adds an extra layer of functionality to SWIG, allowing automated translation of Doxygen formatted comments from input files into a documentation language more suited for the target language. +Currently this module only translates into JavaDoc for the SWIG Java Module, but other extensions are to be added in time.

-Questions about running SWIG are best answered in the SWIG Basics chapter as well as the target language modules. (For now, only Java). The behaviour of this functionality is wildly unpredictable if the interface file is not proper to begin with! +Questions about running SWIG are best answered in the SWIG Basics chapter as well as the target language modules. (For now, only Java). +The behaviour of this functionality is wildly unpredictable if the interface file is not proper to begin with!

-

Preparations

+

35.2 Preparations

-To make use of the comment translation system, your documentation comments must be in properly formatted Doxygen. They can be present in your main interface file or any header file that it imports. It is advised that you are certain your comments compile properly with Doxygen before you try to translate them. Doxygen itself is a deeper tool and can provide you better feedback for correct any syntax errors that may be present. Please look at Doxygen's Documenting the code for proper specificatons for comment format. +To make use of the comment translation system, your documentation comments must be in properly formatted Doxygen. They can be present in your main interface file or any header file that it imports. +It is advised that you are certain your comments compile properly with Doxygen before you try to translate them. +Doxygen itself is a deeper tool and can provide you better feedback for correct any syntax errors that may be present. +Please look at Doxygen's Documenting the code for proper specificatons for comment format.

@@ -63,29 +72,35 @@ class Shape {
 

-Because this functionality is currently only extended to java, you must be able to run SWIG's Java Module in order to make use of this tool.

-

Enabling Doxygen Translation

+Because this functionality is currently only extended to Java, you must be able to run SWIG's Java Module in order to make use of this tool. +

+

35.2.1 Enabling Doxygen Translation

NOT YET ADDED (current development branch has this feature automatically enabled).

-

Additional Commandline Options

+

35.2.2 Additional Commandline Options

+

ALSO TO BE ADDED (JavaDoc Autobrief?)

-

Doxygen To JavaDoc

+

35.3 Doxygen To JavaDoc

-If translation is enabled, JavaDoc formatted comments should be automatically placed in the correct locations in the resulting module and proxy files.

+If translation is enabled, JavaDoc formatted comments should be automatically placed in the correct locations in the resulting module and proxy files. +

-

Basic Example

+

35.3.1 Basic Example

-

Here is an example segment from an included header file

+ +

+Here is an example segment from an included header file +

 /*! This is describing class Shape
  \author Bob
@@ -99,15 +114,17 @@ public:
   virtual ~Shape() {
     nshapes--;
   };
-  double  x, y; /*!< Important Variables */
-  void    move(double dx, double dy); /*!< Moves the Shape */
-  virtual double area(void) = 0; /*!< \return the area */
-  virtual double perimeter(void) = 0; /*!< \return the perimeter */
+  double  x, y; /*!< Important Variables */
+  void    move(double dx, double dy); /*!< Moves the Shape */
+  virtual double area(void) = 0; /*!< \return the area */
+  virtual double perimeter(void) = 0; /*!< \return the perimeter */
   static  int nshapes;
 };
 
-

Simply running SWIG should result in the following code being present in Shapes.java

+

+Simply running SWIG should result in the following code being present in Shapes.java +

 
@@ -122,13 +139,20 @@ public class Shape {
 ...
 
 /**
- * Important things  
+ * Important Variables  
  * 
  */
   public void setX(double value) {
     exampleJNI.Shape_x_set(swigCPtr, this, value);
   }
 
+/**
+ * Important variables  
+ */
+  public double getX() {
+    return exampleJNI.Shape_x_get(swigCPtr, this);
+  }
+
 ...
 
 /**
@@ -150,15 +174,23 @@ public class Shape {
 
 
 

-The code Java-wise should be identical to what would have been generated without this feature enabled. When the Doxygen Translator Module encounters a comment it finds nothing useful in or cannot parse, it should not effect the functionality of the SWIG generated code.

+The code Java-wise should be identical to what would have been generated without this feature enabled. +When the Doxygen Translator Module encounters a comment it finds nothing useful in or cannot parse, it should not effect the functionality of the SWIG generated code. +

-

JavaDoc Tags

+

35.3.2 JavaDoc Tags

-Doxygen has a wealth of tags such as @latexonly that have no equivalent in JavaDoc. As a result several tags that have no translation (or particular use, such as some linking and section tags) are supressed. If you are interested in more if the specifics of JavaDoc, please visit How to Write Doc Comments for the Javadoc Tool.

+Doxygen has a wealth of tags such as @latexonly that have no equivalent in JavaDoc. +As a result several tags that have no translation (or particular use, such as some linking and section tags) are supressed. +If you are interested in more of the specifics of JavaDoc, please visit How to Write Doc Comments for the Javadoc Tool. +

+ +

Doxygen and JavaDoc Equivalent Tags +

 * @param      
 * @return      
@@ -171,19 +203,24 @@ Doxygen has a wealth of tags such as @latexonly that have no equivalent in JavaD
 * @deprecated  
 
-

Other Tags

+

35.3.3 Other Tags

-Because there are no specific JavaDoc tag for some important information, some tags are given plain-english descriptions of their presence, such as @bug. This is a feature currently still being developed and it is likely that more information from the original Doxygen Comments will be reproduced as this module matures. +Because there are no specific JavaDoc tags for some important information, some tags are given plain English descriptions of their presence, such as @bug. +This is a feature currently still being developed and it is likely that more information from the original Doxygen Comments will be reproduced as this module matures.

-

Bad Behaviour

+

35.3.4 Bad Behaviour

-There are some tags that the Doxygen Translator Module currently does not expect to encounter. This includes the PHP-only Doxygen commands such as @publicsection: +There are some tags that the Doxygen Translator Module currently does not expect to encounter. +This includes the PHP-only Doxygen commands such as @publicsection:

+ +

Completely Unsupported Tags +

 "annotatedclasslist", "classhierarchy", "define", "functionindex", 
 "header", "headerfilelist", "inherit", "l", "postheader", "private",
@@ -191,14 +228,16 @@ There are some tags that the Doxygen Translator Module currently does not expect
 

-The parsing behaviour will be unpredictable if any of these are encountered for now. This should eventually be changed so that they are simply ignored. +The parsing behaviour will be unpredictable if any of these are encountered for now. +This should eventually be changed so that they are simply ignored.

-In general parsing errors should not interfere with the operation of SWIG itself. Blank comments or lack of comments could be indication of either a parsing error or a lack of meaningful tags in a specific blob of doxygen. +In general parsing errors should not interfere with the operation of SWIG itself. +Blank comments or lack of comments could be an indication of either a parsing error or a lack of meaningful tags in a specific blob of doxygen.

-

Further Details

+

35.3.5 Further Details

@@ -206,17 +245,22 @@ TO BE ADDED.

-

Developer Information

+

35.4 Developer Information

-Currently a good deal of this Module still needs some reworking, particularly on the side of the parser and JavaDoc producer.

+Currently a good deal of this Module still needs some reworking, particularly on the side of the parser and JavaDoc producer. +

-

Module Design

+

35.4.1 Module Design

-If this functionality is turned on, SWIG places all comments found into the SWIG parse tree. Nodes contain an additional attribute called DoxygenComment when a comment is present. Individual nodes containing Doxygen with Structural Indicators, such as @file, as their first command, are also present in the parse tree. These indivudal "blobs" of Doxygen such as :

+If this functionality is turned on, SWIG places all comments found into the SWIG parse tree. +Nodes contain an additional attribute called DoxygenComment when a comment is present. +Individual nodes containing Doxygen with Structural Indicators, such as @file, as their first command, are also present in the parse tree. +These individual "blobs" of Doxygen such as : +

 /*! This is describing function Foo
  \param x some random variable
@@ -226,16 +270,26 @@ If this functionality is turned on, SWIG places all comments found into the SWIG
 

-are passed on individually to the DoxygenTranslator Module. This module builds it's own private parse tree and hands it, similar to SWIG itself, to a seperate class to translate into the target documentation language. For example, JavaDocConverter is the JavaDoc module class. +are passed on individually to the DoxygenTranslator Module. +This module builds its own private parse tree and hands it to a separate class for translation into the target documentation language. +For example, JavaDocConverter is the JavaDoc module class.

-

Extending to Other Languages

+

35.5 Extending to Other Languages

-In general, extension to another language requires a fairly deep understanding of the target language module- such as Modules/python.cxx for python. Searching for "doxygen" in the java.cxx module can give you a good idea of the process for placing in documentation comments into the correct areas. The basic gist is that anywhere a comment may reside on a node, there needs to be a catch for it in front of where that function, class, or other object is written out to a target language file. The other half of extension is building a target documentation language comment generator that handles 1 blob at a time. However, this is relatively simple- nowhere near as complex as the wrapper generating modules in SWIG. See DoxygenTranslator/JavaDocConverter.cpp for a good example. The target language module hands DoxygenTranslator the blob to translate, and receives back a translated text. +In general, an extension to another language requires a fairly deep understanding of the target language module, such as Modules/python.cxx for Python. +Searching for "doxygen" in the java.cxx module can give you a good idea of the process for placing documentation comments into the correct areas. +The basic gist is that anywhere a comment may reside on a node, there needs to be a catch for it in front of where that function, class, or other object is written out to a target language file. +The other half of extension is building a target documentation language comment generator that handles one blob at a time. +However, this is relatively simple and nowhere near as complex as the wrapper generating modules in SWIG. +See DoxygenTranslator/JavaDocConverter.cpp for a good example. +The target language module hands the DoxygenTranslator the blob to translate, and receives back a translated text. +

+

+ What is given to the Doxygen Translator

- What is given to Doxygen Translator
 /*! This is describing function Foo
  \param x some random variable
@@ -243,7 +297,9 @@ In general, extension to another language requires a fairly deep understanding o
  \return Foo
  */
 
+

What is received back by java.cxx +

 /** This is describing function Foo
  *
@@ -252,6 +308,8 @@ In general, extension to another language requires a fairly deep understanding o
  * @return Foo
  */
 
-

Development of the comment translator itself is simplified by the fact that the DoxygenTranslator module can easily include a main in DoxygenTranslator and thus be developed, compiled, and tested independantly of SWIG.

+

Development of the comment translator itself is simplified by the fact that the DoxygenTranslator module can easily include a main function and thus be developed, compiled, and tested independently of SWIG. +

+ From 8486cc9f4308688e590ba045f222eceafa720502 Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Mon, 8 Sep 2008 19:40:04 +0000 Subject: [PATCH 026/314] rename DoxygenTranslation.html to Doxygen.html git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2008-cherylfoil@10818 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Doc/Manual/Contents.html | 28 +++++++++++++++++++ .../{DoxygenTranslation.html => Doxygen.html} | 0 Doc/Manual/chapters | 2 +- 3 files changed, 29 insertions(+), 1 deletion(-) rename Doc/Manual/{DoxygenTranslation.html => Doxygen.html} (100%) diff --git a/Doc/Manual/Contents.html b/Doc/Manual/Contents.html index 5c7a18eaf..9d6e4e66f 100644 --- a/Doc/Manual/Contents.html +++ b/Doc/Manual/Contents.html @@ -1533,6 +1533,34 @@
+

35 SWIG and Doxgeyn Translation

+ + + + + diff --git a/Doc/Manual/DoxygenTranslation.html b/Doc/Manual/Doxygen.html similarity index 100% rename from Doc/Manual/DoxygenTranslation.html rename to Doc/Manual/Doxygen.html diff --git a/Doc/Manual/chapters b/Doc/Manual/chapters index 2e5a16364..c9df298f0 100644 --- a/Doc/Manual/chapters +++ b/Doc/Manual/chapters @@ -32,4 +32,4 @@ Ruby.html Tcl.html R.html Extending.html -DoxygenTranslation.html +Doxygen.html From 721327573bb00785ff5d96ae0872e18534fa9aa1 Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Mon, 8 Sep 2008 20:04:34 +0000 Subject: [PATCH 027/314] fix typo and main ref git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2008-cherylfoil@10823 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Doc/Manual/Doxygen.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/Manual/Doxygen.html b/Doc/Manual/Doxygen.html index f53917e3a..27fc013eb 100644 --- a/Doc/Manual/Doxygen.html +++ b/Doc/Manual/Doxygen.html @@ -5,7 +5,7 @@ -

35 SWIG and Doxgeyn Translation

+

35 SWIG and Doxygen Translation

    From 825e67b2b0e7a356c678833ae3535b17708701ee Mon Sep 17 00:00:00 2001 From: Jamie Kirkpatrick Date: Fri, 12 Sep 2008 10:51:51 +0000 Subject: [PATCH 028/314] Merged revisions 10487,10498-10499,10503-10504,10506,10508,10511,10515-10516,10518-10519,10527,10530-10531,10536-10537,10539-10552,10558-10568,10574-10580,10582,10584,10588-10589,10594,10607-10610,10616,10621,10624-10629,10633-10641,10643,10647,10649-10650,10662,10672,10676-10677,10682-10683,10714,10726-10727,10738,10743,10747,10749,10794,10801-10809,10827-10831,10834 via svnmerge from https://swig.svn.sourceforge.net/svnroot/swig/trunk ................ r10487 | wsfulton | 2008-05-21 23:15:52 +0100 (Wed, 21 May 2008) | 1 line Apply patch from Petr Viktorin to fix some recent regressions in CFFI/CLOS ................ r10498 | talby | 2008-05-26 21:09:56 +0100 (Mon, 26 May 2008) | 2 lines run test cases in the Perl set by the --with-perl5 configure option. ................ r10499 | talby | 2008-05-26 22:04:06 +0100 (Mon, 26 May 2008) | 3 lines The perl5 minherit runtime test will work better if the classes are actually built under SWIGPERL. ................ r10503 | wsfulton | 2008-05-28 10:44:37 +0100 (Wed, 28 May 2008) | 1 line Fix variable wrappers when using -proxy. Patch from Jan Jezabek ................ r10504 | bhy | 2008-05-28 18:27:48 +0100 (Wed, 28 May 2008) | 2 lines Fixed SF #1971977: typo in pycontainer.swg (related to -extranative option) ................ r10506 | wsfulton | 2008-05-29 01:45:28 +0100 (Thu, 29 May 2008) | 1 line Fix variable wrappers when using -noproxy ................ r10508 | bhy | 2008-05-30 14:53:33 +0100 (Fri, 30 May 2008) | 1 line Fixed SF #1976978, apply the macros for primitive types to std::wstring ................ r10511 | olly | 2008-05-30 17:11:27 +0100 (Fri, 30 May 2008) | 4 lines Fix typo in handling of /*@SWIG[...]*/ comments in the scanner. This just meant we were only actually looking for /*@SWI at the start of the comment, so was pretty harmless in practice. ................ r10515 | wsfulton | 2008-06-02 21:10:40 +0100 (Mon, 02 Jun 2008) | 1 line Fix samename testcase for c# and java ................ r10516 | wsfulton | 2008-06-02 21:15:39 +0100 (Mon, 02 Jun 2008) | 1 line Fix enums when using -noproxy ................ r10518 | bhy | 2008-06-07 12:20:07 +0100 (Sat, 07 Jun 2008) | 4 lines Added a test case for keyword renaming. Now it works for Python in SWIG's -c++ mode, but in C mode it doesn't work! (you can try with make keyword_rename.ctest) ................ r10519 | bhy | 2008-06-07 14:40:51 +0100 (Sat, 07 Jun 2008) | 1 line fixed keyword_rename.ctest tese case, caused by a mistake in Swig/naming.c ................ r10527 | mgossage | 2008-06-17 03:57:15 +0100 (Tue, 17 Jun 2008) | 1 line [lua] bugfix 1938142 (bool& and bool* support) ................ r10530 | wsfulton | 2008-06-19 21:02:13 +0100 (Thu, 19 Jun 2008) | 1 line Add R keyword support. Rename keywords for successful compilation of Java and C# code. More consistent keyword warnings across the different languages. ................ r10531 | wsfulton | 2008-06-19 22:15:48 +0100 (Thu, 19 Jun 2008) | 1 line add complete list of R reserved words ................ r10536 | wsfulton | 2008-06-21 12:35:33 +0100 (Sat, 21 Jun 2008) | 1 line better terminology for static types ................ r10537 | wsfulton | 2008-06-21 12:42:48 +0100 (Sat, 21 Jun 2008) | 1 line remove raise as keyword test- it conflicts with _raise in LIBCMT on windows ................ r10539 | wsfulton | 2008-06-21 16:21:29 +0100 (Sat, 21 Jun 2008) | 1 line Lua example warning removal fixes for vc++ ................ r10540 | wsfulton | 2008-06-21 16:23:02 +0100 (Sat, 21 Jun 2008) | 1 line Remove some vc++ /W4 warnings ................ r10541 | wsfulton | 2008-06-21 17:04:55 +0100 (Sat, 21 Jun 2008) | 1 line minor vc++ /W4 warning fixes ................ r10542 | wsfulton | 2008-06-21 20:07:51 +0100 (Sat, 21 Jun 2008) | 1 line 'byte' is already used in Ruby on windows, so use another keyword ................ r10543 | wsfulton | 2008-06-21 21:45:32 +0100 (Sat, 21 Jun 2008) | 1 line Fix crashing in the Ruby reject method in the STL wrappers ................ r10544 | wsfulton | 2008-06-21 21:48:28 +0100 (Sat, 21 Jun 2008) | 1 line Fix crashing in the Ruby reject method in the STL wrappers ................ r10545 | wsfulton | 2008-06-21 21:49:10 +0100 (Sat, 21 Jun 2008) | 1 line remove unnecessary variable int the char **STRING_ARRAY out typemap ................ r10546 | wsfulton | 2008-06-21 22:07:49 +0100 (Sat, 21 Jun 2008) | 1 line Fix Ruby C++ example dependencies in dsp files ................ r10547 | wsfulton | 2008-06-21 23:25:36 +0100 (Sat, 21 Jun 2008) | 1 line Fix unused parameter warnings in python when using gcc's -W -Wall options ................ r10548 | wsfulton | 2008-06-21 23:26:35 +0100 (Sat, 21 Jun 2008) | 1 line Fix virtual destructor ................ r10549 | wsfulton | 2008-06-22 00:25:20 +0100 (Sun, 22 Jun 2008) | 1 line various warning fixes ................ r10550 | wsfulton | 2008-06-22 01:09:11 +0100 (Sun, 22 Jun 2008) | 1 line Another fix for the JVM hanging on exit problem when using directors ................ r10551 | wsfulton | 2008-06-22 01:09:51 +0100 (Sun, 22 Jun 2008) | 1 line documentation sections update ................ r10552 | wsfulton | 2008-06-22 01:18:10 +0100 (Sun, 22 Jun 2008) | 1 line more docs on defining macros for the thread hanging problem ................ r10558 | wsfulton | 2008-06-22 22:30:20 +0100 (Sun, 22 Jun 2008) | 1 line fix unused parms in last commit for C code ................ r10559 | wsfulton | 2008-06-22 23:12:43 +0100 (Sun, 22 Jun 2008) | 1 line Suppress unused methods warning for VC++ ................ r10560 | wsfulton | 2008-06-23 21:26:07 +0100 (Mon, 23 Jun 2008) | 1 line fix partialcheck-test-suite and parallel make for r, chicken, tcl and php ................ r10561 | wsfulton | 2008-06-23 21:39:41 +0100 (Mon, 23 Jun 2008) | 1 line correct message display when running the partialcheck-test-suite make target ................ r10562 | wsfulton | 2008-06-23 22:14:53 +0100 (Mon, 23 Jun 2008) | 1 line fix typo ................ r10563 | olly | 2008-06-23 22:23:54 +0100 (Mon, 23 Jun 2008) | 3 lines Fix bad use of Python API (untested, since I can't even compile this code on x86-64!) ................ r10564 | olly | 2008-06-23 23:58:03 +0100 (Mon, 23 Jun 2008) | 3 lines [PHP] Fix segfault when wrapping a non-class function marked with %newobject (testcase char_strings). ................ r10565 | olly | 2008-06-24 01:27:34 +0100 (Tue, 24 Jun 2008) | 3 lines [PHP] Fix assertion failure when handling %typemap(in,numinputs=0) (testcase ignore_parameter). ................ r10566 | olly | 2008-06-24 01:33:08 +0100 (Tue, 24 Jun 2008) | 2 lines [PHP] Fix typemap_namespace.i to not try to copy a non-existent typemap. ................ r10567 | olly | 2008-06-24 01:41:07 +0100 (Tue, 24 Jun 2008) | 3 lines Clean up dead and unused code in SwigToPhpType(), and rename to GetShadowReturnType(). ................ r10568 | olly | 2008-06-24 01:42:29 +0100 (Tue, 24 Jun 2008) | 2 lines Fix cosmetic typo in string constant. ................ r10574 | wsfulton | 2008-06-24 21:10:28 +0100 (Tue, 24 Jun 2008) | 1 line zap last entry ................ r10575 | wsfulton | 2008-06-24 21:11:46 +0100 (Tue, 24 Jun 2008) | 1 line variable name changes to remove php keywords ................ r10576 | wsfulton | 2008-06-24 21:12:08 +0100 (Tue, 24 Jun 2008) | 1 line variable name hiding fix ................ r10577 | wsfulton | 2008-06-24 21:12:43 +0100 (Tue, 24 Jun 2008) | 1 line More info about numobjects added ................ r10578 | wsfulton | 2008-06-24 21:13:41 +0100 (Tue, 24 Jun 2008) | 1 line update for 1.3.36 release ................ r10579 | wsfulton | 2008-06-24 22:48:46 +0100 (Tue, 24 Jun 2008) | 1 line remove deprecated -c commandline option (runtime library generation) ................ r10580 | wsfulton | 2008-06-24 22:53:12 +0100 (Tue, 24 Jun 2008) | 1 line correct comment about deprecated option ................ r10582 | wsfulton | 2008-06-25 00:00:27 +0100 (Wed, 25 Jun 2008) | 1 line use rsync and ssh to upload releases to SourceForge as ftp no longer works ................ r10584 | wsfulton | 2008-06-25 00:24:48 +0100 (Wed, 25 Jun 2008) | 1 line correction for 1.3.36 ................ r10588 | wsfulton | 2008-06-25 01:16:04 +0100 (Wed, 25 Jun 2008) | 1 line section update ................ r10589 | wsfulton | 2008-06-25 01:16:40 +0100 (Wed, 25 Jun 2008) | 1 line bump version to 1.3.37 ................ r10594 | wsfulton | 2008-06-26 19:33:06 +0100 (Thu, 26 Jun 2008) | 1 line correct typo in first entry about %fragment ................ r10607 | wsfulton | 2008-06-29 01:19:05 +0100 (Sun, 29 Jun 2008) | 1 line fix some potential null pointer usage as reported by CoveriCoverity Prevent ................ r10608 | wsfulton | 2008-06-29 01:50:27 +0100 (Sun, 29 Jun 2008) | 1 line fix potential null pointer usage as reported by Coverity Prevent ................ r10609 | wsfulton | 2008-06-29 10:57:41 +0100 (Sun, 29 Jun 2008) | 1 line make life easier for svn status updates as everyone has different autotool versions installed - use svn:ignore on config.sub and config.guess ................ r10610 | wsfulton | 2008-06-29 11:08:14 +0100 (Sun, 29 Jun 2008) | 1 line make life easier for svn status updates as everyone has different autotool versions installed - use svn:ignore on config.sub and config.guess ................ r10616 | talby | 2008-07-01 00:41:27 +0100 (Tue, 01 Jul 2008) | 2 lines Hopefully this provides more portable values for Infinity and NaN in Perl. ................ r10621 | wsfulton | 2008-07-01 23:02:14 +0100 (Tue, 01 Jul 2008) | 1 line update old commandline option ................ r10624 | olly | 2008-07-02 04:17:46 +0100 (Wed, 02 Jul 2008) | 5 lines [Python] Import the C extension differently for Python 2.6 and later so that an implicit relative import doesn't produce a deprecation warning for 2.6 and a failure for 2.7 and later. Patch from Richard Boulton in SF#2008229. ................ r10625 | bhy | 2008-07-02 05:56:11 +0100 (Wed, 02 Jul 2008) | 1 line fix the relative import patch by try both relative and absolute import ................ r10626 | olly | 2008-07-02 06:55:18 +0100 (Wed, 02 Jul 2008) | 4 lines [PHP4] Support for PHP4 has been removed. The PHP developers are no longer making new PHP4 releases, and won't even be patching critical security issues after 2008-08-08. ................ r10627 | bhy | 2008-07-02 07:06:56 +0100 (Wed, 02 Jul 2008) | 1 line fix the previous commit -- new approach using imp module ................ r10628 | bhy | 2008-07-02 07:29:15 +0100 (Wed, 02 Jul 2008) | 1 line minor fix on relative import: close fp if exception occured during imp.find_module ................ r10629 | bhy | 2008-07-02 08:08:00 +0100 (Wed, 02 Jul 2008) | 1 line reconstruct the relative import, now the generated code looks better ................ r10633 | olly | 2008-07-03 01:09:56 +0100 (Thu, 03 Jul 2008) | 9 lines WARN_* constants are user visible, so keep existing WARN_PHP4_* for backward compatibility, but add preferred forms WARN_PHP_* and use these ourselves. Rename Lib/php4 to Lib/php, Source/Modules/php4.cxx to Source/Modules/php.cxx. Add typemaps for const reference so Examples/test-suite/apply_signed_char.i works. ................ r10634 | olly | 2008-07-03 01:12:58 +0100 (Thu, 03 Jul 2008) | 2 lines Remove file added in error. ................ r10635 | olly | 2008-07-03 01:37:38 +0100 (Thu, 03 Jul 2008) | 2 lines Rename php4*.swg to php*.swg. ................ r10636 | olly | 2008-07-03 02:13:51 +0100 (Thu, 03 Jul 2008) | 2 lines Update wrt PHP4. ................ r10637 | olly | 2008-07-03 03:32:11 +0100 (Thu, 03 Jul 2008) | 4 lines [PHP] The deprecated command line option "-phpfull" has been removed. We recommend building your extension as a dynamically loadable module. ................ r10638 | olly | 2008-07-03 03:32:41 +0100 (Thu, 03 Jul 2008) | 2 lines Fix version number ................ r10639 | olly | 2008-07-03 07:04:24 +0100 (Thu, 03 Jul 2008) | 2 lines Make t_output_helper() static. ................ r10640 | olly | 2008-07-03 07:05:34 +0100 (Thu, 03 Jul 2008) | 2 lines Make testcase li_typemaps work for PHP. ................ r10641 | olly | 2008-07-03 10:12:16 +0100 (Thu, 03 Jul 2008) | 2 lines Fix check::classname() to compare case-insensitively and not try to interpolate objects into strings. ................ r10643 | olly | 2008-07-03 23:00:01 +0100 (Thu, 03 Jul 2008) | 4 lines The operator& trick in allowexcept.i doesn't work for SWIG/PHP because the generated code takes the address of the variable in the code in the "vinit" section. So comment out the private operator& for PHP. ................ r10647 | olly | 2008-07-04 00:55:33 +0100 (Fri, 04 Jul 2008) | 2 lines [PHP] The SWIG cdata.i library module is now supported. ................ r10649 | olly | 2008-07-04 02:02:22 +0100 (Fri, 04 Jul 2008) | 4 lines [PHP] The deprecated command line option "-make" has been removed. Searches on Google codesearch suggest that nobody is using it now anyway. ................ r10650 | olly | 2008-07-04 02:22:11 +0100 (Fri, 04 Jul 2008) | 4 lines [PHP] For std_vector.i and std_map.i, rename empty() to is_empty() since "empty" is a PHP reserved word. Based of patch from Mark Klein in SF#1943417. ................ r10662 | wsfulton | 2008-07-14 22:09:23 +0100 (Mon, 14 Jul 2008) | 1 line Fix director typemaps for pointers so that NULL pointers are correctly marshalled to C#/Java null in director methods ................ r10672 | olly | 2008-07-17 02:17:08 +0100 (Thu, 17 Jul 2008) | 2 lines Fix a typo; improve wording. ................ r10676 | wsfulton | 2008-07-17 22:05:49 +0100 (Thu, 17 Jul 2008) | 1 line SF #2019156 Configuring with --without-octave or --without-alllang did not disable octave. ................ r10677 | wsfulton | 2008-07-17 22:08:22 +0100 (Thu, 17 Jul 2008) | 1 line tidy output after detecting X11 headers ................ r10682 | wsfulton | 2008-07-19 19:08:06 +0100 (Sat, 19 Jul 2008) | 1 line a bit more on pgcpp ................ r10683 | wsfulton | 2008-07-19 23:45:54 +0100 (Sat, 19 Jul 2008) | 1 line Fix building of Tcl examples/test-suite on Mac OSX ................ r10714 | olly | 2008-07-27 13:51:16 +0100 (Sun, 27 Jul 2008) | 2 lines Fix "can can" typo in docs (SF#2026756) ................ r10726 | wuzzeb | 2008-08-02 09:28:02 +0100 (Sat, 02 Aug 2008) | 1 line Commit patch 2019314 ................ r10727 | wuzzeb | 2008-08-02 09:49:43 +0100 (Sat, 02 Aug 2008) | 1 line add assert.h to fix chicken build of external runtime (ext_test testsuite) ................ r10738 | talby | 2008-08-07 07:28:13 +0100 (Thu, 07 Aug 2008) | 2 lines hoist globals to local scope where trival. ................ r10743 | talby | 2008-08-08 04:10:55 +0100 (Fri, 08 Aug 2008) | 2 lines initial steps to clean up perl5 class methods (primarily constructors). ................ r10747 | talby | 2008-08-09 05:08:26 +0100 (Sat, 09 Aug 2008) | 2 lines moves perl space constructor fixups into wrapper code. ................ r10749 | talby | 2008-08-10 00:57:55 +0100 (Sun, 10 Aug 2008) | 2 lines usage_func() fix + CHANGES.current entry to explain my past few commits. ................ r10794 | talby | 2008-08-19 08:09:29 +0100 (Tue, 19 Aug 2008) | 3 lines rollback 10737:10749, this work is better left on a branch until it is in support a significant feature enhancement. ................ r10801 | drjoe | 2008-08-31 17:07:43 +0100 (Sun, 31 Aug 2008) | 2 lines change Rf_warning to warning. Looks like a typo ................ r10802 | wsfulton | 2008-09-01 20:59:23 +0100 (Mon, 01 Sep 2008) | 1 line Fix ruby detection problem breaking configure ................ r10803 | wsfulton | 2008-09-01 21:00:28 +0100 (Mon, 01 Sep 2008) | 1 line Fix another perl global namespace pollution ................ r10804 | wsfulton | 2008-09-01 21:32:53 +0100 (Mon, 01 Sep 2008) | 1 line Fix array bounds checking in C# std::vector wrappers ................ r10805 | wsfulton | 2008-09-01 21:34:49 +0100 (Mon, 01 Sep 2008) | 1 line fix runtime problem in Ruby std_vector example ................ r10806 | wsfulton | 2008-09-01 21:42:40 +0100 (Mon, 01 Sep 2008) | 1 line Fix portability problem using /dev/null ................ r10807 | wsfulton | 2008-09-01 22:46:41 +0100 (Mon, 01 Sep 2008) | 1 line patch #2079381 submitted by Boris Smilga - constant exprs put into no-eval context in DEFCENUM ................ r10808 | wsfulton | 2008-09-02 21:56:52 +0100 (Tue, 02 Sep 2008) | 1 line Add new terminator attribute for the csin typemap for C# ................ r10809 | wsfulton | 2008-09-03 00:01:37 +0100 (Wed, 03 Sep 2008) | 1 line Fix #1988296 - Multiple module director linking issue ................ r10827 | richardb | 2008-09-10 11:08:21 +0100 (Wed, 10 Sep 2008) | 6 lines [Python] Commit patch #2089149: Director exception handling mangles returned exception. Exceptions raised by Python code in directors are now passed through to the caller without change. Also, remove the ": " prefix which used to be added to other director exceptions (eg, those due to incorrect return types). ................ r10828 | bhy | 2008-09-10 11:45:33 +0100 (Wed, 10 Sep 2008) | 3 lines Initialized merge tracking via "svnmerge" with revisions "1-10827" from https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2008-bhy ................ r10829 | bhy | 2008-09-10 12:04:09 +0100 (Wed, 10 Sep 2008) | 4 lines Removed merge tracking for "svnmerge" for https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2008-bhy (Undo the init due to user error) ................ r10830 | bhy | 2008-09-10 12:08:16 +0100 (Wed, 10 Sep 2008) | 3 lines Initialized merge tracking via "svnmerge" with revisions "1-10403" from https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2008-bhy ................ r10831 | bhy | 2008-09-10 12:51:12 +0100 (Wed, 10 Sep 2008) | 11 lines (Still trying to set right properity to get svnmerge work...) Recorded merge of revisions 10404 via svnmerge from https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2008-bhy ........ r10404 | bhy | 2008-05-01 08:35:49 +0800 (Thu, 01 May 2008) | 5 lines Start of gsoc2008-bhy branch. This is a branch for Haoyu Bai's Python 3.0 backend project. Some file already modified since a little of work already done when starting the branch. ........ ................ r10834 | bhy | 2008-09-11 18:18:07 +0100 (Thu, 11 Sep 2008) | 8 lines Merged the Python 3.0 support branch. The merging progress is not so smooth, so hope this commit won't make anything broken. This is the (incomplemete) log produced by svnmerge.py: Merged revisions 10405-10409,10420-10422,10426,10438,10445,10451,10454-10465,10467,10473-10475,10485,10488-10489,10493-10495,10497,10509-10510,10513-10514,10517,10520,10525,10528-10529,10533-10535,10554-10557,10570,10573,10593,10614,10666-10669,10673,10678,10687,10690,10704-10706,10731,10744,10750-10752,10755,10759,10770,10775-10776,10813,10819 via svnmerge from https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2008-bhy ................ git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2008-cherylfoil@10837 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- ANNOUNCE | 10 +- CHANGES | 159 +- CHANGES.current | 148 +- Doc/Manual/CSharp.html | 58 +- Doc/Manual/Contents.html | 3 +- Doc/Manual/Extending.html | 3 +- Doc/Manual/Java.html | 27 +- Doc/Manual/Php.html | 184 +- Doc/Manual/Python.html | 253 ++- Doc/Manual/SWIG.html | 16 +- Doc/Manual/SWIGPlus.html | 5 +- Doc/Manual/Sections.html | 2 +- Doc/Manual/Typemaps.html | 15 +- Doc/Manual/Warnings.html | 2 +- Examples/GIFPlot/Python/full/Makefile | 3 +- Examples/GIFPlot/Python/shadow/Makefile | 3 +- Examples/GIFPlot/Python/simple/Makefile | 3 +- Examples/Makefile.in | 77 +- Examples/guile/multimap/example.i | 4 +- Examples/guile/multivalue/example.i | 6 + Examples/lua/arrays/example.c | 2 +- Examples/lua/embed2/embed2.c | 13 +- Examples/lua/embed3/embed3.cpp | 14 +- Examples/lua/owner/example.cxx | 4 +- Examples/perl5/import/base.h | 2 +- Examples/perl5/multiple_inheritance/example.h | 23 +- Examples/php4/reference/BUILD-proxy.sh | 5 - Examples/python/callback/Makefile | 1 + Examples/python/class/Makefile | 1 + Examples/python/constants/Makefile | 1 + Examples/python/contract/Makefile | 1 + Examples/python/docstrings/Makefile | 1 + Examples/python/enum/Makefile | 1 + Examples/python/exception/Makefile | 1 + Examples/python/exceptproxy/Makefile | 1 + Examples/python/extend/Makefile | 1 + Examples/python/funcptr/Makefile | 1 + Examples/python/funcptr2/Makefile | 1 + Examples/python/functor/Makefile | 1 + Examples/python/import/Makefile | 1 + Examples/python/import_template/Makefile | 1 + Examples/python/libffi/Makefile | 1 + Examples/python/multimap/Makefile | 1 + Examples/python/multimap/example.i | 32 +- Examples/python/operator/Makefile | 1 + Examples/python/pointer/Makefile | 1 + Examples/python/reference/Makefile | 1 + Examples/python/simple/Makefile | 1 + Examples/python/smartptr/Makefile | 1 + Examples/python/std_map/Makefile | 1 + Examples/python/std_vector/Makefile | 1 + Examples/python/swigrun/Makefile | 1 + Examples/python/template/Makefile | 1 + Examples/python/varargs/Makefile | 1 + Examples/python/variables/Makefile | 1 + Examples/python/weave/Makefile | 1 + Examples/ruby/class/example.dsp | 4 +- Examples/ruby/free_function/example.cxx | 2 +- Examples/ruby/free_function/example.dsp | 4 +- Examples/ruby/import/bar.dsp | 4 +- Examples/ruby/import/base.dsp | 4 +- Examples/ruby/import/foo.dsp | 4 +- Examples/ruby/import/spam.dsp | 4 +- Examples/ruby/mark_function/example.dsp | 4 +- Examples/ruby/std_vector/runme.rb | 8 +- Examples/tcl/import/base.h | 2 +- Examples/test-suite/abstract_virtual.i | 4 +- Examples/test-suite/allowexcept.i | 14 +- Examples/test-suite/apply_signed_char.i | 2 + Examples/test-suite/bools.i | 2 + Examples/test-suite/char_strings.i | 2 +- Examples/test-suite/chicken/Makefile.in | 12 +- Examples/test-suite/common.mk | 3 + Examples/test-suite/constant_pointers.i | 6 + Examples/test-suite/contract.i | 2 +- Examples/test-suite/cpp_basic.i | 2 + Examples/test-suite/csharp/Makefile.in | 4 +- .../test-suite/csharp/char_strings_runme.cs | 2 +- .../test-suite/csharp/director_basic_runme.cs | 74 + Examples/test-suite/csharp_prepost.i | 101 +- Examples/test-suite/default_constructor.i | 4 +- Examples/test-suite/director_basic.i | 6 +- Examples/test-suite/enum_thorough.i | 2 + Examples/test-suite/evil_diamond.i | 2 +- Examples/test-suite/evil_diamond_ns.i | 2 +- Examples/test-suite/evil_diamond_prop.i | 2 +- Examples/test-suite/fvirtual.i | 4 +- Examples/test-suite/guilescm/Makefile.in | 8 +- Examples/test-suite/java/Makefile.in | 4 +- .../test-suite/java/char_strings_runme.java | 2 +- .../test-suite/java/director_basic_runme.java | 57 +- Examples/test-suite/java_typemaps_proxy.i | 2 + Examples/test-suite/keyword_rename.i | 32 + Examples/test-suite/li_cstring.i | 8 +- Examples/test-suite/li_cwstring.i | 8 +- Examples/test-suite/li_std_string.i | 2 +- Examples/test-suite/lua/li_typemaps_runme.lua | 40 + Examples/test-suite/minherit.i | 2 +- Examples/test-suite/minherit2.i | 2 +- Examples/test-suite/multiple_inheritance.i | 4 +- Examples/test-suite/name_warnings.i | 3 +- Examples/test-suite/namespace_typemap.i | 2 +- Examples/test-suite/octave/fvirtual_runme.m | 2 +- .../test-suite/octave/li_std_string_runme.m | 2 +- Examples/test-suite/operbool.i | 10 + .../test-suite/perl5/li_std_string_runme.pl | 4 +- .../test-suite/perl5/li_typemaps_runme.pl | 39 +- Examples/test-suite/perl5/run-perl-test.pl | 2 +- Examples/test-suite/php4/Makefile.in | 6 +- Examples/test-suite/php4/tests.php4 | 2 +- Examples/test-suite/pure_virtual.i | 2 +- Examples/test-suite/python/Makefile.in | 67 +- Examples/test-suite/python/README | 6 +- Examples/test-suite/python/abstractbase.i | 18 + .../test-suite/python/abstractbase_runme3.py | 8 + .../test-suite/python/cpp_namespace_runme.py | 20 +- .../python/director_classic_runme.py | 68 +- .../python/director_exception_runme.py | 50 +- Examples/test-suite/python/file_test_runme.py | 3 +- Examples/test-suite/python/fvirtual_runme.py | 2 +- Examples/test-suite/python/hugemod.pl | 8 +- .../test-suite/python/keyword_rename_runme.py | 4 + .../test-suite/python/li_std_string_runme.py | 2 +- Examples/test-suite/python/operbool_runme.py | 4 + Examples/test-suite/python/pybuf.i | 34 + Examples/test-suite/python/pybuf_benchmark.i | 31 + .../python/pybuf_benchmark_runme.py | 16 + .../python/pybuf_benchmark_runme3.py | 16 + Examples/test-suite/python/pybuf_runme3.py | 15 + .../python/template_typedef_cplx2_runme.py | 13 +- .../python/template_typedef_cplx_runme.py | 13 +- Examples/test-suite/r/Makefile.in | 4 +- .../test-suite/ruby/li_std_string_runme.rb | 2 +- Examples/test-suite/samename.i | 13 +- .../test-suite/template_inherit_abstract.i | 2 +- Examples/test-suite/template_int_const.i | 8 +- Examples/test-suite/template_typedef_rec.i | 6 +- Examples/test-suite/typemap_namespace.i | 2 +- Examples/test-suite/using_composition.i | 6 +- Examples/test-suite/using_extend.i | 2 +- Examples/test-suite/using_namespace.i | 2 +- Lib/allegrocl/allegrocl.swg | 80 +- Lib/cdata.i | 9 +- Lib/cffi/cffi.swg | 7 +- Lib/chicken/chicken.swg | 1 + Lib/chicken/chickenkw.swg | 2 +- Lib/chicken/chickenrun.swg | 1 + Lib/csharp/csharp.swg | 3 +- Lib/csharp/csharphead.swg | 4 +- Lib/csharp/csharpkw.swg | 2 +- Lib/csharp/std_vector.i | 4 +- Lib/java/director.swg | 10 +- Lib/java/java.swg | 3 +- Lib/java/javakw.swg | 2 +- Lib/java/various.i | 2 +- Lib/lua/luatypemaps.swg | 4 +- Lib/lua/typemaps.i | 21 + Lib/ocaml/ocamlkw.swg | 2 +- Lib/perl5/noembed.h | 4 + Lib/perl5/perlkw.swg | 4 +- Lib/{php4 => php}/const.i | 0 Lib/{php4 => php}/globalvar.i | 0 Lib/{php4/php4.swg => php/php.swg} | 17 +- Lib/{php4/php4init.swg => php/phpinit.swg} | 0 Lib/{php4/php4kw.swg => php/phpkw.swg} | 14 +- Lib/{php4 => php}/phppointers.i | 0 Lib/{php4/php4run.swg => php/phprun.swg} | 4 +- Lib/{php4 => php}/std_common.i | 0 Lib/{php4 => php}/std_deque.i | 0 Lib/{php4 => php}/std_map.i | 4 + Lib/{php4 => php}/std_pair.i | 0 Lib/{php4 => php}/std_string.i | 0 Lib/{php4 => php}/std_vector.i | 2 + Lib/{php4 => php}/stl.i | 0 Lib/{php4 => php}/typemaps.i | 21 + Lib/{php4 => php}/utils.i | 4 +- Lib/pike/pikekw.swg | 2 +- Lib/python/director.swg | 9 +- Lib/python/file.i | 4 +- Lib/python/pyabc.i | 10 + Lib/python/pyapi.swg | 14 + Lib/python/pybuffer.i | 107 ++ Lib/python/pycontainer.swg | 65 +- Lib/python/pyerrors.swg | 6 +- Lib/python/pyhead.swg | 44 + Lib/python/pyinit.swg | 68 +- Lib/python/pyiterators.swg | 14 +- Lib/python/pyopers.swg | 6 + Lib/python/pyrun.swg | 113 +- Lib/python/pystrings.swg | 20 +- Lib/python/pythonkw.swg | 4 +- Lib/python/pywstrings.swg | 2 + Lib/python/std_map.i | 4 + Lib/r/r.swg | 4 +- Lib/r/rkw.swg | 32 + Lib/ruby/rubycontainer.swg | 6 +- Lib/ruby/rubykw.swg | 2 +- Lib/swiglabels.swg | 6 + Lib/typemaps/primtypes.swg | 1 + README | 9 +- Source/CParse/cscanner.c | 52 +- Source/CParse/parser.y | 37 +- Source/CParse/templ.c | 27 +- Source/DOH/hash.c | 31 +- Source/Include/swigwarn.h | 13 +- Source/Makefile.am | 2 +- Source/Modules/allegrocl.cxx | 61 +- Source/Modules/cffi.cxx | 6 +- Source/Modules/chicken.cxx | 13 +- Source/Modules/csharp.cxx | 92 +- Source/Modules/guile.cxx | 2 +- Source/Modules/java.cxx | 35 +- Source/Modules/lang.cxx | 61 +- Source/Modules/lua.cxx | 4 - Source/Modules/main.cxx | 10 +- Source/Modules/modula3.cxx | 4 +- Source/Modules/ocaml.cxx | 82 +- Source/Modules/{php4.cxx => php.cxx} | 944 ++-------- Source/Modules/python.cxx | 527 ++++-- Source/Modules/r.cxx | 17 +- Source/Modules/ruby.cxx | 10 +- Source/Modules/swigmain.cxx | 4 +- Source/Modules/uffi.cxx | 11 +- Source/Preprocessor/cpp.c | 5 +- Source/Swig/cwrap.c | 3 +- Source/Swig/include.c | 3 +- Source/Swig/misc.c | 23 +- Source/Swig/naming.c | 6 +- Source/Swig/scanner.c | 4 +- Source/Swig/typeobj.c | 3 +- Source/Swig/typesys.c | 17 +- TODO | 2 +- Tools/WAD/Python/type.c | 2 +- Tools/config/config.guess | 1516 --------------- Tools/config/config.sub | 1626 ----------------- Tools/mkrelease.py | 8 +- configure.in | 145 +- 237 files changed, 3218 insertions(+), 5059 deletions(-) delete mode 100755 Examples/php4/reference/BUILD-proxy.sh create mode 100644 Examples/test-suite/csharp/director_basic_runme.cs create mode 100644 Examples/test-suite/keyword_rename.i create mode 100644 Examples/test-suite/lua/li_typemaps_runme.lua create mode 100644 Examples/test-suite/operbool.i create mode 100644 Examples/test-suite/python/abstractbase.i create mode 100644 Examples/test-suite/python/abstractbase_runme3.py create mode 100644 Examples/test-suite/python/keyword_rename_runme.py create mode 100644 Examples/test-suite/python/operbool_runme.py create mode 100644 Examples/test-suite/python/pybuf.i create mode 100644 Examples/test-suite/python/pybuf_benchmark.i create mode 100644 Examples/test-suite/python/pybuf_benchmark_runme.py create mode 100644 Examples/test-suite/python/pybuf_benchmark_runme3.py create mode 100644 Examples/test-suite/python/pybuf_runme3.py rename Lib/{php4 => php}/const.i (100%) rename Lib/{php4 => php}/globalvar.i (100%) rename Lib/{php4/php4.swg => php/php.swg} (96%) rename Lib/{php4/php4init.swg => php/phpinit.swg} (100%) rename Lib/{php4/php4kw.swg => php/phpkw.swg} (93%) rename Lib/{php4 => php}/phppointers.i (100%) rename Lib/{php4/php4run.swg => php/phprun.swg} (99%) rename Lib/{php4 => php}/std_common.i (100%) rename Lib/{php4 => php}/std_deque.i (100%) rename Lib/{php4 => php}/std_map.i (97%) rename Lib/{php4 => php}/std_pair.i (100%) rename Lib/{php4 => php}/std_string.i (100%) rename Lib/{php4 => php}/std_vector.i (98%) rename Lib/{php4 => php}/stl.i (100%) rename Lib/{php4 => php}/typemaps.i (85%) rename Lib/{php4 => php}/utils.i (96%) create mode 100644 Lib/python/pyabc.i create mode 100644 Lib/python/pybuffer.i create mode 100644 Lib/r/rkw.swg rename Source/Modules/{php4.cxx => php.cxx} (64%) delete mode 100755 Tools/config/config.guess delete mode 100755 Tools/config/config.sub diff --git a/ANNOUNCE b/ANNOUNCE index 0fb688344..7c0e95e3f 100644 --- a/ANNOUNCE +++ b/ANNOUNCE @@ -1,10 +1,10 @@ -*** ANNOUNCE: SWIG 1.3.35 (7 April 2008) *** +*** ANNOUNCE: SWIG 1.3.36 (24 June 2008) *** http://www.swig.org -We're pleased to announce SWIG-1.3.35, the latest installment in the -SWIG development effort. SWIG-1.3.35 includes a number of bug fixes +We're pleased to announce SWIG-1.3.36, the latest installment in the +SWIG development effort. SWIG-1.3.36 includes a number of bug fixes and large number of enhancements throughout. What is SWIG? @@ -24,11 +24,11 @@ Availability: ------------- The release is available for download on Sourceforge at - http://prdownloads.sourceforge.net/swig/swig-1.3.35.tar.gz + http://prdownloads.sourceforge.net/swig/swig-1.3.36.tar.gz A Windows version is also available at - http://prdownloads.sourceforge.net/swig/swigwin-1.3.35.zip + http://prdownloads.sourceforge.net/swig/swigwin-1.3.36.zip Release numbers --------------- diff --git a/CHANGES b/CHANGES index fc3018a1d..782849c6f 100644 --- a/CHANGES +++ b/CHANGES @@ -2,6 +2,162 @@ SWIG (Simplified Wrapper and Interface Generator) See CHANGES.current for current version. +Version 1.3.36 (24 June 2008) +============================= + +06/24/2008: wsfulton + Remove deprecated -c commandline option (runtime library generation). + +06/24/2008: olly + [PHP] Fix assertion failure when handling %typemap(in,numinputs=0) + (testcase ignore_parameter). + +06/24/2008: olly + [PHP] Fix segfault when wrapping a non-class function marked with + %newobject (testcase char_strings). + +06/22/2008: wsfulton + [Java] Add a way to use AttachCurrentThreadAsDaemon instead of AttachCurrentThread + in director code. Define the SWIG_JAVA_ATTACH_CURRENT_THREAD_AS_DAEMON macro, see + Lib/java/director.swg. + +06/21/2008: wsfulton + [Ruby] Fix crashing in the STL wrappers (reject! and delete_if methods) + +06/19/2008: wsfulton + [Java, C#] C# and Java keywords will be renamed instead of just issuing a warning + and then generating uncompileable code. Warning 314 gives the new name when a + keyword is found. + +06/19/2008: wsfulton + [R] Keyword handling added. R Keywords will be renamed as necessary. + Warning 314 gives the new name when a keyword is found. + +06/17/2008: mgossage + [Lua] Added missing support for bool& and bool*. Added runtest for li_typemaps testcase. + (Bug #1938142) + +06/07/2008: bhy + Added test case keyword_rename, then made the keyword renaming works properly + by fixing Swig_name_make() for a incomplete condition checking. + +06/02/2008: wsfulton + [Java, C#] Fix enum wrappers when using -noproxy. + +05/30/2008: bhy + Added std::wstring into Lib/typemaps/primtypes.swg, since it is also a primitive + type in SWIG - fixed SF #1976978. + +05/29/2008: wsfulton + [Java, C#] Fix variable wrappers when using -noproxy. + +05/29/2008: bhy + [Python] Fixed a typo of %#ifdef in Lib/python/pycontainer.swg, which is related + to -extranative SWIG option - SF #1971977. + +05/20/2008: wsfulton + New partialcheck makefile targets for partial testing of the test-suite. These + just invoke SWIG, ie no compilation and no runtime testing. It can be faster + when developing by just doing a directory diff of the files SWIG generates + against those from a previous run. Example usage from the top level directory: + + make partialcheck-test-suite + make partialcheck-java-test-suite + + This change also encompasses more flexibility in running the test-suite, eg + it is possible to prefix the command line which runs any target language test + with a tool. See the RUNTOOL, COMPILETOOL and SWIGTOOL targets in the common.mk + file and makefiles in the test-suite directory. For example it is possible to + run the runtime tests through valgrind using: + + make check RUNTOOL="valgrind --leak-check=full" + + or invoke SWIG under valgrind using: + + make check SWIGTOOL="valgrind --tool=memcheck" + +05/19/2008: drjoe + [R] Fixed define that was breaking pre-2.7. Checked in + patch from Soren Sonnenburg that creates strings in + version independent way + +05/15/2008: wsfulton + [Java] Fix variable name clash in directors - SF #1963316 reported by Tristan. + +05/14/2008: wsfulton + Add an optimisation for functions that return objects by value, reducing + the number of copies of the object that are made. Implemented using an + optional attribute in the "out" typemap called "optimal". Details in + Typemaps.html. + +05/11/2008: olly + [PHP] Check for %feature("notabstract") when generating PHP5 class + wrapper. + +05/11/2008: wsfulton + Fix SF #1943608 - $self substitution in %contract, patch submitted by + Toon Verstraelen. + +05/09/2008: olly + [PHP] Fix char * typemaps to work when applied to signed char * and + unsigned char * (uncovered by testcase apply_strings). + +05/09/2008: wsfulton + Fix wrapping of char * member variables when using allprotected mode. + Bug reported by Warren Wang. + +05/09/2008: olly + [PHP] Fix bad PHP code generated when wrapping an enum in a + namespace (uncovered by testcase arrays_scope). + +05/09/2008: olly + [PHP] SWIG now runs the PHP testsuite using PHP5, not PHP4. PHP4 + is essentially obsolete now, so we care much more about solid PHP5 + support. + +05/07/2008: wsfulton + STL fixes when using %import rather than %include and the Solaris Workshop + compiler and the Roguewave STL. + +05/07/2008: wsfulton + Fix wrapping of overloaded protected methods when using allprotected mode. + Bug reported by Warren Wang. + +05/03/2008: wsfulton + Commit patch #1956607 to add -MT support from Richard Boulton. + This patch mirrors the gcc -MT option which allows one to change the default + Makefile target being generated when generating makefiles with the -M family + of options. For example: + + $ swig -java -MM -MT overiddenname -c++ example.i + overiddenname: \ + example.i \ + example.h + +04/30/2008: mgossage + [Lua] Removed generation of _wrap_delete_XXXXX (wrappered destructor) + which was unused and causing warning with g++ -Wall. + Removed other unused warning in typemaps.i and other places. + Added Examples/lua/embed3, and run tests a few test cases. + +04/24/2008: olly + [Python] Fix generated code for IBM's C++ compiler on AIX (patch + from Goeran Uddeborg in SF#1928048). + +04/24/2008: olly + Rename BSIZE in Examples/test-suite/arrays_scope.i to BBSIZE to + avoid a clash with BSIZE defined by headers on AIX with Perl + (reported in SF#1928048). + +04/20/2008: wsfulton + Add the ability to wrap all protected members when using directors. + Previously only the virtual methods were available to the target language. + Now all protected members, (static and non-static variables, non-virtual methods + and static methods) are wrapped when using the allprotected mode. The allprotected + mode is turned on in the module declaration: + + %module(directors="1", allprotected="1") modulename + Version 1.3.35 (7 April 2008) ============================= @@ -12123,7 +12279,8 @@ Version 1.3.14 (August 12, 2002) with helper functions even if they aren't used. To fix this, a new fragment directive is available. For example: - %fragment("type_helper","header") %{ + (corrected typo in line below - 06/26/2008) + %fragment("type_header","header") %{ void some_helper_function() { ... } diff --git a/CHANGES.current b/CHANGES.current index 27e9925d2..6b552c994 100644 --- a/CHANGES.current +++ b/CHANGES.current @@ -1,106 +1,80 @@ -Version 1.3.36 (in progress) +Version 1.3.37 (in progress) ============================= -05/20/2008: wsfulton - New partialcheck makefile targets for partial testing of the test-suite. These - just invoke SWIG, ie no compilation and no runtime testing. It can be faster - when developing by just doing a directory diff of the files SWIG generates - against those from a previous run. Example usage from the top level directory: +2008-09-02: wsfulton + [Python] Commit patch #2089149: Director exception handling mangles + returned exception. Exceptions raised by Python code in directors + are now passed through to the caller without change. Also, remove + the ": " prefix which used to be added to other director exceptions + (eg, those due to incorrect return types). - make partialcheck-test-suite - make partialcheck-java-test-suite +2008-09-02: wsfulton + [Python] Commit patch #1988296 GCItem multiple module linking issue when using + directors. - This change also encompasses more flexibility in running the test-suite, eg - it is possible to prefix the command line which runs any target language test - with a tool. See the RUNTOOL, COMPILETOOL and SWIGTOOL targets in the common.mk - file and makefiles in the test-suite directory. For example it is possible to - run the runtime tests through valgrind using: +2008-09-02: wsfulton + [C#] Support for 'using' and 'fixed' blocks in the 'csin' typemap is now + possible through the use of the pre attribute and the new terminator attribute, eg - make check RUNTOOL="valgrind --leak-check=full" + %typemap(csin, + pre=" using (CDate temp$csinput = new CDate($csinput)) {", + terminator=" } // terminate temp$csinput using block", + ) const CDate & + "$csclassname.getCPtr(temp$csinput)" - or invoke SWIG under valgrind using: + See CSharp.html for more info. - make check SWIGTOOL="valgrind --tool=memcheck" +2008-09-01: wsfulton + [CFFI] Commit patch #2079381 submitted by Boris Smilga - constant exprs put into + no-eval context in DEFCENUM -05/19/2008: drjoe - [R] Fixed define that was breaking pre-2.7. Checked in - patch from Soren Sonnenburg that creates strings in - version independent way +2008-09-01: wsfulton + [C#] Correct array bounds checking in std::vector typemaps - Insert and InsertRange + methods. -05/15/2008: wsfulton - [Java] Fix variable name clash in directors - SF #1963316 reported by Tristan. +2008-08-02: wuzzeb + [Chicken,Allegro] Commit Patch 2019314 + Fixes a build error in chicken, and several build errors and other errors + in Allegro CL -05/14/2008: wsfulton - Add an optimisation for functions that return objects by value, reducing - the number of copies of the object that are made. Implemented using an - optional attribute in the "out" typemap called "optimal". Details in - Typemaps.html. +2008-07-19: wsfulton + Fix building of Tcl examples/test-suite on Mac OSX reported by Gideon Simpson. -05/11/2008: olly - [PHP] Check for %feature("notabstract") when generating PHP5 class - wrapper. +2008-07-17: wsfulton + Fix SF #2019156 Configuring with --without-octave or --without-alllang + did not disable octave. -05/11/2008: wsfulton - Fix SF #1943608 - $self substitution in %contract, patch submitted by - Toon Verstraelen. +2008-07-14: wsfultonn + [Java, C#] Fix director typemaps for pointers so that NULL pointers are correctly + marshalled to C#/Java null in director methods. -05/09/2008: olly - [PHP] Fix char * typemaps to work when applied to signed char * and - unsigned char * (uncovered by testcase apply_strings). +2008-07-04: olly + [PHP] For std_vector.i and std_map.i, rename empty() to is_empty() + since "empty" is a PHP reserved word. Based on patch from Mark Klein + in SF#1943417. -05/09/2008: wsfulton - Fix wrapping of char * member variables when using allprotected mode. - Bug reported by Warren Wang. +2008-07-04: olly + [PHP] The deprecated command line option "-make" has been removed. + Searches on Google codesearch suggest that nobody is using it now + anyway. -05/09/2008: olly - [PHP] Fix bad PHP code generated when wrapping an enum in a - namespace (uncovered by testcase arrays_scope). +2008-07-04: olly + [PHP] The SWIG cdata.i library module is now supported. -05/09/2008: olly - [PHP] SWIG now runs the PHP testsuite using PHP5, not PHP4. PHP4 - is essentially obsolete now, so we care much more about solid PHP5 - support. +2008-07-03: olly + [PHP] The deprecated command line option "-phpfull" has been + removed. We recommend building your extension as a dynamically + loadable module. -05/07/2008: wsfulton - STL fixes when using %import rather than %include and the Solaris Workshop - compiler and the Roguewave STL. +2008-07-02: olly + [PHP4] Support for PHP4 has been removed. The PHP developers are + no longer making new PHP4 releases, and won't even be providing + patches for critical security issues after 2008-08-08. -05/07/2008: wsfulton - Fix wrapping of overloaded protected methods when using allprotected mode. - Bug reported by Warren Wang. - -05/03/2008: wsfulton - Commit patch #1956607 to add -MT support from Richard Boulton. - This patch mirrors the gcc -MT option which allows one to change the default - Makefile target being generated when generating makefiles with the -M family - of options. For example: - - $ swig -java -MM -MT overiddenname -c++ example.i - overiddenname: \ - example.i \ - example.h - -04/30/2008: mgossage - [Lua] Removed generation of _wrap_delete_XXXXX (wrappered destructor) - which was unused and causing warning with g++ -Wall. - Removed other unused warning in typemaps.i and other places. - Added Examples/lua/embed3, and run tests a few test cases. - -04/24/2008: olly - [Python] Fix generated code for IBM's C++ compiler on AIX (patch - from Goeran Uddeborg in SF#1928048). - -04/24/2008: olly - Rename BSIZE in Examples/test-suite/arrays_scope.i to BBSIZE to - avoid a clash with BSIZE defined by headers on AIX with Perl - (reported in SF#1928048). - -04/20/2008: wsfulton - Add the ability to wrap all protected members when using directors. - Previously only the virtual methods were available to the target language. - Now all protected members, (static and non-static variables, non-virtual methods - and static methods) are wrapped when using the allprotected mode. The allprotected - mode is turned on in the module declaration: - - %module(directors="1", allprotected="1") modulename +2008-07-02: olly + [Python] Import the C extension differently for Python 2.6 and + later so that an implicit relative import doesn't produce a + deprecation warning for 2.6 and a failure for 2.7 and later. + Patch from Richard Boulton in SF#2008229, plus follow-up patches + from Richard and Haoyu Bai. diff --git a/Doc/Manual/CSharp.html b/Doc/Manual/CSharp.html index 97cb75409..a712f82f2 100644 --- a/Doc/Manual/CSharp.html +++ b/Doc/Manual/CSharp.html @@ -1567,6 +1567,7 @@ Let's assume the code being wrapped is as follows:
     class CDate {
     public:
    +  CDate();
       CDate(int year, int month, int day);
       int getYear();
       int getMonth();
    @@ -1649,8 +1650,8 @@ The typemaps to achieve this are shown below.
     
     %typemap(cstype) const CDate& "System.DateTime"
     %typemap(csin, 
    -         pre="    CDate temp$csinput = new CDate($csinput.Year, $csinput.Month, $csinput.Day);")
    -         const CDate &
    +         pre="    CDate temp$csinput = new CDate($csinput.Year, $csinput.Month, $csinput.Day);"
    +        ) const CDate &
              "$csclassname.getCPtr(temp$csinput)"
     
     %typemap(cstype) CDate& "out System.DateTime"
    @@ -1658,7 +1659,8 @@ The typemaps to achieve this are shown below.
              pre="    CDate temp$csinput = new CDate();", 
              post="      $csinput = new System.DateTime(temp$csinput.getYear(),"
                   " temp$csinput.getMonth(), temp$csinput.getDay(), 0, 0, 0);", 
    -         cshin="out $csinput") CDate &
    +         cshin="out $csinput"
    +        ) CDate &
              "$csclassname.getCPtr(temp$csinput)"
     
     
    @@ -1763,7 +1765,8 @@ will be possible with the following CDate * typemaps pre=" CDate temp$csinput = new CDate($csinput.Year, $csinput.Month, $csinput.Day);", post=" $csinput = new System.DateTime(temp$csinput.getYear()," " temp$csinput.getMonth(), temp$csinput.getDay(), 0, 0, 0);", - cshin="ref $csinput") CDate * + cshin="ref $csinput" + ) CDate * "$csclassname.getCPtr(temp$csinput)"
@@ -1788,6 +1791,50 @@ public class example { +

+The following typemap is the same as the previous but demonstrates how a using block can be used for the temporary variable. +The only change to the previous typemap is the introduction of the 'terminator' attribute to terminate the using block. +The subtractYears method is nearly identical to the above addYears method. +

+ +
+
+%typemap(csin,
+         pre="    using (CDate temp$csinput = new CDate($csinput.Year, $csinput.Month, $csinput.Day)) {",
+         post="      $csinput = new System.DateTime(temp$csinput.getYear(),"
+              " temp$csinput.getMonth(), temp$csinput.getDay(), 0, 0, 0);", 
+         terminator="    } // terminate temp$csinput using block",
+         cshin="ref $csinput"
+        ) CDate *
+         "$csclassname.getCPtr(temp$csinput)"
+
+void subtractYears(CDate *pDate, int years) {
+  *pDate = CDate(pDate->getYear() - years, pDate->getMonth(), pDate->getDay());
+}
+
+
+ +

+The resulting generated code shows the termination of the using block: +

+ +
+
+public class example {
+  public static void subtractYears(ref System.DateTime pDate, int years) {
+    using (CDate temppDate = new CDate(pDate.Year, pDate.Month, pDate.Day)) {
+    try {
+      examplePINVOKE.subtractYears(CDate.getCPtr(temppDate), years);
+    } finally {
+      pDate = new System.DateTime(temppDate.getYear(), temppDate.getMonth(), temppDate.getDay(), 0, 0, 0);
+    }
+    } // terminate temppDate using block
+  }
+  ...
+}
+
+
+

17.5.4 A date example demonstrating marshalling of C# properties

@@ -1827,7 +1874,8 @@ The typemap type required is thus CDate *. Given that the previous sect pre=" CDate temp$csinput = new CDate($csinput.Year, $csinput.Month, $csinput.Day);", post=" $csinput = new System.DateTime(temp$csinput.getYear()," " temp$csinput.getMonth(), temp$csinput.getDay(), 0, 0, 0);", - cshin="ref $csinput") CDate * + cshin="ref $csinput" + ) CDate * "$csclassname.getCPtr(temp$csinput)" %typemap(csvarin, excode=SWIGEXCODE2) CDate * %{ diff --git a/Doc/Manual/Contents.html b/Doc/Manual/Contents.html index 9d6e4e66f..d385fec9f 100644 --- a/Doc/Manual/Contents.html +++ b/Doc/Manual/Contents.html @@ -380,7 +380,7 @@
  • Typemaps for multiple languages
  • Optimal code generation when returning by value -
  • Multi-argument typemaps +
  • Multi-argument typemaps
  • The run-time type checker
  • Accessing protected members
  • Common customization features diff --git a/Doc/Manual/Extending.html b/Doc/Manual/Extending.html index 588912b68..5639663a1 100644 --- a/Doc/Manual/Extending.html +++ b/Doc/Manual/Extending.html @@ -448,7 +448,8 @@ of the output.

    The contents of each parse tree node consist of a collection of attribute/value pairs. Internally, the nodes are simply represented by hash tables. A display of -the entire parse-tree structure can be obtained using swig -dump_tree. +the entire parse-tree structure can be obtained using swig -debug-top <n>, where n is +the stage being processed. There are a number of other parse tree display options, for example, swig -debug-module <n> will avoid displaying system parse information and only display the parse tree pertaining to the user's module at stage n of processing. diff --git a/Doc/Manual/Java.html b/Doc/Manual/Java.html index 88963caf5..518426f5a 100644 --- a/Doc/Manual/Java.html +++ b/Doc/Manual/Java.html @@ -85,6 +85,7 @@

  • Director classes
  • Overhead and code bloat
  • Simple directors example +
  • Director threading issues
  • Accessing protected members
  • Common customization features @@ -2856,7 +2857,11 @@ and therefore there is no possibility of premature garbage collection. In practi

    The premature garbage collection prevention parameter for proxy classes is generated by default whenever proxy classes are passed by value, reference or with a pointer. -The additional parameters do impose a slight performance overhead and the parameter generation can be suppressed globally with the -nopgcpp commandline option. +The implementation for this extra parameter generation requires the "jtype" typemap to contain long and the "jstype" typemap to contain the name of a proxy class. +

    + +

    +The additional parameter does impose a slight performance overhead and the parameter generation can be suppressed globally with the -nopgcpp commandline option. More selective suppression is possible with the 'nopgcpp' attribute in the "jtype" Java typemap. The attribute is a flag and so should be set to "1" to enable the suppression, or it can be omitted or set to "0" to disable. For example: @@ -3450,6 +3455,26 @@ DirectorDerived::upcall_method() invoked. +

    20.5.5 Director threading issues

    + + +

    +Depending on your operating system and version of Java and how you are using threads, you might find the JVM hangs on exit. +There are a couple of solutions to try out. The preferred solution requires jdk-1.4 and later and uses AttachCurrentThreadAsDaemon instead of AttachCurrentThread whenever a call into the JVM is required. This can be enabled by defining the SWIG_JAVA_ATTACH_CURRENT_THREAD_AS_DAEMON macro when compiling the C++ wrapper code. For older JVMs define SWIG_JAVA_NO_DETACH_CURRENT_THREAD instead, to avoid the DetachCurrentThread call but this will result in a memory leak instead. For further details inspect the source code in the java/director.swg library file. +

    + +

    +Macros can be defined on the commandline when compiling your C++ code, or alternatively added to the C++ wrapper file as shown below: +

    + +
    +
    +%insert("runtime") %{
    +#define SWIG_JAVA_NO_DETACH_CURRENT_THREAD
    +%}
    +
    +
    +

    20.6 Accessing protected members

    diff --git a/Doc/Manual/Php.html b/Doc/Manual/Php.html index 6b654fde5..8adbc36b1 100644 --- a/Doc/Manual/Php.html +++ b/Doc/Manual/Php.html @@ -43,21 +43,24 @@ Caution: This chapter (and module!) is still under construction

    +

    +SWIG supports generating wrappers for PHP5. Support for PHP4 has been removed +as of SWIG 1.3.37. The PHP developers are no longer making new PHP4 releases, +and won't even be patching critical security issues after 2008-08-08, so it +doesn't make much sense for SWIG to continue to support PHP4 at this point. +If you need to continue to use PHP4, stick with SWIG 1.3.36. +

    +

    In this chapter, we discuss SWIG's support of PHP. The PHP module -was extensively rewritten in release 1.3.26, and although it is -significantly more functional, it still does not implement all the +was extensively rewritten in release 1.3.26, and support for generating +OO wrappers for PHP5 was added in 1.3.30. The PHP module works fairly +well, but currently does not implement all the features available in some of the other languages.

    -The examples and test cases have been developed with PHP4. Release -1.3.30 added support for generating PHP5 class wrappers for C++ -libraries. -

    - -

    -In order to use this module, you will need to have a copy of the PHP4 or PHP5 +In order to use this module, you will need to have a copy of the PHP5 include files to compile the SWIG generated files. If you installed PHP from a binary package, you may need to install a "php-dev" or "php-devel" package for these to be installed. You can find out where these files are @@ -88,7 +91,7 @@ you wish to statically link the extension into the php interpreter. The third file, example.php can be included by PHP scripts. It attempts to dynamically load the extension and contains extra php code specified -in the interface file. If wrapping C++ code for PHP5, it will +in the interface file. If wrapping C++ code with PHP classes, it will also contain PHP5 class wrappers.

    @@ -100,7 +103,8 @@ more detail in section 27.2.6.

    The usual (and recommended) way is to build the extension as a separate -dynamically loaded module. You can then specify that this be loaded +dynamically loaded module (which is supported by all modern operating +systems). You can then specify that this be loaded automatically in php.ini or load it explicitly for any script which needs it.

    @@ -110,17 +114,15 @@ It is also possible to rebuild PHP from source so that your module is statically linked into the php executable/library. This is a lot more work, and also requires a full rebuild of PHP to update your module, and it doesn't play nicely with package system. We don't recommend -this approach, but if you really want to do this, the -phpfull -command line argument to swig may be of use - see below for details. +this approach, or provide explicit support for it.

    28.1.1 Building a loadable extension

    -

    To build your module as a dynamically loadable extension, use compilation commands like these (if you aren't using GCC, the commands will be different, -and there may be so variation between platforms - these commands should at +and there may be some variation between platforms - these commands should at least work for Linux though):

    @@ -129,137 +131,8 @@ least work for Linux though): gcc -shared example_wrap.o -o example.so -

    -There is a deprecated -make command line argument to swig which will -generate an additional file makefile which can usually build the -extension (at least on some UNIX platforms), but the Makefile generated isn't -very flexible, and the commands required are trivial so it is simpler to just -add them to your Makefile or other build system directly. We recommend that -you don't use -make and it's likely to be removed at some point. -

    - -

    28.1.2 Building extensions into PHP

    - - -

    -Note that we don't recommend this approach - it's cleaner and simpler to -use dynamically loadable modules, which are supported by all modern OSes. -Support for this may be discontinued entirely in the future. -

    - -

    -It is possible to rebuild PHP itself with your module statically linked -in. To do this, you can use the -phpfull command line option to -swig. Using this option will generate three additional files. The first -extra file, config.m4 contains the m4 and shell code needed to -enable the extension as part of the PHP build process. The second -extra file, Makefile.in contains the information needed to -build the final Makefile after substitutions. The third and final -extra file, CREDITS should contain the credits for the -extension. -

    - -

    -To build with phpize, after you have run swig you will need to run the -'phpize' command (installed as part of php) in the same -directory. This re-creates the php build environment in that -directory. It also creates a configure file which includes the shell -code from the config.m4 that was generated by SWIG, this configure -script will accept a command line argument to enable the extension to -be run (by default the command line argument is --enable-modulename, -however you can edit the config.m4 file before running phpize to -accept --with-modulename. You can also add extra tests in config.m4 to -check that a correct library version is installed or correct header -files are included, etc, but you must edit this file before running -phpize.) You can also get SWIG to generate simple extra tests for -libraries and header files for you. -

    - -
    -	swig -php -phpfull
    -
    - -

    -If you depend on source files not generated by SWIG, before generating -the configure file, you may need to edit the Makefile.in -file. This contains the names of the source files to compile (just the -wrapper file by default) and any additional libraries needed to be -linked in. If there are extra C files to compile, you will need to add -them to the Makefile.in, or add the names of libraries if they are -needed. In simple cases SWIG is pretty good at generating a complete -Makefile.in and config.m4 which need no further editing. -

    - -

    -You then run the configure script with the command line argument needed -to enable the extension. Then run make, which builds the extension. -The extension object file will be left in the modules sub directory, you can -move it to wherever it is convenient to call from your php script. -

    - -

    -When using -phpfull, swig also accepts the following -additional optional arguments: -

    -
      -
    • -withincs "<incs>" Adds include files to the config.m4 file. -
    • -withlibs "<libs>" Links with the specified libraries. -
    • -withc "<files>" Compiles and links the additional specified C files. -
    • -withcxx "<files>" Compiles and links the additional specified C++ files. -
    - -

    -After running swig with the -phpfull switch, you will be left with a shockingly -similar set of files to the previous build process. However you will then need -to move these files to a subdirectory within the php source tree, this subdirectory you will need to create under the ext directory, with the name of the extension (e.g. mkdir php-4.0.6/ext/modulename). -

    - -

    -After moving the files into this directory, you will need to run the 'buildall' -script in the php source directory. This rebuilds the configure script -and includes the extra command line arguments from the module you have added. -

    - -

    -Before running the generated configure file, you may need to edit the -Makefile.in. This contains the names of the source files to compile ( -just the wrapper file by default) and any additional libraries needed to -link in. If there are extra C files to compile you will need to add them -to the Makefile, or add the names of libraries if they are needed. -In most cases Makefile.in will be complete, especially if you -make use of -withlibs and -withincs -

    - -
    -	swig -php -phpfull -withlibs "xapian omquery" --withincs "om.h"
    -
    - -

    -Will include in the config.m4 and Makefile.in search for -libxapian.a or libxapian.so and search for -libomquery.a or libomquery.so as well as a -search for om.h. -

    - -

    -You then need to run the configure command and pass the necessary command -line arguments to enable your module (by default this is --enable-modulename, -but this can be changed by editing the config.m4 file in the modules directory -before running the buildall script. In addition, extra tests can be added to -the config.m4 file to ensure the correct libraries and header files are -installed.) -

    - -

    -Once configure has completed, you can run make to build php. If this all -compiles correctly, you should end up with a php executable/library -which contains your new module. You can test it with a php script which -does not have the 'dl' command as used above. -

    -

    28.1.3 Using PHP Extensions

    -

    To test the extension from a PHP script, you need to load it first. You can load it for every script by adding this line the [PHP] section of @@ -717,20 +590,9 @@ variable, or assigning NULL to a variable.

    -SWIG defaults to wrapping C++ structs and classes with PHP classes. This -requires SWIG to generate different code for PHP4 and PHP5, so you must -specify which you want using -php4 or -php5 (currently --php generates PHP4 class wrappers for compatibility with -SWIG 1.3.29 and earlier, but this may change in the future). -

    - -

    -PHP4 classes are implemented entirely using the Zend C API so -no additional php code is generated. For PHP5, a PHP wrapper +SWIG defaults to wrapping C++ structs and classes with PHP classes +unless "-noproxy" is specified. For PHP5, a PHP wrapper class is generated which calls a set of flat functions wrapping the C++ class. -In many cases the PHP4 and PHP5 wrappers will behave the same way, -but the PHP5 ones make use of better PHP5's better OO functionality -where appropriate.

    @@ -754,7 +616,7 @@ struct Complex {

    -Would be used in the following way from either PHP4 or PHP5: +Would be used in the following way from PHP5:

    @@ -854,9 +716,9 @@ the programmer can either reassign the variable or call
     
     
     

    -Static member variables are not supported in PHP4, and it does not -appear to be possible to intercept accesses to static member variables -in PHP5. Therefore, static member variables are +Static member variables in C++ are not wrapped as such in PHP +as it does not appear to be possible to intercept accesses to such variables. +Therefore, static member variables are wrapped using a class function with the same name, which returns the current value of the class variable. For example

    diff --git a/Doc/Manual/Python.html b/Doc/Manual/Python.html index 62b72fabf..c0b71b52d 100644 --- a/Doc/Manual/Python.html +++ b/Doc/Manual/Python.html @@ -46,7 +46,7 @@
  • Memory management
  • Python 2.2 and classic classes -
  • Cross language polymorphism +
  • Cross language polymorphism
  • Python Packages +
  • Python 3 Support +
  • @@ -113,9 +119,9 @@

    This chapter describes SWIG's support of Python. SWIG is compatible -with most recent Python versions including Python 2.2 as well as older -versions dating back to Python 1.5.2. For the best results, consider using Python -2.0 or newer. +with most recent Python versions including Python 3.0 and Python 2.6, +as well as older versions dating back to Python 2.0. For the best results, +consider using Python 2.3 or newer.

    @@ -2544,7 +2550,7 @@ class itself. In Python-2.1 and earlier, they have to be accessed as a global function or through an instance (see the earlier section).

    -

    30.5 Cross language polymorphism

    +

    30.5 Cross language polymorphism

    @@ -4929,7 +4935,7 @@ with more than one line.

    Using the package option of the %module directive allows you to specify what Python package that the module will be -living in when installed. +living in when installed.

    @@ -4950,6 +4956,241 @@ and also in base class declarations, etc. if the package name is different than its own.

    +

    30.12 Python 3 Support

    + + +

    +SWIG is able to support Python 3.0. The wrapper code generated by +SWIG can be compiled with both Python 2.x or 3.0. Further more, by +passing the -py3 command line option to SWIG, wrapper code +with some Python 3 specific features can be generated (see below +subsections for details of these features). The -py3 option also +disables some incompatible features for Python 3, such as +-classic. + +

    +There is a list of known-to-be-broken features in Python 3: +

    +
      +
    • No more support for FILE* typemaps, because PyFile_AsFile has been dropped + in Python 3.
    • +
    • The -apply command line option is removed and generating + code using apply() is no longer supported.
    • +
    + +

    +The following are Python 3.0 new features that are currently supported by +SWIG. +

    + +

    30.12.1 Function annotation

    + + +

    +The -py3 option will enable function annotation support. When used +SWIG is able to generate proxy method definitions like +this: +

    + +
    +  def foo(self, bar : "int" = 0) -> "void" : ...
    +
    + +

    +For details of usage of function annotation, see PEP 3107. +

    + +

    30.12.2 Buffer interface

    + + +

    +Buffer protocols were revised in Python 3. SWIG also gains a series of +new typemaps to support buffer interfaces. These typemap macros are +defined in pybuffer.i, which must be included in order to use them. +By using these typemaps, your wrapped function will be able to +accept any Python object that exposes a suitable buffer interface. +

    + +

    +For example, the get_path() function puts the path string +into the memory pointed to by its argument: +

    + +
    +void get_path(char *s);
    +
    + +

    +Then you can write a typemap like this: (the following example is +applied to both Python 3.0 and 2.6, since the bytearray type +is backported to 2.6. +

    + + +
    +%include <pybuffer.i>
    +%pybuffer_mutable_string(char *str);
    +void get_path(char *s);
    +
    + +

    +And then on the Python side the wrapped get_path could be used in this +way: +

    + +
    +>>> p = bytearray(10)
    +>>> get_path(p)
    +>>> print(p)
    +bytearray(b'/Foo/Bar/\x00')
    +
    + +

    +The macros defined in pybuffer.i are similar to those in +cstring.i: +

    + +

    +%pybuffer_mutable_binary(parm, size_parm) +

    + +
    + +

    +The macro can be used to generate a typemap which maps a buffer of an +object to a pointer provided by parm and a size argument +provided by size_parm. For example: +

    + +
    +%pybuffer_mutable_binary(char *str, size_t size);
    +...
    +int snprintf(char *str, size_t size, const char *format, ...);
    +
    + +

    +In Python: +

    + +
    +>>> buf = bytearray(6)
    +>>> snprintf(buf, "Hello world!")
    +>>> print(buf)
    +bytearray(b'Hello\x00')
    +>>> 
    +
    + +
    + +

    +%pybuffer_mutable_string(parm) +

    + +
    + +

    +This typemap macro requires the buffer to be a zero terminated string, +and maps the pointer of the buffer to parm. For example: +

    + +
    +%pybuffer_mutable_string(char *str);
    +...
    +size_t make_upper(char *str);
    +
    + +

    +In Python: +

    + +
    +>>> buf = bytearray(b'foo\x00')
    +>>> make_upper(buf)
    +>>> print(buf)
    +bytearray(b'FOO\x00')
    +>>>
    +
    + +

    +Both %pybuffer_mutable_binary and %pybuffer_mutable_string +require the provided buffer to be mutable, eg. they can accept a +bytearray type but can't accept an immutable byte +type. +

    + +
    + +

    +%pybuffer_binary(parm, size_parm) +

    + +
    + +

    +This macro maps an object's buffer to a pointer parm and a +size size_parm. It is similar to +%pybuffer_mutable_binary, except the +%pybuffer_binary an accept both mutable and immutable +buffers. As a result, the wrapped function should not modify the buffer. +

    + +
    + +

    +%pybuffer_string(parm) +

    + +
    + +

    +This macro maps an object's buffer as a string pointer parm. +It is similar to %pybuffer_mutable_string but the buffer +could be both mutable and immutable. And your function should not +modify the buffer. +

    + +
    + + +

    30.12.3 Abstract base classes

    + + +

    +By including pyabc.i and using the -py3 command +line option when calling SWIG, the proxy classes of the STL containers +will automatically gain an appropriate abstract base class. For +example, the following SWIG interface: +

    + +
    +%include <pyabc.i>
    +%include <std_map.i>
    +%include <std_list.i>
    +
    +namespace std {
    +  %template(Mapii) map<int, int>;
    +  %template(IntList) list<int>;
    +}
    +
    + +

    +will generate a Python proxy class Mapii inheriting from +collections.MutableMap and a proxy class IntList +inheriting from collections.MutableSequence. +

    + +

    +pyabc.i also provides a macro %pythonabc that could be +used to define an abstract base class for your own C++ class: +

    + +
    +%pythonabc(MySet, collections.MutableSet);
    +
    + +

    +For details of abstract base class, please see PEP 3119. +

    diff --git a/Doc/Manual/SWIG.html b/Doc/Manual/SWIG.html index c22d81c07..c1ffcff60 100644 --- a/Doc/Manual/SWIG.html +++ b/Doc/Manual/SWIG.html @@ -53,7 +53,7 @@
  • Character strings and structures
  • Array members
  • Structure data members -
  • C constructors and destructors +
  • C constructors and destructors
  • Adding member functions to C structures
  • Nested structures
  • Other things to note about structure wrapping @@ -224,7 +224,7 @@ The C/C++ output file created by SWIG often contains everything that is needed to construct a extension module for the target scripting language. SWIG is not a stub compiler nor is it usually necessary to edit the output file (and if you look at the output, -you probably won't want to). To build the final extension module, the +you probably won't want to). To build the final extension module, the SWIG output file is compiled and linked with the rest of your C/C++ program to create a shared library.

    @@ -232,7 +232,7 @@ program to create a shared library.

    Many target languages will also generate proxy class files in the target language. The default output directory for these language -specific files is the same directory as the generated C/C++ file. This can +specific files is the same directory as the generated C/C++ file. This can be modified using the -outdir option. For example:

    @@ -2219,13 +2219,13 @@ void Foo_w_set(FOO *f, WORD value) {

    -Compatibility Note: SWIG-1.3.11 and earlier releases transformed all non-primitive member datatypes -to pointers. Starting in SWIG-1.3.12, this transformation only occurs if a datatype is known to be a structure, -class, or union. This is unlikely to break existing code. However, if you need to tell SWIG that an undeclared +Compatibility Note: SWIG-1.3.11 and earlier releases transformed all non-primitive member datatypes +to pointers. Starting in SWIG-1.3.12, this transformation only occurs if a datatype is known to be a structure, +class, or union. This is unlikely to break existing code. However, if you need to tell SWIG that an undeclared datatype is really a struct, simply use a forward struct declaration such as "struct Foo;".

    -

    5.5.5 C constructors and destructors

    +

    5.5.5 C constructors and destructors

    @@ -2282,7 +2282,7 @@ struct Bar { // Default constructor generated. Since ignoring the implicit or default destructors most of the times produce memory leaks, SWIG will always try to generate them. If needed, however, you can selectively disable the generation of the -default/implicit destructor by using %nodefaultdtor +default/implicit destructor by using %nodefaultdtor

    diff --git a/Doc/Manual/SWIGPlus.html b/Doc/Manual/SWIGPlus.html index faf0b254c..ef7487ff8 100644 --- a/Doc/Manual/SWIGPlus.html +++ b/Doc/Manual/SWIGPlus.html @@ -1153,8 +1153,9 @@ public:

    -This is great for reducing the size of the wrappers, but the caveat is it does not work for the strongly typed languages -which don't have optional arguments in the language, such as C# and Java. +This is great for reducing the size of the wrappers, but the caveat is it does not work for the statically typed languages, +such as C# and Java, +which don't have optional arguments in the language, Another restriction of this feature is that it cannot handle default arguments that are not public. The following example illustrates this:

    diff --git a/Doc/Manual/Sections.html b/Doc/Manual/Sections.html index b7b4798e7..5406f44ea 100644 --- a/Doc/Manual/Sections.html +++ b/Doc/Manual/Sections.html @@ -6,7 +6,7 @@

    SWIG-1.3 Development Documentation

    -Last update : SWIG-1.3.36 (in progress) +Last update : SWIG-1.3.37 (in progress)

    Sections

    diff --git a/Doc/Manual/Typemaps.html b/Doc/Manual/Typemaps.html index e07f9f87e..8f3035dc8 100644 --- a/Doc/Manual/Typemaps.html +++ b/Doc/Manual/Typemaps.html @@ -65,7 +65,7 @@
  • Typemaps for multiple languages
  • Optimal code generation when returning by value -
  • Multi-argument typemaps +
  • Multi-argument typemaps
  • The run-time type checker
    • Implementation @@ -702,7 +702,7 @@ variables (parms). The purpose of these variables will be explained shortly.

      code specifies the code used in the typemap. -Usually this is C/C++ code, but in the strongly typed target languages, such as Java and C#, this can contain target language code for certain typemaps. +Usually this is C/C++ code, but in the statically typed target languages, such as Java and C#, this can contain target language code for certain typemaps. It can take any one of the following forms:

      @@ -1933,7 +1933,7 @@ to implement customized conversions.

      In addition, the "in" typemap allows the number of converted arguments to be -specified. For example: +specified. The numinputs attributes facilitates this. For example:

      @@ -1946,7 +1946,12 @@ specified. For example:

      -At this time, only zero or one arguments may be converted. +At this time, only zero or one arguments may be converted. +When numinputs is set to 0, the argument is effectively ignored and cannot be supplied from the target language. +The argument is still required when making the C/C++ call and the above typemap +shows the value used is instead obtained from a locally declared variable called temp. +Usually numinputs is not specified, whereupon the default value is 1, that is, there is a one to one mapping of the number of arguments when used from the target language to the C/C++ call. +Multi-argument typemaps provide a similar concept where the number of arguments mapped from the target language to C/C++ can be changed for more tha multiple adjacent C/C++ arguments.

      @@ -2811,7 +2816,7 @@ optimal attribute usage in the out typemap at example.i:7. However, it doesn't always get it right, for example when $1 is within some commented out code.

      -

      10.9 Multi-argument typemaps

      +

      10.9 Multi-argument typemaps

      diff --git a/Doc/Manual/Warnings.html b/Doc/Manual/Warnings.html index 39d5d3f01..0b3cb37e9 100644 --- a/Doc/Manual/Warnings.html +++ b/Doc/Manual/Warnings.html @@ -373,7 +373,7 @@ example.i(4): Syntax error in input.

    • 117. Deprecated %new directive.
    • 118. Deprecated %typemap(except).
    • 119. Deprecated %typemap(ignore). -
    • 120. Deprecated command line option (-c). +
    • 120. Deprecated command line option (-runtime, -noruntime).
    • 121. Deprecated %name directive.
    diff --git a/Examples/GIFPlot/Python/full/Makefile b/Examples/GIFPlot/Python/full/Makefile index ae927b72b..83a7c864b 100644 --- a/Examples/GIFPlot/Python/full/Makefile +++ b/Examples/GIFPlot/Python/full/Makefile @@ -1,5 +1,5 @@ TOP = ../../.. -SWIG = $(TOP)/../swig +SWIG = $(TOP)/../preinst-swig SWIGOPT = -I../../Include SRCS = TARGET = gifplot @@ -23,3 +23,4 @@ clean:: rm -f *.gif check: all + $(MAKE) -f $(TOP)/Makefile python_run diff --git a/Examples/GIFPlot/Python/shadow/Makefile b/Examples/GIFPlot/Python/shadow/Makefile index 1f5014895..73fca9673 100644 --- a/Examples/GIFPlot/Python/shadow/Makefile +++ b/Examples/GIFPlot/Python/shadow/Makefile @@ -1,5 +1,5 @@ TOP = ../../.. -SWIG = $(TOP)/../swig +SWIG = $(TOP)/../preinst-swig SWIGOPT = -I../../Interface SRCS = TARGET = gifplot @@ -23,3 +23,4 @@ clean:: rm -f *.gif check: all + $(MAKE) -f $(TOP)/Makefile python_run diff --git a/Examples/GIFPlot/Python/simple/Makefile b/Examples/GIFPlot/Python/simple/Makefile index 5eb0344e8..9fc9a6c72 100644 --- a/Examples/GIFPlot/Python/simple/Makefile +++ b/Examples/GIFPlot/Python/simple/Makefile @@ -1,5 +1,5 @@ TOP = ../../.. -SWIG = $(TOP)/../swig +SWIG = $(TOP)/../preinst-swig SWIGOPT = SRCS = TARGET = simple @@ -23,3 +23,4 @@ clean:: rm -f *.gif check: all + $(MAKE) -f $(TOP)/Makefile python_run diff --git a/Examples/Makefile.in b/Examples/Makefile.in index 0bf9f6767..f85075906 100644 --- a/Examples/Makefile.in +++ b/Examples/Makefile.in @@ -40,8 +40,9 @@ LIBCRYPT = @LIBCRYPT@ SYSLIBS = $(LIBM) $(LIBC) $(LIBCRYPT) LIBPREFIX = -# RUNTOOL is for use as with runtime tools, eg set it to valgrind +# RUNTOOL is for use with runtime tools, eg set it to valgrind RUNTOOL = +# COMPILETOOL is a way to run the compiler under another tool, or more commonly just to stop the compiler executing COMPILETOOL= # X11 options @@ -94,9 +95,9 @@ TK_OPTS = -ltk -ltcl @LIBS@ # Extra Tcl specific dynamic linking options TCL_DLNK = @TCLDYNAMICLINKING@ -TCL_LDSHARED = @TCL_LDSHARED@ -TCL_CXXSHARED = @TCL_CXXSHARED@ TCL_SO = @TCL_SO@ +TCLLDSHARED = @TCLLDSHARED@ +TCLCXXSHARED = @TCLCXXSHARED@ # ----------------------------------------------------------- # Build a new version of the tclsh shell @@ -135,7 +136,7 @@ wish_cpp: $(SRCS) tcl: $(SRCS) $(SWIG) -tcl8 $(SWIGOPT) $(TCL_SWIGOPTS) $(INTERFACE) $(CC) -c $(CCSHARED) $(CFLAGS) $(SRCS) $(ISRCS) $(INCLUDES) $(TCL_INCLUDE) - $(TCL_LDSHARED) $(CFLAGS) $(OBJS) $(IOBJS) $(TCL_DLNK) $(LIBS) -o $(LIBPREFIX)$(TARGET)$(TCL_SO) + $(TCLLDSHARED) $(CFLAGS) $(OBJS) $(IOBJS) $(TCL_DLNK) $(LIBS) -o $(LIBPREFIX)$(TARGET)$(TCL_SO) # ----------------------------------------------------------- # Build a Tcl7.5 dynamic loadable module for C++ @@ -144,7 +145,7 @@ tcl: $(SRCS) tcl_cpp: $(SRCS) $(SWIG) -tcl8 -c++ $(SWIGOPT) $(TCL_SWIGOPTS) $(INTERFACE) $(CXX) -c $(CCSHARED) $(CFLAGS) $(SRCS) $(CXXSRCS) $(ICXXSRCS) $(INCLUDES) $(TCL_INCLUDE) - $(TCL_CXXSHARED) $(CFLAGS) $(OBJS) $(IOBJS) $(TCL_DLNK) $(LIBS) $(CPP_DLLIBS) -o $(LIBPREFIX)$(TARGET)$(TCL_SO) + $(TCLCXXSHARED) $(CFLAGS) $(OBJS) $(IOBJS) $(TCL_DLNK) $(LIBS) $(CPP_DLLIBS) -o $(LIBPREFIX)$(TARGET)$(TCL_SO) # ----------------------------------------------------------------- # Cleaning the Tcl examples @@ -222,19 +223,39 @@ perl5_clean: ################################################################## # Make sure these locate your Python installation -PYTHON_INCLUDE= $(DEFS) @PYINCLUDE@ -PYTHON_LIB = @PYLIB@ +ifeq (,$(PY3)) + PYTHON_INCLUDE= $(DEFS) @PYINCLUDE@ + PYTHON_LIB = @PYLIB@ + PYTHON = @PYTHON@ +else + PYTHON_INCLUDE= $(DEFS) @PY3INCLUDE@ + PYTHON_LIB = @PY3LIB@ + PYTHON = @PYTHON3@ +endif -# Extra Python specific dynamic linking options -PYTHON_DLNK = @PYTHONDYNAMICLINKING@ +# Extra Python specific linking options +ifeq (,$(PY3)) + PYTHON_DLNK = @PYTHONDYNAMICLINKING@ + PYTHON_LINK = @PYLINK@ +else + PYTHON_DLNK = @PYTHON3DYNAMICLINKING@ + PYTHON_LINK = @PY3LINK@ +endif PYTHON_SO = @PYTHON_SO@ +# SWIG option for Python +ifeq (,$(PY3)) + SWIGPYTHON = $(SWIG) -python +else + SWIGPYTHON = $(SWIG) -python -py3 +endif + # ---------------------------------------------------------------- # Build a C dynamically loadable module # ---------------------------------------------------------------- python: $(SRCS) - $(SWIG) -python $(SWIGOPT) $(INTERFACE) + $(SWIGPYTHON) $(SWIGOPT) $(INTERFACE) $(CC) -c $(CCSHARED) $(CFLAGS) $(ISRCS) $(SRCS) $(INCLUDES) $(PYTHON_INCLUDE) $(LDSHARED) $(CFLAGS) $(OBJS) $(IOBJS) $(PYTHON_DLNK) $(LIBS) -o $(LIBPREFIX)_$(TARGET)$(PYTHON_SO) @@ -243,7 +264,7 @@ python: $(SRCS) # ----------------------------------------------------------------- python_cpp: $(SRCS) - $(SWIG) -c++ -python $(SWIGOPT) $(INTERFACE) + $(SWIGPYTHON) -c++ $(SWIGOPT) $(INTERFACE) $(CXX) -c $(CCSHARED) $(CFLAGS) $(ICXXSRCS) $(SRCS) $(CXXSRCS) $(INCLUDES) $(PYTHON_INCLUDE) $(CXXSHARED) $(CFLAGS) $(OBJS) $(IOBJS) $(PYTHON_DLNK) $(LIBS) $(CPP_DLLIBS) -o $(LIBPREFIX)_$(TARGET)$(PYTHON_SO) @@ -256,18 +277,37 @@ python_cpp: $(SRCS) #TKINTER = -L/usr/X11R6.3/lib -L/usr/local/compat/lib -ltk4.0 -ltcl7.4 -lX11 TKINTER = -PYTHON_LIBOPTS = @PYLINK@ @LIBS@ $(TKINTER) $(SYSLIBS) +PYTHON_LIBOPTS = $(PYTHON_LINK) @LIBS@ $(TKINTER) $(SYSLIBS) python_static: $(SRCS) - $(SWIG) -python -lembed.i $(SWIGOPT) $(INTERFACE) + $(SWIGPYTHON) -lembed.i $(SWIGOPT) $(INTERFACE) $(CC) $(CFLAGS) @LINKFORSHARED@ $(ISRCS) $(SRCS) $(INCLUDES) \ $(PYTHON_INCLUDE) $(LIBS) -L$(PYTHON_LIB) $(PYTHON_LIBOPTS) -o $(TARGET) python_static_cpp: $(SRCS) - $(SWIG) -c++ -python -lembed.i $(SWIGOPT) $(INTERFACE) + $(SWIGPYTHON) -c++ -lembed.i $(SWIGOPT) $(INTERFACE) $(CXX) $(CFLAGS) $(ICXXSRCS) $(SRCS) $(CXXSRCS) $(INCLUDES) \ $(PYTHON_INCLUDE) $(LIBS) -L$(PYTHON_LIB) $(PYTHON_LIBOPTS) -o $(TARGET) +# ----------------------------------------------------------------- +# Running a Python example +# ----------------------------------------------------------------- + +ifeq (,$(PY3)) + SCRIPT = runme.py +else + SCRIPT = runme3.py +endif + +PY2TO3 = 2to3 `2to3 -l | grep -v -E "Available|import$$" | awk '{print "-f "$$0}'` + +python_run: $(SCRIPT) + env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH PYTHONPATH=$(srcdir):$$PYTHONPATH $(PYTHON) $(SCRIPT) >/dev/null + +runme3.py: runme.py + cp $< $@ + $(PY2TO3) -w $@ >/dev/null 2>&1 + # ----------------------------------------------------------------- # Cleaning the python examples # ----------------------------------------------------------------- @@ -277,6 +317,7 @@ python_clean: rm -f core @EXTRA_CLEAN@ rm -f *.@OBJEXT@ *@SO@ *@PYTHON_SO@ + ################################################################## ##### OCTAVE ###### ################################################################## @@ -880,11 +921,11 @@ chicken_static_cpp: $(CXXSRCS) $(CHICKSRCS) chicken: $(SWIG) -chicken $(SWIGOPT) $(INCLUDE) $(INTERFACE) - $(CHICKEN_CSC) -s `echo $(INCLUDES) | sed 's/-I/-C -I/g'` $(CHICKEN_GENERATED_SCHEME) $(SRCS) $(ISRCS) -o $(TARGET)$(SO) + $(COMPILETOOL) $(CHICKEN_CSC) -s `echo $(INCLUDES) | sed 's/-I/-C -I/g'` $(CHICKEN_GENERATED_SCHEME) $(SRCS) $(ISRCS) -o $(TARGET)$(SO) chicken_cpp: $(SWIG) -c++ -chicken $(SWIGOPT) $(INCLUDE) $(INTERFACE) - $(CHICKEN_CSC) -s `echo $(INCLUDES) | sed 's/-I/-C -I/g'` $(CHICKEN_GENERATED_SCHEME) $(SRCS) $(ICXXSRCS) $(CXXSRCS) -o $(TARGET)$(SO) + $(COMPILETOOL) $(CHICKEN_CSC) -s `echo $(INCLUDES) | sed 's/-I/-C -I/g'` $(CHICKEN_GENERATED_SCHEME) $(SRCS) $(ICXXSRCS) $(CXXSRCS) -o $(TARGET)$(SO) chicken_externalhdr: $(SWIG) -chicken -external-runtime $(TARGET) @@ -1078,11 +1119,11 @@ RRSRC = $(INTERFACE:.i=.R) r: $(SRCS) $(SWIG) -r $(SWIGOPT) $(INTERFACE) - +( PKG_LIBS="$(SRCS)" PKG_CPPFLAGS="$(INCLUDES)" $(R) CMD SHLIB -o $(LIBPREFIX)$(TARGET)$(SO) $(ISRCS) ) + +( PKG_LIBS="$(SRCS)" PKG_CPPFLAGS="$(INCLUDES)" $(COMPILETOOL) $(R) CMD SHLIB -o $(LIBPREFIX)$(TARGET)$(SO) $(ISRCS) ) r_cpp: $(CXXSRCS) $(SWIG) -c++ -r $(SWIGOPT) -o $(RCXXSRCS) $(INTERFACE) - +( PKG_LIBS="$(CXXSRCS)" PKG_CPPFLAGS="$(INCLUDES)" $(R) CMD SHLIB -o $(LIBPREFIX)$(TARGET)$(SO) $(RCXXSRCS) ) + +( PKG_LIBS="$(CXXSRCS)" PKG_CPPFLAGS="$(INCLUDES)" $(COMPILETOOL) $(R) CMD SHLIB -o $(LIBPREFIX)$(TARGET)$(SO) $(RCXXSRCS) ) r_clean: rm -f *_wrap* *~ .~* diff --git a/Examples/guile/multimap/example.i b/Examples/guile/multimap/example.i index a1cc0bb67..7337d1e9e 100644 --- a/Examples/guile/multimap/example.i +++ b/Examples/guile/multimap/example.i @@ -20,7 +20,7 @@ extern int gcd(int x, int y); SCM *v; if (!(SCM_NIMP($input) && SCM_VECTORP($input))) { SWIG_exception(SWIG_ValueError, "Expecting a vector"); - return; + return 0; } $1 = SCM_LENGTH($input); if ($1 == 0) { @@ -32,7 +32,7 @@ extern int gcd(int x, int y); if (!(SCM_NIMP(v[i]) && SCM_STRINGP(v[i]))) { free($2); SWIG_exception(SWIG_ValueError, "Vector items must be strings"); - return; + return 0; } $2[i] = SCM_CHARS(v[i]); } diff --git a/Examples/guile/multivalue/example.i b/Examples/guile/multivalue/example.i index abc2a6fbc..135389487 100644 --- a/Examples/guile/multivalue/example.i +++ b/Examples/guile/multivalue/example.i @@ -2,6 +2,12 @@ %module example; +%{ +void divide_l(int a, int b, int *quotient_p, int *remainder_p); +void divide_v(int a, int b, int *quotient_p, int *remainder_p); +void divide_mv(int a, int b, int *quotient_p, int *remainder_p); +%} + /* Multiple values as lists. By default, if more than one value is to be returned, a list of the values is created and returned; to switch back to this behavior, use: */ diff --git a/Examples/lua/arrays/example.c b/Examples/lua/arrays/example.c index 40ed12c79..56c7b19d9 100644 --- a/Examples/lua/arrays/example.c +++ b/Examples/lua/arrays/example.c @@ -16,7 +16,7 @@ void sort_int(int* arr, int len) // ditto doubles int compare_double(const void * a, const void * b) { - return ( *(double*)a - *(double*)b ); + return (int)( *(double*)a - *(double*)b ); } void sort_double(double* arr, int len) diff --git a/Examples/lua/embed2/embed2.c b/Examples/lua/embed2/embed2.c index 07b7a44d2..dac527eb4 100644 --- a/Examples/lua/embed2/embed2.c +++ b/Examples/lua/embed2/embed2.c @@ -11,6 +11,17 @@ We will be using the luaL_dostring()/lua_dostring() function to call into lua */ +/* Deal with Microsoft's attempt at deprecating C standard runtime functions */ +#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE) +# define _CRT_SECURE_NO_DEPRECATE +#endif + +/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */ +#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE) +# define _SCL_SECURE_NO_DEPRECATE +#endif + + #include #include @@ -108,7 +119,7 @@ int call_va (lua_State *L,const char *func, const char *sig, ...) { endwhile: /* do the call */ - nres = strlen(sig); /* number of expected results */ + nres = (int)strlen(sig); /* number of expected results */ if (lua_pcall(L, narg, nres, 0) != 0) /* do the call */ { printf("error running function `%s': %s\n",func, lua_tostring(L, -1)); diff --git a/Examples/lua/embed3/embed3.cpp b/Examples/lua/embed3/embed3.cpp index e42401cda..c2424f9af 100644 --- a/Examples/lua/embed3/embed3.cpp +++ b/Examples/lua/embed3/embed3.cpp @@ -5,6 +5,17 @@ passing C++ objects to this function. */ +/* Deal with Microsoft's attempt at deprecating C standard runtime functions */ +#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE) +# define _CRT_SECURE_NO_DEPRECATE +#endif + +/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */ +#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE) +# define _SCL_SECURE_NO_DEPRECATE +#endif + + #include #include #include @@ -70,9 +81,6 @@ int call_onEvent(lua_State *L, Event e) { int main(int argc, char* argv[]) { - int ok; - int res; - char str[80]; printf("[C++] Welcome to the simple embedded Lua example v3\n"); printf("[C++] We are in C++\n"); printf("[C++] opening a Lua state & loading the libraries\n"); diff --git a/Examples/lua/owner/example.cxx b/Examples/lua/owner/example.cxx index 6e4091327..d6caeef15 100644 --- a/Examples/lua/owner/example.cxx +++ b/Examples/lua/owner/example.cxx @@ -54,14 +54,14 @@ void ShapeOwner::add(Shape* ptr) // this method takes ownership of the object Shape* ShapeOwner::get(int idx) // this pointer is still owned by the class (assessor) { - if (idx<0 || idx>=shapes.size()) + if (idx < 0 || idx >= static_cast(shapes.size())) return NULL; return shapes[idx]; } Shape* ShapeOwner::remove(int idx) // this method returns memory which must be deleted { - if (idx<0 || idx>=shapes.size()) + if (idx < 0 || idx >= static_cast(shapes.size())) return NULL; Shape* ptr=shapes[idx]; shapes.erase(shapes.begin()+idx); diff --git a/Examples/perl5/import/base.h b/Examples/perl5/import/base.h index be3cdef7d..5a266f68c 100644 --- a/Examples/perl5/import/base.h +++ b/Examples/perl5/import/base.h @@ -3,7 +3,7 @@ class Base { public: Base() { }; - ~Base() { }; + virtual ~Base() { }; virtual void A() { printf("I'm Base::A\n"); } diff --git a/Examples/perl5/multiple_inheritance/example.h b/Examples/perl5/multiple_inheritance/example.h index ce7dfe6a7..a8f544898 100644 --- a/Examples/perl5/multiple_inheritance/example.h +++ b/Examples/perl5/multiple_inheritance/example.h @@ -7,26 +7,25 @@ using namespace std; class Bar { public: - virtual void bar () - { - cout << "bar" << endl; - } + virtual void bar () { + cout << "bar" << endl; + } + virtual ~Bar() {} }; class Foo { public: - virtual void foo () - { - cout << "foo" << endl; - } + virtual void foo () { + cout << "foo" << endl; + } + virtual ~Foo() {} }; class Foo_Bar : public Foo, public Bar { public: - virtual void fooBar () - { - cout << "foobar" << endl; - } + virtual void fooBar () { + cout << "foobar" << endl; + } }; diff --git a/Examples/php4/reference/BUILD-proxy.sh b/Examples/php4/reference/BUILD-proxy.sh deleted file mode 100755 index b1c8c71a4..000000000 --- a/Examples/php4/reference/BUILD-proxy.sh +++ /dev/null @@ -1,5 +0,0 @@ -#! /bin/sh -e - -${SWIG:=swig} -php4 -make -c++ -withcxx example.cxx example.i -make -php -d extension_dir=. runme-proxy.php4 diff --git a/Examples/python/callback/Makefile b/Examples/python/callback/Makefile index ad36d7d7e..a29276e58 100644 --- a/Examples/python/callback/Makefile +++ b/Examples/python/callback/Makefile @@ -19,3 +19,4 @@ clean:: rm -f $(TARGET).py check: all + $(MAKE) -f $(TOP)/Makefile python_run diff --git a/Examples/python/class/Makefile b/Examples/python/class/Makefile index f331b8203..74625b992 100644 --- a/Examples/python/class/Makefile +++ b/Examples/python/class/Makefile @@ -18,3 +18,4 @@ clean:: rm -f $(TARGET).py check: all + $(MAKE) -f $(TOP)/Makefile python_run diff --git a/Examples/python/constants/Makefile b/Examples/python/constants/Makefile index 01d0f943a..1420b4e0b 100644 --- a/Examples/python/constants/Makefile +++ b/Examples/python/constants/Makefile @@ -17,3 +17,4 @@ clean:: rm -f $(TARGET).py check: all + $(MAKE) -f $(TOP)/Makefile python_run diff --git a/Examples/python/contract/Makefile b/Examples/python/contract/Makefile index c7b476995..77fe94b1a 100644 --- a/Examples/python/contract/Makefile +++ b/Examples/python/contract/Makefile @@ -17,3 +17,4 @@ clean:: rm -f $(TARGET).py check: all + $(MAKE) -f $(TOP)/Makefile python_run diff --git a/Examples/python/docstrings/Makefile b/Examples/python/docstrings/Makefile index 74ab112a1..f25450cac 100644 --- a/Examples/python/docstrings/Makefile +++ b/Examples/python/docstrings/Makefile @@ -21,3 +21,4 @@ clean:: rm -f $(TARGET).py check: all + $(MAKE) -f $(TOP)/Makefile python_run diff --git a/Examples/python/enum/Makefile b/Examples/python/enum/Makefile index f331b8203..74625b992 100644 --- a/Examples/python/enum/Makefile +++ b/Examples/python/enum/Makefile @@ -18,3 +18,4 @@ clean:: rm -f $(TARGET).py check: all + $(MAKE) -f $(TOP)/Makefile python_run diff --git a/Examples/python/exception/Makefile b/Examples/python/exception/Makefile index 17c4f30b7..7dbdde944 100644 --- a/Examples/python/exception/Makefile +++ b/Examples/python/exception/Makefile @@ -18,3 +18,4 @@ clean:: rm -f $(TARGET).py check: all + $(MAKE) -f $(TOP)/Makefile python_run diff --git a/Examples/python/exceptproxy/Makefile b/Examples/python/exceptproxy/Makefile index a4f334311..ba5c79827 100644 --- a/Examples/python/exceptproxy/Makefile +++ b/Examples/python/exceptproxy/Makefile @@ -19,3 +19,4 @@ clean:: rm -f $(TARGET).py check: all + $(MAKE) -f $(TOP)/Makefile python_run diff --git a/Examples/python/extend/Makefile b/Examples/python/extend/Makefile index ad36d7d7e..a29276e58 100644 --- a/Examples/python/extend/Makefile +++ b/Examples/python/extend/Makefile @@ -19,3 +19,4 @@ clean:: rm -f $(TARGET).py check: all + $(MAKE) -f $(TOP)/Makefile python_run diff --git a/Examples/python/funcptr/Makefile b/Examples/python/funcptr/Makefile index 4a1e1bb71..0f4a1e077 100644 --- a/Examples/python/funcptr/Makefile +++ b/Examples/python/funcptr/Makefile @@ -17,3 +17,4 @@ clean:: rm -f $(TARGET).py check: all + $(MAKE) -f $(TOP)/Makefile python_run diff --git a/Examples/python/funcptr2/Makefile b/Examples/python/funcptr2/Makefile index 4a1e1bb71..0f4a1e077 100644 --- a/Examples/python/funcptr2/Makefile +++ b/Examples/python/funcptr2/Makefile @@ -17,3 +17,4 @@ clean:: rm -f $(TARGET).py check: all + $(MAKE) -f $(TOP)/Makefile python_run diff --git a/Examples/python/functor/Makefile b/Examples/python/functor/Makefile index c45536529..fe389757a 100644 --- a/Examples/python/functor/Makefile +++ b/Examples/python/functor/Makefile @@ -19,3 +19,4 @@ clean:: rm -f $(TARGET).py check: all + $(MAKE) -f $(TOP)/Makefile python_run diff --git a/Examples/python/import/Makefile b/Examples/python/import/Makefile index e00e81864..74d4f88cf 100644 --- a/Examples/python/import/Makefile +++ b/Examples/python/import/Makefile @@ -19,3 +19,4 @@ clean:: @rm -f foo.py bar.py spam.py base.py check: all + $(MAKE) -f $(TOP)/Makefile python_run diff --git a/Examples/python/import_template/Makefile b/Examples/python/import_template/Makefile index fa49f3145..ee47e994d 100644 --- a/Examples/python/import_template/Makefile +++ b/Examples/python/import_template/Makefile @@ -19,3 +19,4 @@ clean:: @rm -f foo.py bar.py spam.py base.py check: all + $(MAKE) -f $(TOP)/Makefile python_run diff --git a/Examples/python/libffi/Makefile b/Examples/python/libffi/Makefile index 8c7edfa65..fafb7de09 100644 --- a/Examples/python/libffi/Makefile +++ b/Examples/python/libffi/Makefile @@ -17,3 +17,4 @@ clean:: rm -f $(TARGET).py check: all + $(MAKE) -f $(TOP)/Makefile python_run diff --git a/Examples/python/multimap/Makefile b/Examples/python/multimap/Makefile index 4a1e1bb71..0f4a1e077 100644 --- a/Examples/python/multimap/Makefile +++ b/Examples/python/multimap/Makefile @@ -17,3 +17,4 @@ clean:: rm -f $(TARGET).py check: all + $(MAKE) -f $(TOP)/Makefile python_run diff --git a/Examples/python/multimap/example.i b/Examples/python/multimap/example.i index 163d7cc8e..3d5a09771 100644 --- a/Examples/python/multimap/example.i +++ b/Examples/python/multimap/example.i @@ -17,6 +17,7 @@ extern int gcd(int x, int y); %typemap(in,fragment="t_output_helper") (int argc, char *argv[]) { int i; + int l; if (!PyList_Check($input)) { SWIG_exception(SWIG_ValueError, "Expecting a list"); } @@ -27,11 +28,21 @@ extern int gcd(int x, int y); $2 = (char **) malloc(($1+1)*sizeof(char *)); for (i = 0; i < $1; i++) { PyObject *s = PyList_GetItem($input,i); - if (!PyString_Check(s)) { +%#if PY_VERSION_HEX >= 0x03000000 + if (!PyUnicode_Check(s)) +%#else + if (!PyString_Check(s)) +%#endif + { free($2); SWIG_exception(SWIG_ValueError, "List items must be strings"); } +%#if PY_VERSION_HEX >= 0x03000000 + $2[i] = PyUnicode_AsStringAndSize(s, &l); +%#else $2[i] = PyString_AsString(s); +%#endif + } $2[i] = 0; } @@ -39,12 +50,21 @@ extern int gcd(int x, int y); extern int gcdmain(int argc, char *argv[]); %typemap(in) (char *bytes, int len) { + +%#if PY_VERSION_HEX >= 0x03000000 + if (!PyUnicode_Check($input)) { + PyErr_SetString(PyExc_ValueError,"Expected a string"); + return NULL; + } + $1 = PyUnicode_AsStringAndSize($input, &$2); +%#else if (!PyString_Check($input)) { PyErr_SetString(PyExc_ValueError,"Expected a string"); return NULL; } $1 = PyString_AsString($input); $2 = PyString_Size($input); +%#endif } extern int count(char *bytes, int len, char c); @@ -56,9 +76,15 @@ extern int count(char *bytes, int len, char c); so that we don't violate it's mutability */ %typemap(in) (char *str, int len) { +%#if PY_VERSION_HEX >= 0x03000000 + $2 = PyUnicode_GetSize($input); + $1 = (char *) malloc($2+1); + memmove($1,PyUnicode_AsString($input),$2); +%#else $2 = PyString_Size($input); $1 = (char *) malloc($2+1); memmove($1,PyString_AsString($input),$2); +%#endif } /* Return the mutated string as a new object. The t_output_helper @@ -67,7 +93,11 @@ extern int count(char *bytes, int len, char c); %typemap(argout) (char *str, int len) { PyObject *o; +%#if PY_VERSION_HEX >= 0x03000000 + o = PyUnicode_FromStringAndSize($1,$2); +%#else o = PyString_FromStringAndSize($1,$2); +%#endif $result = t_output_helper($result,o); free($1); } diff --git a/Examples/python/operator/Makefile b/Examples/python/operator/Makefile index c45536529..fe389757a 100644 --- a/Examples/python/operator/Makefile +++ b/Examples/python/operator/Makefile @@ -19,3 +19,4 @@ clean:: rm -f $(TARGET).py check: all + $(MAKE) -f $(TOP)/Makefile python_run diff --git a/Examples/python/pointer/Makefile b/Examples/python/pointer/Makefile index 4a1e1bb71..0f4a1e077 100644 --- a/Examples/python/pointer/Makefile +++ b/Examples/python/pointer/Makefile @@ -17,3 +17,4 @@ clean:: rm -f $(TARGET).py check: all + $(MAKE) -f $(TOP)/Makefile python_run diff --git a/Examples/python/reference/Makefile b/Examples/python/reference/Makefile index f331b8203..74625b992 100644 --- a/Examples/python/reference/Makefile +++ b/Examples/python/reference/Makefile @@ -18,3 +18,4 @@ clean:: rm -f $(TARGET).py check: all + $(MAKE) -f $(TOP)/Makefile python_run diff --git a/Examples/python/simple/Makefile b/Examples/python/simple/Makefile index 4a1e1bb71..0f4a1e077 100644 --- a/Examples/python/simple/Makefile +++ b/Examples/python/simple/Makefile @@ -17,3 +17,4 @@ clean:: rm -f $(TARGET).py check: all + $(MAKE) -f $(TOP)/Makefile python_run diff --git a/Examples/python/smartptr/Makefile b/Examples/python/smartptr/Makefile index 58d139643..f73802a6b 100644 --- a/Examples/python/smartptr/Makefile +++ b/Examples/python/smartptr/Makefile @@ -19,3 +19,4 @@ clean:: rm -f $(TARGET).py check: all + $(MAKE) -f $(TOP)/Makefile python_run diff --git a/Examples/python/std_map/Makefile b/Examples/python/std_map/Makefile index 2d4c1b4a3..5d13da764 100644 --- a/Examples/python/std_map/Makefile +++ b/Examples/python/std_map/Makefile @@ -22,3 +22,4 @@ run: python runme.py check: all + $(MAKE) -f $(TOP)/Makefile python_run diff --git a/Examples/python/std_vector/Makefile b/Examples/python/std_vector/Makefile index a4f334311..ba5c79827 100644 --- a/Examples/python/std_vector/Makefile +++ b/Examples/python/std_vector/Makefile @@ -19,3 +19,4 @@ clean:: rm -f $(TARGET).py check: all + $(MAKE) -f $(TOP)/Makefile python_run diff --git a/Examples/python/swigrun/Makefile b/Examples/python/swigrun/Makefile index 53bf701c9..2142be5bb 100644 --- a/Examples/python/swigrun/Makefile +++ b/Examples/python/swigrun/Makefile @@ -22,3 +22,4 @@ clean:: check: all + $(MAKE) -f $(TOP)/Makefile python_run diff --git a/Examples/python/template/Makefile b/Examples/python/template/Makefile index a4f334311..ba5c79827 100644 --- a/Examples/python/template/Makefile +++ b/Examples/python/template/Makefile @@ -19,3 +19,4 @@ clean:: rm -f $(TARGET).py check: all + $(MAKE) -f $(TOP)/Makefile python_run diff --git a/Examples/python/varargs/Makefile b/Examples/python/varargs/Makefile index 01d0f943a..1420b4e0b 100644 --- a/Examples/python/varargs/Makefile +++ b/Examples/python/varargs/Makefile @@ -17,3 +17,4 @@ clean:: rm -f $(TARGET).py check: all + $(MAKE) -f $(TOP)/Makefile python_run diff --git a/Examples/python/variables/Makefile b/Examples/python/variables/Makefile index 4a1e1bb71..0f4a1e077 100644 --- a/Examples/python/variables/Makefile +++ b/Examples/python/variables/Makefile @@ -17,3 +17,4 @@ clean:: rm -f $(TARGET).py check: all + $(MAKE) -f $(TOP)/Makefile python_run diff --git a/Examples/python/weave/Makefile b/Examples/python/weave/Makefile index 822779bd1..88f95c095 100644 --- a/Examples/python/weave/Makefile +++ b/Examples/python/weave/Makefile @@ -19,3 +19,4 @@ clean:: rm -f $(TARGET).py check: all + $(MAKE) -f $(TOP)/Makefile python_run diff --git a/Examples/ruby/class/example.dsp b/Examples/ruby/class/example.dsp index 49c480575..9a26322ec 100644 --- a/Examples/ruby/class/example.dsp +++ b/Examples/ruby/class/example.dsp @@ -123,7 +123,7 @@ SOURCE=.\example.i InputPath=.\example.i InputName=example -"$(InputName)_wrap.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" +"$(InputName)_wrap.cxx" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" echo In order to function correctly, please ensure the following environment variables are correctly set: echo RUBY_INCLUDE: %RUBY_INCLUDE% echo RUBY_LIB: %RUBY_LIB% @@ -138,7 +138,7 @@ InputName=example InputPath=.\example.i InputName=example -"$(InputName)_wrap.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" +"$(InputName)_wrap.cxx" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" echo In order to function correctly, please ensure the following environment variables are correctly set: echo RUBY_INCLUDE: %RUBY_INCLUDE% echo RUBY_LIB: %RUBY_LIB% diff --git a/Examples/ruby/free_function/example.cxx b/Examples/ruby/free_function/example.cxx index 9e0d24b1a..402a947e9 100644 --- a/Examples/ruby/free_function/example.cxx +++ b/Examples/ruby/free_function/example.cxx @@ -23,7 +23,7 @@ Zoo::~Zoo() IterType iter = this->animals.begin(); IterType end = this->animals.end(); - for(iter; iter != end; ++iter) + for(; iter != end; ++iter) { Animal* animal = *iter; delete animal; diff --git a/Examples/ruby/free_function/example.dsp b/Examples/ruby/free_function/example.dsp index 49c480575..9a26322ec 100644 --- a/Examples/ruby/free_function/example.dsp +++ b/Examples/ruby/free_function/example.dsp @@ -123,7 +123,7 @@ SOURCE=.\example.i InputPath=.\example.i InputName=example -"$(InputName)_wrap.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" +"$(InputName)_wrap.cxx" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" echo In order to function correctly, please ensure the following environment variables are correctly set: echo RUBY_INCLUDE: %RUBY_INCLUDE% echo RUBY_LIB: %RUBY_LIB% @@ -138,7 +138,7 @@ InputName=example InputPath=.\example.i InputName=example -"$(InputName)_wrap.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" +"$(InputName)_wrap.cxx" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" echo In order to function correctly, please ensure the following environment variables are correctly set: echo RUBY_INCLUDE: %RUBY_INCLUDE% echo RUBY_LIB: %RUBY_LIB% diff --git a/Examples/ruby/import/bar.dsp b/Examples/ruby/import/bar.dsp index e897f8d5c..dd09ca021 100644 --- a/Examples/ruby/import/bar.dsp +++ b/Examples/ruby/import/bar.dsp @@ -115,7 +115,7 @@ SOURCE=.\bar.i InputPath=.\bar.i InputName=bar -"$(InputName)_wrap.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" +"$(InputName)_wrap.cxx" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" echo In order to function correctly, please ensure the following environment variables are correctly set: echo RUBY_INCLUDE: %RUBY_INCLUDE% echo RUBY_LIB: %RUBY_LIB% @@ -130,7 +130,7 @@ InputName=bar InputPath=.\bar.i InputName=bar -"$(InputName)_wrap.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" +"$(InputName)_wrap.cxx" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" echo In order to function correctly, please ensure the following environment variables are correctly set: echo RUBY_INCLUDE: %RUBY_INCLUDE% echo RUBY_LIB: %RUBY_LIB% diff --git a/Examples/ruby/import/base.dsp b/Examples/ruby/import/base.dsp index 45d2fe2ea..2bd4fa243 100644 --- a/Examples/ruby/import/base.dsp +++ b/Examples/ruby/import/base.dsp @@ -115,7 +115,7 @@ SOURCE=.\base.i InputPath=.\base.i InputName=base -"$(InputName)_wrap.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" +"$(InputName)_wrap.cxx" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" echo In order to function correctly, please ensure the following environment variables are correctly set: echo RUBY_INCLUDE: %RUBY_INCLUDE% echo RUBY_LIB: %RUBY_LIB% @@ -130,7 +130,7 @@ InputName=base InputPath=.\base.i InputName=base -"$(InputName)_wrap.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" +"$(InputName)_wrap.cxx" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" echo In order to function correctly, please ensure the following environment variables are correctly set: echo RUBY_INCLUDE: %RUBY_INCLUDE% echo RUBY_LIB: %RUBY_LIB% diff --git a/Examples/ruby/import/foo.dsp b/Examples/ruby/import/foo.dsp index 2dfba9d60..2a764bbd7 100644 --- a/Examples/ruby/import/foo.dsp +++ b/Examples/ruby/import/foo.dsp @@ -115,7 +115,7 @@ SOURCE=.\foo.i InputPath=.\foo.i InputName=foo -"$(InputName)_wrap.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" +"$(InputName)_wrap.cxx" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" echo In order to function correctly, please ensure the following environment variables are correctly set: echo RUBY_INCLUDE: %RUBY_INCLUDE% echo RUBY_LIB: %RUBY_LIB% @@ -130,7 +130,7 @@ InputName=foo InputPath=.\foo.i InputName=foo -"$(InputName)_wrap.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" +"$(InputName)_wrap.cxx" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" echo In order to function correctly, please ensure the following environment variables are correctly set: echo RUBY_INCLUDE: %RUBY_INCLUDE% echo RUBY_LIB: %RUBY_LIB% diff --git a/Examples/ruby/import/spam.dsp b/Examples/ruby/import/spam.dsp index 0530b7303..d2d7158bb 100644 --- a/Examples/ruby/import/spam.dsp +++ b/Examples/ruby/import/spam.dsp @@ -115,7 +115,7 @@ SOURCE=.\spam.i InputPath=.\spam.i InputName=spam -"$(InputName)_wrap.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" +"$(InputName)_wrap.cxx" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" echo In order to function correctly, please ensure the following environment variables are correctly set: echo RUBY_INCLUDE: %RUBY_INCLUDE% echo RUBY_LIB: %RUBY_LIB% @@ -130,7 +130,7 @@ InputName=spam InputPath=.\spam.i InputName=spam -"$(InputName)_wrap.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" +"$(InputName)_wrap.cxx" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" echo In order to function correctly, please ensure the following environment variables are correctly set: echo RUBY_INCLUDE: %RUBY_INCLUDE% echo RUBY_LIB: %RUBY_LIB% diff --git a/Examples/ruby/mark_function/example.dsp b/Examples/ruby/mark_function/example.dsp index 49c480575..9a26322ec 100644 --- a/Examples/ruby/mark_function/example.dsp +++ b/Examples/ruby/mark_function/example.dsp @@ -123,7 +123,7 @@ SOURCE=.\example.i InputPath=.\example.i InputName=example -"$(InputName)_wrap.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" +"$(InputName)_wrap.cxx" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" echo In order to function correctly, please ensure the following environment variables are correctly set: echo RUBY_INCLUDE: %RUBY_INCLUDE% echo RUBY_LIB: %RUBY_LIB% @@ -138,7 +138,7 @@ InputName=example InputPath=.\example.i InputName=example -"$(InputName)_wrap.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" +"$(InputName)_wrap.cxx" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" echo In order to function correctly, please ensure the following environment variables are correctly set: echo RUBY_INCLUDE: %RUBY_INCLUDE% echo RUBY_LIB: %RUBY_LIB% diff --git a/Examples/ruby/std_vector/runme.rb b/Examples/ruby/std_vector/runme.rb index 1529d38c6..851190536 100644 --- a/Examples/ruby/std_vector/runme.rb +++ b/Examples/ruby/std_vector/runme.rb @@ -9,7 +9,7 @@ puts Example::average([1,2,3,4]) # ... or a wrapped std::vector v = Example::IntVector.new(4) -0.upto(v.length-1) { |i| v[i] = i+1 } +0.upto(v.size-1) { |i| v[i] = i+1 } puts Example::average(v) @@ -17,7 +17,7 @@ puts Example::average(v) # Call it with a Ruby array... w = Example::half([1.0, 1.5, 2.0, 2.5, 3.0]) -0.upto(w.length-1) { |i| print w[i],"; " } +0.upto(w.size-1) { |i| print w[i],"; " } puts # ... or a wrapped std::vector @@ -25,12 +25,12 @@ puts v = Example::DoubleVector.new [1,2,3,4].each { |i| v.push(i) } w = Example::half(v) -0.upto(w.length-1) { |i| print w[i],"; " } +0.upto(w.size-1) { |i| print w[i],"; " } puts # now halve a wrapped std::vector in place Example::halve_in_place(v) -0.upto(v.length-1) { |i| print v[i],"; " } +0.upto(v.size-1) { |i| print v[i],"; " } puts diff --git a/Examples/tcl/import/base.h b/Examples/tcl/import/base.h index be3cdef7d..5a266f68c 100644 --- a/Examples/tcl/import/base.h +++ b/Examples/tcl/import/base.h @@ -3,7 +3,7 @@ class Base { public: Base() { }; - ~Base() { }; + virtual ~Base() { }; virtual void A() { printf("I'm Base::A\n"); } diff --git a/Examples/test-suite/abstract_virtual.i b/Examples/test-suite/abstract_virtual.i index e2d8054bb..2e4d105b1 100644 --- a/Examples/test-suite/abstract_virtual.i +++ b/Examples/test-suite/abstract_virtual.i @@ -2,10 +2,10 @@ %warnfilter(SWIGWARN_JAVA_MULTIPLE_INHERITANCE, SWIGWARN_CSHARP_MULTIPLE_INHERITANCE, - SWIGWARN_PHP4_MULTIPLE_INHERITANCE) D; /* C#, Java, Php4 multiple inheritance */ + SWIGWARN_PHP_MULTIPLE_INHERITANCE) D; /* C#, Java, PHP multiple inheritance */ %warnfilter(SWIGWARN_JAVA_MULTIPLE_INHERITANCE, SWIGWARN_CSHARP_MULTIPLE_INHERITANCE, - SWIGWARN_PHP4_MULTIPLE_INHERITANCE) E; /* C#, Java, Php4 multiple inheritance */ + SWIGWARN_PHP_MULTIPLE_INHERITANCE) E; /* C#, Java, PHP multiple inheritance */ %inline %{ #if defined(_MSC_VER) diff --git a/Examples/test-suite/allowexcept.i b/Examples/test-suite/allowexcept.i index 14b19b33d..37b01cd75 100644 --- a/Examples/test-suite/allowexcept.i +++ b/Examples/test-suite/allowexcept.i @@ -26,14 +26,26 @@ UVW Bar::static_member_variable; struct XYZ { }; +// The operator& trick doesn't work for SWIG/PHP because the generated code +// takes the address of the variable in the code in the "vinit" section. +#ifdef SWIGPHP %{ struct XYZ { void foo() {} private: XYZ& operator=(const XYZ& other); // prevent assignment used in normally generated set method - XYZ* operator&(); // prevent dereferencing used in normally generated get method }; %} +#else +%{ +struct XYZ { + void foo() {} +private: + XYZ& operator=(const XYZ& other); // prevent assignment used in normally generated set method + XYZ* operator&(); // prevent dereferencing used in normally generated get method +}; +%} +#endif #if defined(SWIGUTL) %exception { /* diff --git a/Examples/test-suite/apply_signed_char.i b/Examples/test-suite/apply_signed_char.i index ff1f1d83f..c0fa00cfe 100644 --- a/Examples/test-suite/apply_signed_char.i +++ b/Examples/test-suite/apply_signed_char.i @@ -31,5 +31,7 @@ const char memberconstchar; virtual ~DirectorTest() {} + private: + DirectorTest& operator=(const DirectorTest &); }; %} diff --git a/Examples/test-suite/bools.i b/Examples/test-suite/bools.i index 40e8989bd..7b94fcf88 100644 --- a/Examples/test-suite/bools.i +++ b/Examples/test-suite/bools.i @@ -57,6 +57,8 @@ struct BoolStructure { m_rbool(m_bool2), m_const_pbool(m_pbool), m_const_rbool(m_rbool) {} +private: + BoolStructure& operator=(const BoolStructure &); }; %} diff --git a/Examples/test-suite/char_strings.i b/Examples/test-suite/char_strings.i index a91afaded..b06eba773 100644 --- a/Examples/test-suite/char_strings.i +++ b/Examples/test-suite/char_strings.i @@ -10,7 +10,7 @@ below. %warnfilter(SWIGWARN_TYPEMAP_CHARLEAK_MSG) global_const_char; // Setting a const char * variable may leak memory. %{ -#define OTHERLAND_MSG "Little message from the the safe world." +#define OTHERLAND_MSG "Little message from the safe world." #define CPLUSPLUS_MSG "A message from the deep dark world of C++, where anything is possible." static char *global_str = NULL; const int UINT_DIGITS = 10; // max unsigned int is 4294967295 diff --git a/Examples/test-suite/chicken/Makefile.in b/Examples/test-suite/chicken/Makefile.in index 0ac37d16a..ef6d7056c 100644 --- a/Examples/test-suite/chicken/Makefile.in +++ b/Examples/test-suite/chicken/Makefile.in @@ -40,7 +40,7 @@ SWIGOPT += -nounit $(setup) +$(swig_and_compile_c) $(run_testcase) - +if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(PROXYSUFFIX) ]; then ( \ + if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(PROXYSUFFIX) ]; then ( \ $(MAKE) $*.cproxy; ) \ fi; @@ -54,7 +54,7 @@ SWIGOPT += -nounit %.externaltest: $(setup) - $(swig_and_compile_external) + +$(swig_and_compile_external) $(run_testcase) # Runs the testcase. A testcase is only run if @@ -69,21 +69,21 @@ run_testcase = \ %.cppproxy: SWIGOPT += -proxy %.cppproxy: SCRIPTSUFFIX = $(PROXYSUFFIX) %.cppproxy: - echo "Checking testcase $* (with run test) under chicken with -proxy" - $(swig_and_compile_cpp) + echo "$(ACTION)ing testcase $* (with run test) under chicken with -proxy" + +$(swig_and_compile_cpp) $(run_testcase) %.cproxy: SWIGOPT += -proxy %.cproxy: SCRIPTSUFFIX = $(PROXYSUFFIX) %.cproxy: - echo "Checking testcase $* (with run test) under chicken with -proxy" + echo "$(ACTION)ing testcase $* (with run test) under chicken with -proxy" +$(swig_and_compile_c) $(run_testcase) %.multiproxy: SWIGOPT += -proxy -noclosuses %.multiproxy: SCRIPTSUFFIX = $(PROXYSUFFIX) %.multiproxy: - echo "Checking testcase $* (with run test) under chicken with -proxy" + echo "$(ACTION)ing testcase $* (with run test) under chicken with -proxy" +$(swig_and_compile_multi_cpp) $(run_testcase) diff --git a/Examples/test-suite/common.mk b/Examples/test-suite/common.mk index 3607a4253..57b57c271 100644 --- a/Examples/test-suite/common.mk +++ b/Examples/test-suite/common.mk @@ -202,6 +202,7 @@ CPP_TEST_CASES += \ inherit_target_language \ inherit_void_arg \ inline_initializer \ + keyword_rename \ kind \ langobj \ li_attribute \ @@ -236,6 +237,7 @@ CPP_TEST_CASES += \ null_pointer \ operator_overload \ operator_overload_break \ + operbool \ ordering \ overload_copy \ overload_extend \ @@ -422,6 +424,7 @@ C_TEST_CASES += \ immutable \ inctest \ integers \ + keyword_rename \ lextype \ li_carrays \ li_cdata \ diff --git a/Examples/test-suite/constant_pointers.i b/Examples/test-suite/constant_pointers.i index 367baf49c..5bd2fd533 100644 --- a/Examples/test-suite/constant_pointers.i +++ b/Examples/test-suite/constant_pointers.i @@ -46,6 +46,8 @@ public: int* array_member1[ARRAY_SIZE]; ParametersTest* array_member2[ARRAY_SIZE]; MemberVariablesTest() : member3(NULL), member4(NULL) {} +private: + MemberVariablesTest& operator=(const MemberVariablesTest&); }; void foo(const int *const i) {} @@ -69,6 +71,8 @@ public: void ret6(int*& a) {} int*& ret7() {return GlobalIntPtr;} ReturnValuesTest() : int3(NULL) {} +private: + ReturnValuesTest& operator=(const ReturnValuesTest&); }; const int* globalRet1() {return &GlobalInt;} @@ -100,6 +104,8 @@ int* const globalRet2() {return &GlobalInt;} A* ap; const A* cap; Acptr acptr; + private: + B& operator=(const B&); }; const B* bar(const B* b) { diff --git a/Examples/test-suite/contract.i b/Examples/test-suite/contract.i index 6ee0a353c..a5732105b 100644 --- a/Examples/test-suite/contract.i +++ b/Examples/test-suite/contract.i @@ -3,7 +3,7 @@ %warnfilter(SWIGWARN_RUBY_MULTIPLE_INHERITANCE, SWIGWARN_JAVA_MULTIPLE_INHERITANCE, SWIGWARN_CSHARP_MULTIPLE_INHERITANCE, - SWIGWARN_PHP4_MULTIPLE_INHERITANCE) C; /* Ruby, C#, Java, Php4 multiple inheritance */ + SWIGWARN_PHP_MULTIPLE_INHERITANCE) C; /* Ruby, C#, Java, PHP multiple inheritance */ #ifdef SWIGCSHARP %ignore B::bar; // otherwise get a warning: `C.bar' no suitable methods found to override diff --git a/Examples/test-suite/cpp_basic.i b/Examples/test-suite/cpp_basic.i index becf84708..a247dd268 100644 --- a/Examples/test-suite/cpp_basic.i +++ b/Examples/test-suite/cpp_basic.i @@ -55,6 +55,8 @@ class Bar { Foo *testFoo(int a, Foo *f) { return new Foo(2 * a + (f ? f->num : 0) + fval.num); } +private: + Bar& operator=(const Bar&); }; %} diff --git a/Examples/test-suite/csharp/Makefile.in b/Examples/test-suite/csharp/Makefile.in index 44a1b3675..5fd576ed8 100644 --- a/Examples/test-suite/csharp/Makefile.in +++ b/Examples/test-suite/csharp/Makefile.in @@ -51,9 +51,9 @@ intermediary_classname.customtest: # Makes a directory for the testcase if it does not exist setup = \ if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \ - echo "Checking testcase $* (with run test) under $(LANGUAGE)" ; \ + echo "$(ACTION)ing testcase $* (with run test) under $(LANGUAGE)" ; \ else \ - echo "Checking testcase $* under $(LANGUAGE)" ; \ + echo "$(ACTION)ing testcase $* under $(LANGUAGE)" ; \ fi; \ if [ ! -d $* ]; then \ mkdir $*; \ diff --git a/Examples/test-suite/csharp/char_strings_runme.cs b/Examples/test-suite/csharp/char_strings_runme.cs index a1e878016..a8907fb16 100644 --- a/Examples/test-suite/csharp/char_strings_runme.cs +++ b/Examples/test-suite/csharp/char_strings_runme.cs @@ -5,7 +5,7 @@ using char_stringsNamespace; public class char_strings_runme { private static string CPLUSPLUS_MSG = "A message from the deep dark world of C++, where anything is possible."; - private static string OTHERLAND_MSG = "Little message from the the safe world."; + private static string OTHERLAND_MSG = "Little message from the safe world."; public static void Main() { diff --git a/Examples/test-suite/csharp/director_basic_runme.cs b/Examples/test-suite/csharp/director_basic_runme.cs new file mode 100644 index 000000000..b9916108c --- /dev/null +++ b/Examples/test-suite/csharp/director_basic_runme.cs @@ -0,0 +1,74 @@ +using System; + +namespace director_basicNamespace { + +public class runme +{ + static void Main() + { + runme r = new runme(); + r.run(); + } + + void run() + { + director_basic_MyFoo a = new director_basic_MyFoo(); + + if (a.ping() != "director_basic_MyFoo::ping()") { + throw new Exception ( "a.ping()" ); + } + + if (a.pong() != "Foo::pong();director_basic_MyFoo::ping()") { + throw new Exception ( "a.pong()" ); + } + + Foo b = new Foo(); + + if (b.ping() != "Foo::ping()") { + throw new Exception ( "b.ping()" ); + } + + if (b.pong() != "Foo::pong();Foo::ping()") { + throw new Exception ( "b.pong()" ); + } + + A1 a1 = new A1(1, false); + a1.Dispose(); + + { + MyOverriddenClass my = new MyOverriddenClass(); + + my.expectNull = true; + if (MyClass.call_pmethod(my, null) != null) + throw new Exception("null pointer marshalling problem"); + + Bar myBar = new Bar(); + my.expectNull = false; + Bar myNewBar = MyClass.call_pmethod(my, myBar); + if (myNewBar == null) + throw new Exception("non-null pointer marshalling problem"); + myNewBar.x = 10; + } + } +} + +class director_basic_MyFoo : Foo { + public director_basic_MyFoo() : base() { + } + + public override string ping() { + return "director_basic_MyFoo::ping()"; + } +} + +class MyOverriddenClass : MyClass { + public bool expectNull = false; + public bool nonNullReceived = false; + public override Bar pmethod(Bar b) { + if ( expectNull && (b != null) ) + throw new Exception("null not received as expected"); + return b; + } +} + +} diff --git a/Examples/test-suite/csharp_prepost.i b/Examples/test-suite/csharp_prepost.i index 9c2cedc83..0c35c1833 100644 --- a/Examples/test-suite/csharp_prepost.i +++ b/Examples/test-suite/csharp_prepost.i @@ -1,6 +1,6 @@ %module csharp_prepost -// Test the pre, post and cshin attributes for csin typemaps +// Test the pre, post, terminate and cshin attributes for csin typemaps %include "std_vector.i" @@ -88,3 +88,102 @@ public: }; %} + + +// test Date marshalling with pre post and terminate typemap attributes (Documented in CSharp.html) +%typemap(cstype) const CDate& "System.DateTime" +%typemap(csin, + pre=" CDate temp$csinput = new CDate($csinput.Year, $csinput.Month, $csinput.Day);" + ) const CDate & + "$csclassname.getCPtr(temp$csinput)" + +%typemap(cstype) CDate& "out System.DateTime" +%typemap(csin, + pre=" CDate temp$csinput = new CDate();", + post=" $csinput = new System.DateTime(temp$csinput.getYear()," + " temp$csinput.getMonth(), temp$csinput.getDay(), 0, 0, 0);", + cshin="out $csinput" + ) CDate & + "$csclassname.getCPtr(temp$csinput)" + + +%inline %{ +class CDate { +public: + CDate(); + CDate(int year, int month, int day); + int getYear(); + int getMonth(); + int getDay(); +private: + int m_year; + int m_month; + int m_day; +}; +struct Action { + int doSomething(const CDate &dateIn, CDate &dateOut); + Action(const CDate &dateIn, CDate& dateOut); +}; +%} + +%{ +Action::Action(const CDate &dateIn, CDate& dateOut) {dateOut = dateIn;} +int Action::doSomething(const CDate &dateIn, CDate &dateOut) { dateOut = dateIn; return 0; } +CDate::CDate() : m_year(0), m_month(0), m_day(0) {} +CDate::CDate(int year, int month, int day) : m_year(year), m_month(month), m_day(day) {} +int CDate::getYear() { return m_year; } +int CDate::getMonth() { return m_month; } +int CDate::getDay() { return m_day; } +%} + +%typemap(cstype, out="System.DateTime") CDate * "ref System.DateTime" + +%typemap(csin, + pre=" CDate temp$csinput = new CDate($csinput.Year, $csinput.Month, $csinput.Day);", + post=" $csinput = new System.DateTime(temp$csinput.getYear()," + " temp$csinput.getMonth(), temp$csinput.getDay(), 0, 0, 0);", + cshin="ref $csinput" + ) CDate * + "$csclassname.getCPtr(temp$csinput)" + +%inline %{ +void addYears(CDate *pDate, int years) { + *pDate = CDate(pDate->getYear() + years, pDate->getMonth(), pDate->getDay()); +} +%} + +%typemap(csin, + pre=" using (CDate temp$csinput = new CDate($csinput.Year, $csinput.Month, $csinput.Day)) {", + post=" $csinput = new System.DateTime(temp$csinput.getYear()," + " temp$csinput.getMonth(), temp$csinput.getDay(), 0, 0, 0);", + terminator=" } // terminate temp$csinput using block", + cshin="ref $csinput" + ) CDate * + "$csclassname.getCPtr(temp$csinput)" + +%inline %{ +void subtractYears(CDate *pDate, int years) { + *pDate = CDate(pDate->getYear() - years, pDate->getMonth(), pDate->getDay()); +} +%} + +%typemap(csvarin, excode=SWIGEXCODE2) CDate * %{ + /* csvarin typemap code */ + set { + CDate temp$csinput = new CDate($csinput.Year, $csinput.Month, $csinput.Day); + $imcall;$excode + } %} + +%typemap(csvarout, excode=SWIGEXCODE2) CDate * %{ + /* csvarout typemap code */ + get { + IntPtr cPtr = $imcall; + CDate tempDate = (cPtr == IntPtr.Zero) ? null : new CDate(cPtr, $owner);$excode + return new System.DateTime(tempDate.getYear(), tempDate.getMonth(), tempDate.getDay(), + 0, 0, 0); + } %} + +%inline %{ +CDate ImportantDate = CDate(1999, 12, 31); +%} + diff --git a/Examples/test-suite/default_constructor.i b/Examples/test-suite/default_constructor.i index 71600e55a..ff22c7834 100644 --- a/Examples/test-suite/default_constructor.i +++ b/Examples/test-suite/default_constructor.i @@ -5,11 +5,11 @@ %warnfilter(SWIGWARN_JAVA_MULTIPLE_INHERITANCE, SWIGWARN_CSHARP_MULTIPLE_INHERITANCE, - SWIGWARN_PHP4_MULTIPLE_INHERITANCE) EB; /* C#, Java, Php4 multiple inheritance */ + SWIGWARN_PHP_MULTIPLE_INHERITANCE) EB; /* C#, Java, PHP multiple inheritance */ %warnfilter(SWIGWARN_JAVA_MULTIPLE_INHERITANCE, SWIGWARN_CSHARP_MULTIPLE_INHERITANCE, - SWIGWARN_PHP4_MULTIPLE_INHERITANCE) AD; /* C#, Java, Php4 multiple inheritance */ + SWIGWARN_PHP_MULTIPLE_INHERITANCE) AD; /* C#, Java, PHP multiple inheritance */ %warnfilter(SWIGWARN_LANG_FRIEND_IGNORE) F; /* friend function */ diff --git a/Examples/test-suite/director_basic.i b/Examples/test-suite/director_basic.i index 986a1706f..12cb0db65 100644 --- a/Examples/test-suite/director_basic.i +++ b/Examples/test-suite/director_basic.i @@ -112,12 +112,14 @@ public: return vmethod(b); } - static MyClass *get_self(MyClass *c) { return c; } - + + static Bar * call_pmethod(MyClass *myclass, Bar *b) { + return myclass->pmethod(b); + } }; template diff --git a/Examples/test-suite/enum_thorough.i b/Examples/test-suite/enum_thorough.i index 4aa0613f2..31e3e2105 100644 --- a/Examples/test-suite/enum_thorough.i +++ b/Examples/test-suite/enum_thorough.i @@ -81,6 +81,8 @@ struct SpeedClass { const colour myColour2; speedtd1 mySpeedtd1; SpeedClass() : myColour2(red), mySpeedtd1(slow) { } +private: + SpeedClass& operator=(const SpeedClass&); }; int speedTest0(int s) { return s; } diff --git a/Examples/test-suite/evil_diamond.i b/Examples/test-suite/evil_diamond.i index 33353e32e..7b2e9152f 100644 --- a/Examples/test-suite/evil_diamond.i +++ b/Examples/test-suite/evil_diamond.i @@ -6,7 +6,7 @@ %warnfilter(SWIGWARN_RUBY_WRONG_NAME, SWIGWARN_JAVA_MULTIPLE_INHERITANCE, SWIGWARN_CSHARP_MULTIPLE_INHERITANCE, - SWIGWARN_PHP4_MULTIPLE_INHERITANCE) spam; // Ruby, wrong class name - C# & Java, Php4 multiple inheritance + SWIGWARN_PHP_MULTIPLE_INHERITANCE) spam; // Ruby, wrong class name - C# & Java, PHP multiple inheritance %inline %{ diff --git a/Examples/test-suite/evil_diamond_ns.i b/Examples/test-suite/evil_diamond_ns.i index 78a764ccc..515044007 100644 --- a/Examples/test-suite/evil_diamond_ns.i +++ b/Examples/test-suite/evil_diamond_ns.i @@ -6,7 +6,7 @@ %warnfilter(SWIGWARN_RUBY_WRONG_NAME, SWIGWARN_JAVA_MULTIPLE_INHERITANCE, SWIGWARN_CSHARP_MULTIPLE_INHERITANCE, - SWIGWARN_PHP4_MULTIPLE_INHERITANCE) Blah::spam; // Ruby, wrong class name - C# & Java, Php4 multiple inheritance + SWIGWARN_PHP_MULTIPLE_INHERITANCE) Blah::spam; // Ruby, wrong class name - C# & Java, PHP multiple inheritance %inline %{ namespace Blah { diff --git a/Examples/test-suite/evil_diamond_prop.i b/Examples/test-suite/evil_diamond_prop.i index e9fc24f4d..804ea66b4 100644 --- a/Examples/test-suite/evil_diamond_prop.i +++ b/Examples/test-suite/evil_diamond_prop.i @@ -6,7 +6,7 @@ %warnfilter(SWIGWARN_RUBY_WRONG_NAME, SWIGWARN_JAVA_MULTIPLE_INHERITANCE, SWIGWARN_CSHARP_MULTIPLE_INHERITANCE, - SWIGWARN_PHP4_MULTIPLE_INHERITANCE) spam; // Ruby, wrong class name - C# & Java, Php4 multiple inheritance + SWIGWARN_PHP_MULTIPLE_INHERITANCE) spam; // Ruby, wrong class name - C# & Java, PHP multiple inheritance %inline %{ diff --git a/Examples/test-suite/fvirtual.i b/Examples/test-suite/fvirtual.i index 074202bee..af189ed1f 100644 --- a/Examples/test-suite/fvirtual.i +++ b/Examples/test-suite/fvirtual.i @@ -10,11 +10,11 @@ virtual ~Node() {} }; - class Switch : public Node { + class NodeSwitch : public Node { public : virtual int addChild( Node *child ) { return 2; } // This was hidden with -fvirtual virtual int addChild( Node *child, bool value ) { return 3; } - virtual ~Switch() {} + virtual ~NodeSwitch() {} }; %} diff --git a/Examples/test-suite/guilescm/Makefile.in b/Examples/test-suite/guilescm/Makefile.in index 285426ee8..04de236db 100644 --- a/Examples/test-suite/guilescm/Makefile.in +++ b/Examples/test-suite/guilescm/Makefile.in @@ -21,9 +21,9 @@ run_testcase = \ setup = \ if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \ - echo "Checking testcase $* (with run test) under $(LANGUAGE) (with SCM API)" ; \ + echo "$(ACTION)ing testcase $* (with run test) under $(LANGUAGE) (with SCM API)" ; \ else \ - echo "Checking testcase $* under $(LANGUAGE) (with SCM API)" ; \ + echo "$(ACTION)ing testcase $* under $(LANGUAGE) (with SCM API)" ; \ fi; swig_and_compile_multi_cpp = \ @@ -43,9 +43,9 @@ swig_and_compile_multi_cpp = \ # Same as setup and run_testcase, but without the SCRIPTPREFIX (so the runme comes from the guilescm directory) local_setup = \ if [ -f $(srcdir)/$*$(SCRIPTSUFFIX) ]; then \ - echo "Checking testcase $* (with run test) under $(LANGUAGE) (with SCM API)" ; \ + echo "$(ACTION)ing testcase $* (with run test) under $(LANGUAGE) (with SCM API)" ; \ else \ - echo "Checking testcase $* under $(LANGUAGE) (with SCM API)" ; \ + echo "$(ACTION)ing testcase $* under $(LANGUAGE) (with SCM API)" ; \ fi; local_run_testcase = \ diff --git a/Examples/test-suite/java/Makefile.in b/Examples/test-suite/java/Makefile.in index 53816f6d0..ace8dee86 100644 --- a/Examples/test-suite/java/Makefile.in +++ b/Examples/test-suite/java/Makefile.in @@ -57,9 +57,9 @@ SWIGOPT += -package $* # Makes a directory for the testcase if it does not exist setup = \ if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \ - echo "Checking testcase $* (with run test) under $(LANGUAGE)" ; \ + echo "$(ACTION)ing testcase $* (with run test) under $(LANGUAGE)" ; \ else \ - echo "Checking testcase $* under $(LANGUAGE)" ; \ + echo "$(ACTION)ing testcase $* under $(LANGUAGE)" ; \ fi; \ if [ ! -d $* ]; then \ mkdir $*; \ diff --git a/Examples/test-suite/java/char_strings_runme.java b/Examples/test-suite/java/char_strings_runme.java index 2e62080f5..2c71d3ea7 100644 --- a/Examples/test-suite/java/char_strings_runme.java +++ b/Examples/test-suite/java/char_strings_runme.java @@ -12,7 +12,7 @@ public class char_strings_runme { } private static String CPLUSPLUS_MSG = "A message from the deep dark world of C++, where anything is possible."; - private static String OTHERLAND_MSG = "Little message from the the safe world."; + private static String OTHERLAND_MSG = "Little message from the safe world."; public static void main(String argv[]) { diff --git a/Examples/test-suite/java/director_basic_runme.java b/Examples/test-suite/java/director_basic_runme.java index eafe20bec..16a46aa35 100644 --- a/Examples/test-suite/java/director_basic_runme.java +++ b/Examples/test-suite/java/director_basic_runme.java @@ -14,28 +14,43 @@ public class director_basic_runme { public static void main(String argv[]) { - director_basic_MyFoo a = new director_basic_MyFoo(); + director_basic_MyFoo a = new director_basic_MyFoo(); - if (!a.ping().equals("director_basic_MyFoo::ping()")) { - throw new RuntimeException ( "a.ping()" ); - } + if (!a.ping().equals("director_basic_MyFoo::ping()")) { + throw new RuntimeException ( "a.ping()" ); + } - if (!a.pong().equals("Foo::pong();director_basic_MyFoo::ping()")) { - throw new RuntimeException ( "a.pong()" ); - } + if (!a.pong().equals("Foo::pong();director_basic_MyFoo::ping()")) { + throw new RuntimeException ( "a.pong()" ); + } - Foo b = new Foo(); + Foo b = new Foo(); - if (!b.ping().equals("Foo::ping()")) { - throw new RuntimeException ( "b.ping()" ); - } + if (!b.ping().equals("Foo::ping()")) { + throw new RuntimeException ( "b.ping()" ); + } - if (!b.pong().equals("Foo::pong();Foo::ping()")) { - throw new RuntimeException ( "b.pong()" ); - } + if (!b.pong().equals("Foo::pong();Foo::ping()")) { + throw new RuntimeException ( "b.pong()" ); + } - A1 a1 = new A1(1, false); - a1.delete(); + A1 a1 = new A1(1, false); + a1.delete(); + + { + MyOverriddenClass my = new MyOverriddenClass(); + + my.expectNull = true; + if (MyClass.call_pmethod(my, null) != null) + throw new RuntimeException("null pointer marshalling problem"); + + Bar myBar = new Bar(); + my.expectNull = false; + Bar myNewBar = MyClass.call_pmethod(my, myBar); + if (myNewBar == null) + throw new RuntimeException("non-null pointer marshalling problem"); + myNewBar.setX(10); + } } } @@ -45,3 +60,13 @@ class director_basic_MyFoo extends Foo { } } +class MyOverriddenClass extends MyClass { + public boolean expectNull = false; + public boolean nonNullReceived = false; + public Bar pmethod(Bar b) { + if ( expectNull && (b != null) ) + throw new RuntimeException("null not received as expected"); + return b; + } +} + diff --git a/Examples/test-suite/java_typemaps_proxy.i b/Examples/test-suite/java_typemaps_proxy.i index 5a1e61bb2..e315a36b5 100644 --- a/Examples/test-suite/java_typemaps_proxy.i +++ b/Examples/test-suite/java_typemaps_proxy.i @@ -119,6 +119,8 @@ public: void const_member_method(const ConstWithout *p) const {} const ConstWithout * const_var; const ConstWithout * const var_const; +private: + ConstWithout& operator=(const ConstWithout &); }; const ConstWithout * global_constwithout = 0; void global_method_constwithout(const ConstWithout *p) {} diff --git a/Examples/test-suite/keyword_rename.i b/Examples/test-suite/keyword_rename.i new file mode 100644 index 000000000..da9328868 --- /dev/null +++ b/Examples/test-suite/keyword_rename.i @@ -0,0 +1,32 @@ +/* + * Test reserved keyword renaming + */ + +%module keyword_rename + +#pragma SWIG nowarn=SWIGWARN_PARSE_KEYWORD + +%inline %{ + +#define KW(x, y) int x (int y) { return y; } + +/* Python keywords */ +KW(in, except) +KW(except, in) +KW(pass, in) + +/* Perl keywords */ +KW(tie, die) +KW(use, next) + +/* Java keywords */ +KW(implements, native) +KW(synchronized, final) + +/* C# Keywords */ +KW(string, out) +struct sealed {int i;}; + +%} + + diff --git a/Examples/test-suite/li_cstring.i b/Examples/test-suite/li_cstring.i index fd92ac7d3..28e8049e8 100644 --- a/Examples/test-suite/li_cstring.i +++ b/Examples/test-suite/li_cstring.i @@ -4,7 +4,7 @@ #ifndef SWIG_CSTRING_UNIMPL -%cstring_input_binary(char *in, int n); +%cstring_input_binary(char *str_in, int n); %cstring_bounded_output(char *out1, 512); %cstring_chunk_output(char *out2, 64); %cstring_bounded_mutable(char *out3, 512); @@ -22,13 +22,13 @@ %inline %{ -int count(char *in, int n, char c) { +int count(char *str_in, int n, char c) { int r = 0; while (n > 0) { - if (*in == c) { + if (*str_in == c) { r++; } - in++; + str_in++; --n; } return r; diff --git a/Examples/test-suite/li_cwstring.i b/Examples/test-suite/li_cwstring.i index dc9a1c4b9..769dcce12 100644 --- a/Examples/test-suite/li_cwstring.i +++ b/Examples/test-suite/li_cwstring.i @@ -4,7 +4,7 @@ #ifndef SWIG_CWSTRING_UNIMPL -%cwstring_input_binary(wchar_t *in, int n); +%cwstring_input_binary(wchar_t *str_in, int n); %cwstring_bounded_output(wchar_t *out1, 512); %cwstring_chunk_output(wchar_t *out2, 64); %cwstring_bounded_mutable(wchar_t *out3, 512); @@ -22,13 +22,13 @@ %inline %{ -int count(wchar_t *in, int n, wchar_t c) { +int count(wchar_t *str_in, int n, wchar_t c) { int r = 0; while (n > 0) { - if (*in == c) { + if (*str_in == c) { r++; } - in++; + str_in++; --n; } return r; diff --git a/Examples/test-suite/li_std_string.i b/Examples/test-suite/li_std_string.i index 8c2f1b857..2d0b7503d 100644 --- a/Examples/test-suite/li_std_string.i +++ b/Examples/test-suite/li_std_string.i @@ -129,7 +129,7 @@ public: %} %inline %{ - std::string empty() { + std::string stdstring_empty() { return std::string(); } diff --git a/Examples/test-suite/lua/li_typemaps_runme.lua b/Examples/test-suite/lua/li_typemaps_runme.lua new file mode 100644 index 000000000..77aeb54e4 --- /dev/null +++ b/Examples/test-suite/lua/li_typemaps_runme.lua @@ -0,0 +1,40 @@ +require("import") -- the import fn +import("li_typemaps") -- import code + +-- catch "undefined" global variables +setmetatable(getfenv(),{__index=function (t,i) error("undefined global variable `"..i.."'",2) end}) + +-- Check double INPUT typemaps +assert(li_typemaps.in_double(22.22) == 22.22) +assert(li_typemaps.inr_double(22.22) == 22.22) + +-- Check double OUTPUT typemaps +assert(li_typemaps.out_double(22.22) == 22.22) +assert(li_typemaps.outr_double(22.22) == 22.22) + +-- Check double INOUT typemaps +assert(li_typemaps.inout_double(22.22) == 22.22) +assert(li_typemaps.inoutr_double(22.22) == 22.22) + +-- check long long +assert(li_typemaps.in_ulonglong(20)==20) +assert(li_typemaps.inr_ulonglong(20)==20) +assert(li_typemaps.out_ulonglong(20)==20) +assert(li_typemaps.outr_ulonglong(20)==20) +assert(li_typemaps.inout_ulonglong(20)==20) +assert(li_typemaps.inoutr_ulonglong(20)==20) + +-- check bools +assert(li_typemaps.in_bool(true)==true) +assert(li_typemaps.inr_bool(false)==false) +assert(li_typemaps.out_bool(true)==true) +assert(li_typemaps.outr_bool(false)==false) +assert(li_typemaps.inout_bool(true)==true) +assert(li_typemaps.inoutr_bool(false)==false) + +-- the others +a,b=li_typemaps.inoutr_int2(1,2) +assert(a==1 and b==2) + +f,i=li_typemaps.out_foo(10) +assert(f.a==10 and i==20) diff --git a/Examples/test-suite/minherit.i b/Examples/test-suite/minherit.i index aba299387..24092b6c6 100644 --- a/Examples/test-suite/minherit.i +++ b/Examples/test-suite/minherit.i @@ -6,7 +6,7 @@ %module(ruby_minherit="1") minherit -#if defined(SWIGPYTHON) || defined(SWIGRUBY) || defined(SWIGOCAML) || defined(SWIGOCTAVE) +#if defined(SWIGPYTHON) || defined(SWIGRUBY) || defined(SWIGOCAML) || defined(SWIGOCTAVE) || defined(SWIGPERL) %inline %{ diff --git a/Examples/test-suite/minherit2.i b/Examples/test-suite/minherit2.i index f55131ff5..1bca4fc48 100644 --- a/Examples/test-suite/minherit2.i +++ b/Examples/test-suite/minherit2.i @@ -7,7 +7,7 @@ %warnfilter(SWIGWARN_JAVA_MULTIPLE_INHERITANCE, SWIGWARN_CSHARP_MULTIPLE_INHERITANCE, SWIGWARN_RUBY_MULTIPLE_INHERITANCE, - SWIGWARN_PHP4_MULTIPLE_INHERITANCE) RemoteMpe; + SWIGWARN_PHP_MULTIPLE_INHERITANCE) RemoteMpe; #if defined(SWIGJAVA) || defined(SWIGCSHARP) diff --git a/Examples/test-suite/multiple_inheritance.i b/Examples/test-suite/multiple_inheritance.i index 1c4458114..1fc68eef9 100644 --- a/Examples/test-suite/multiple_inheritance.i +++ b/Examples/test-suite/multiple_inheritance.i @@ -5,11 +5,11 @@ It tests basic multiple inheritance */ %warnfilter(SWIGWARN_JAVA_MULTIPLE_INHERITANCE, SWIGWARN_CSHARP_MULTIPLE_INHERITANCE, - SWIGWARN_PHP4_MULTIPLE_INHERITANCE) FooBar; /* C#, Java, Php4 multiple inheritance */ + SWIGWARN_PHP_MULTIPLE_INHERITANCE) FooBar; /* C#, Java, PHP multiple inheritance */ %warnfilter(SWIGWARN_JAVA_MULTIPLE_INHERITANCE, SWIGWARN_CSHARP_MULTIPLE_INHERITANCE, - SWIGWARN_PHP4_MULTIPLE_INHERITANCE) FooBarSpam; /* C#, Java, Php4 multiple inheritance */ + SWIGWARN_PHP_MULTIPLE_INHERITANCE) FooBarSpam; /* C#, Java, PHP multiple inheritance */ %inline %{ diff --git a/Examples/test-suite/name_warnings.i b/Examples/test-suite/name_warnings.i index a9cb35686..527dbcfaa 100644 --- a/Examples/test-suite/name_warnings.i +++ b/Examples/test-suite/name_warnings.i @@ -58,13 +58,12 @@ namespace std %template(max_i) max; - %inline { /* silently rename the parameter names in csharp/java */ #ifdef SWIGR double foo(double inparam, double out) { return 1.0; } #else - double foo(double in, double out) { return 1.0; } + double foo(double abstract, double out) { return 1.0; } #endif double bar(double native, bool boolean) { return 1.0; } } diff --git a/Examples/test-suite/namespace_typemap.i b/Examples/test-suite/namespace_typemap.i index e4e0af905..984b93a6f 100644 --- a/Examples/test-suite/namespace_typemap.i +++ b/Examples/test-suite/namespace_typemap.i @@ -75,7 +75,7 @@ namespace test { class string_class; #ifdef SWIGPYTHON %typemap(in) string_class * { - $1 = new string_class(PyString_AsString($input)); + $1 = new string_class(SWIG_Python_str_AsChar($input)); } %typemap(freearg) string_class * { delete $1; diff --git a/Examples/test-suite/octave/fvirtual_runme.m b/Examples/test-suite/octave/fvirtual_runme.m index 06c6e7ccb..e755a559a 100644 --- a/Examples/test-suite/octave/fvirtual_runme.m +++ b/Examples/test-suite/octave/fvirtual_runme.m @@ -1,6 +1,6 @@ fvirtual -sw = Switch(); +sw = NodeSwitch(); n = Node(); i = sw.addChild(n); diff --git a/Examples/test-suite/octave/li_std_string_runme.m b/Examples/test-suite/octave/li_std_string_runme.m index 1c24ac344..fa0e260e0 100644 --- a/Examples/test-suite/octave/li_std_string_runme.m +++ b/Examples/test-suite/octave/li_std_string_runme.m @@ -148,7 +148,7 @@ if (s != "hellohello") endif -if (li_std_string.empty() != "") +if (li_std_string.stdstring_empty() != "") error endif diff --git a/Examples/test-suite/operbool.i b/Examples/test-suite/operbool.i new file mode 100644 index 000000000..d6d7fc706 --- /dev/null +++ b/Examples/test-suite/operbool.i @@ -0,0 +1,10 @@ +%module operbool + +%inline %{ + class Test { + public: + operator bool() { + return false; + } + }; +%} diff --git a/Examples/test-suite/perl5/li_std_string_runme.pl b/Examples/test-suite/perl5/li_std_string_runme.pl index 0ee11bdc7..9ec7dd08c 100644 --- a/Examples/test-suite/perl5/li_std_string_runme.pl +++ b/Examples/test-suite/perl5/li_std_string_runme.pl @@ -98,7 +98,7 @@ SKIP: { is($gen1->testl("9234567890121111113"), "9234567890121111114", "ulonglong big number"); -is(li_std_string::empty(), "", "empty"); +is(li_std_string::stdstring_empty(), "", "stdstring_empty"); is(li_std_string::c_empty(), "", "c_empty"); @@ -110,4 +110,4 @@ is(li_std_string::get_null(li_std_string::c_null()), undef, "c_empty"); is(li_std_string::get_null(li_std_string::c_empty()), "non-null", "c_empty"); -is(li_std_string::get_null(li_std_string::empty()), "non-null", "c_empty"); +is(li_std_string::get_null(li_std_string::stdstring_empty()), "non-null", "stdstring_empty"); diff --git a/Examples/test-suite/perl5/li_typemaps_runme.pl b/Examples/test-suite/perl5/li_typemaps_runme.pl index c149284ae..c182cdbb1 100644 --- a/Examples/test-suite/perl5/li_typemaps_runme.pl +++ b/Examples/test-suite/perl5/li_typemaps_runme.pl @@ -37,24 +37,29 @@ batch('ulong', 0, 1, 12, 0xffffffff); batch('uchar', 0, 1, 12, 0xff); batch('schar', -0x80, 0, 1, 12, 0x7f); -# IEEE 754 machine, please! -batch('float', - -(2 - 2 ** -23) * 2 ** 127, - -1, -2 ** -149, 0, 2 ** -149, 1, - (2 - 2 ** -23) * 2 ** 127, - 'nan'); -{ local $TODO = "shouldn't some Inf <=> float work?"; - # I'm going to guess that it could work reasonably as - # NV Inf => float Inf - # float Inf => NV NaN - # but this needs some thought. - batch('float', 'inf'); +{ + use Math::BigInt qw(); + # the pack dance is to get plain old NVs out of the + # Math::BigInt objects. + my $inf = unpack 'd', pack 'd', Math::BigInt->binf(); + my $nan = unpack 'd', pack 'd', Math::BigInt->bnan(); + batch('float', + -(2 - 2 ** -23) * 2 ** 127, + -1, -2 ** -149, 0, 2 ** -149, 1, + (2 - 2 ** -23) * 2 ** 127, + $nan); + { local $TODO = "float typemaps don't pass infinity"; + # it seems as though SWIG is unwilling to pass infinity around + # because that value always fails bounds checking. I think that + # is a bug. + batch('float', $inf); + } + batch('double', + -(2 - 2 ** -53) ** 1023, + -1, -2 ** -1074, 0, 2 ** 1074, + (2 - 2 ** -53) ** 1023, + $nan, $inf); } -batch('double', - -(2 - 2 ** -53) ** 1023, - -1, -2 ** -1074, 0, 2 ** 1074, - (2 - 2 ** -53) ** 1023, - 'nan', 'inf'); batch('longlong', -1, 0, 1, 12); batch('ulonglong', 0, 1, 12); SKIP: { diff --git a/Examples/test-suite/perl5/run-perl-test.pl b/Examples/test-suite/perl5/run-perl-test.pl index f0e1b0288..106bf002b 100755 --- a/Examples/test-suite/perl5/run-perl-test.pl +++ b/Examples/test-suite/perl5/run-perl-test.pl @@ -7,7 +7,7 @@ use strict; my $command = shift @ARGV; -my $output = `perl $command 2>&1`; +my $output = `$^X $command 2>&1`; die "SWIG Perl test failed: \n\n$output\n" if $?; diff --git a/Examples/test-suite/php4/Makefile.in b/Examples/test-suite/php4/Makefile.in index dbd239964..2e14ef9a2 100644 --- a/Examples/test-suite/php4/Makefile.in +++ b/Examples/test-suite/php4/Makefile.in @@ -42,17 +42,17 @@ missingtests: missingcpptests missingctests %.cpptest: $(setup) +$(swig_and_compile_cpp) - $(run_testcase) + +$(run_testcase) %.ctest: $(setup) +$(swig_and_compile_c) - $(run_testcase) + +$(run_testcase) %.multicpptest: $(setup) +$(swig_and_compile_multi_cpp) - $(run_testcase) + +$(run_testcase) # Runs the testcase. A testcase is only run if # a file is found which has _runme.php4 appended after the testcase name. diff --git a/Examples/test-suite/php4/tests.php4 b/Examples/test-suite/php4/tests.php4 index ae43398df..36e9f4163 100644 --- a/Examples/test-suite/php4/tests.php4 +++ b/Examples/test-suite/php4/tests.php4 @@ -67,7 +67,7 @@ class check { } function classname($string,$object) { - if ($string!=($classname=get_class($object))) return check::fail("Object: $object is of class %s not class %s",$classname,$string); + if (strtolower($string)!=strtolower($classname=get_class($object))) return check::fail("Object: \$object is of class %s not class %s",$classname,$string); return TRUE; } diff --git a/Examples/test-suite/pure_virtual.i b/Examples/test-suite/pure_virtual.i index b41e48a89..aab9741a9 100644 --- a/Examples/test-suite/pure_virtual.i +++ b/Examples/test-suite/pure_virtual.i @@ -9,7 +9,7 @@ %warnfilter(SWIGWARN_JAVA_MULTIPLE_INHERITANCE, SWIGWARN_CSHARP_MULTIPLE_INHERITANCE, - SWIGWARN_PHP4_MULTIPLE_INHERITANCE) E; /* C#, Java, Php4 multiple inheritance */ + SWIGWARN_PHP_MULTIPLE_INHERITANCE) E; /* C#, Java, PHP multiple inheritance */ %nodefaultctor C; %nodefaultdtor C; diff --git a/Examples/test-suite/python/Makefile.in b/Examples/test-suite/python/Makefile.in index 7f11cd495..a3a027453 100644 --- a/Examples/test-suite/python/Makefile.in +++ b/Examples/test-suite/python/Makefile.in @@ -2,14 +2,41 @@ # Makefile for python test-suite ####################################################################### +ifeq (,$(PY3)) + PYBIN = @PYTHON@ +else + PYBIN = @PYTHON3@ +endif + LANGUAGE = python -PYTHON = @PYTHON@ -SCRIPTSUFFIX = _runme.py +ifneq (,$(USE_VALGRIND)) + PYTHON = valgrind --leak-check=full --suppressions=pyswig.supp $(PYBIN) +else + PYTHON = $(PYBIN) +endif + +#*_runme.py for Python 2.x, *_runme3.py for Python 3.x +PY2SCRIPTSUFFIX = _runme.py +PY3SCRIPTSUFFIX = _runme3.py + +ifeq (,$(PY3)) + SCRIPTSUFFIX = $(PY2SCRIPTSUFFIX) +else + SCRIPTSUFFIX = $(PY3SCRIPTSUFFIX) +endif + srcdir = @srcdir@ top_srcdir = @top_srcdir@ top_builddir = @top_builddir@ + +#Use the tricky command because we want to disable the "import" fixer, +#but currently 2to3 has no option to let us do it +PY2TO3 = 2to3 `2to3 -l | grep -v -E "Available|import$$" | awk '{print "-f "$$0}'` + + CPP_TEST_CASES += \ + abstractbase \ argcargvtest \ autodoc \ callback \ @@ -77,12 +104,35 @@ VALGRIND_OPT += --suppressions=pythonswig.supp +$(swig_and_compile_multi_cpp) $(run_testcase) + +# Call 2to3 to generate Python 3.x test from the Python 2.x's *_runme.py file +%$(PY3SCRIPTSUFFIX): %$(PY2SCRIPTSUFFIX) + cp $< $@ + $(PY2TO3) -w $@ >/dev/null 2>&1 + + # Runs the testcase. A testcase is only run if -# a file is found which has _runme.py appended after the testcase name. +# a file is found which has _runme.py (or _runme3.py for Python 3) appended after the testcase name. + +run_python = env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH PYTHONPATH=$(srcdir):$$PYTHONPATH $(RUNTOOL) $(PYTHON) $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) + +ifeq (,$(PY3)) run_testcase = \ if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then ( \ - env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH PYTHONPATH=$(srcdir):$$PYTHONPATH $(RUNTOOL) $(PYTHON) $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX);) \ + $(run_python);)\ fi; +else +py2_runme = $(srcdir)/$(SCRIPTPREFIX)$*$(PY2SCRIPTSUFFIX) +py3_runme = $(srcdir)/$(SCRIPTPREFIX)$*$(PY3SCRIPTSUFFIX) + +run_testcase = \ + if [ -f $(py2_runme) ]; then ( \ + $(MAKE) -f $(srcdir)/Makefile $(py3_runme) && \ + $(run_python);) \ + elif [ -f $(py3_runme)]; then ( \ + $(run_python);) \ + fi; +endif # Clean: remove the generated .py file %.clean: @@ -101,14 +151,15 @@ cvsignore: @echo clientdata_prop_b.py @echo imports_a.py @echo imports_b.py - @echo mod_a.py mod_b.py + @echo mod_a.py mod_b.py @echo hugemod.h hugemod_a.i hugemod_b.i hugemod_a.py hugemod_b.py hugemod_runme.py @echo template_typedef_import.py +hugemod_runme = hugemod$(SCRIPTPREFIX) hugemod: - perl hugemod.pl + perl hugemod.pl $(hugemod_runme) $(MAKE) hugemod_a.cpptest $(MAKE) hugemod_b.cpptest - time $(PYTHON) hugemod_runme.py - time $(PYTHON) hugemod_runme.py + sh -c "time $(PYTHON) $(hugemod_runme)" + sh -c "time $(PYTHON) $(hugemod_runme)" diff --git a/Examples/test-suite/python/README b/Examples/test-suite/python/README index b86ec5289..71db759b5 100644 --- a/Examples/test-suite/python/README +++ b/Examples/test-suite/python/README @@ -1,4 +1,8 @@ See ../README for common README file. -Any testcases which have _runme.py appended after the testcase name will be detected and run. +Any testcases which have _runme.py (or _runme3.py for Python 3) appended after the testcase name will be detected and run. +If you intend to write a testcase for both Python 2.x and 3.x, do *not* directly put the _runme3.py in this directory. Just write Python 2.x's _runme.py testcase and it will be automatically converted to Python 3 code during test. + +You can run make with PY3=y to run test case with Python 3.x, eg. + $ make voidtest.cpptest PY3=y diff --git a/Examples/test-suite/python/abstractbase.i b/Examples/test-suite/python/abstractbase.i new file mode 100644 index 000000000..530f21921 --- /dev/null +++ b/Examples/test-suite/python/abstractbase.i @@ -0,0 +1,18 @@ +%module abstractbase +%include +%include +%include +%include +%include +%include +%include + +namespace std +{ + %template(Mapii) map; + %template(Multimapii) multimap; + %template(IntSet) set; + %template(IntMultiset) multiset; + %template(IntVector) vector; + %template(IntList) list; +} diff --git a/Examples/test-suite/python/abstractbase_runme3.py b/Examples/test-suite/python/abstractbase_runme3.py new file mode 100644 index 000000000..13a87ee5e --- /dev/null +++ b/Examples/test-suite/python/abstractbase_runme3.py @@ -0,0 +1,8 @@ +from abstractbase import * +from collections import * +assert issubclass(Mapii, MutableMapping) +assert issubclass(Multimapii, MutableMapping) +assert issubclass(IntSet, MutableSet) +assert issubclass(IntMultiset, MutableSet) +assert issubclass(IntVector, MutableSequence) +assert issubclass(IntList, MutableSequence) diff --git a/Examples/test-suite/python/cpp_namespace_runme.py b/Examples/test-suite/python/cpp_namespace_runme.py index 3108b4f47..a454774f5 100644 --- a/Examples/test-suite/python/cpp_namespace_runme.py +++ b/Examples/test-suite/python/cpp_namespace_runme.py @@ -3,20 +3,20 @@ import cpp_namespace n = cpp_namespace.fact(4) if n != 24: - raise "Bad return value!" + raise RuntimeError("Bad return value!") if cpp_namespace.cvar.Foo != 42: - raise "Bad variable value!" + raise RuntimeError("Bad variable value!") t = cpp_namespace.Test() if t.method() != "Test::method": - raise "Bad method return value!" + raise RuntimeError("Bad method return value!") if cpp_namespace.do_method(t) != "Test::method": - raise "Bad return value!" + raise RuntimeError("Bad return value!") if cpp_namespace.do_method2(t) != "Test::method": - raise "Bad return value!" + raise RuntimeError("Bad return value!") cpp_namespace.weird("hello", 4) @@ -28,18 +28,18 @@ t4 = cpp_namespace.Test4() t5 = cpp_namespace.Test5() if cpp_namespace.foo3(42) != 42: - raise "Bad return value!" + raise RuntimeError("Bad return value!") if cpp_namespace.do_method3(t2,40) != "Test2::method": - raise "Bad return value!" + raise RuntimeError("Bad return value!") if cpp_namespace.do_method3(t3,40) != "Test3::method": - raise "Bad return value!" + raise RuntimeError("Bad return value!") if cpp_namespace.do_method3(t4,40) != "Test4::method": - raise "Bad return value!" + raise RuntimeError("Bad return value!") if cpp_namespace.do_method3(t5,40) != "Test5::method": - raise "Bad return value!" + raise RuntimeError("Bad return value!") diff --git a/Examples/test-suite/python/director_classic_runme.py b/Examples/test-suite/python/director_classic_runme.py index 878905679..7e18a9a61 100644 --- a/Examples/test-suite/python/director_classic_runme.py +++ b/Examples/test-suite/python/director_classic_runme.py @@ -1,56 +1,56 @@ from director_classic import * class TargetLangPerson(Person): - def __init__(self): - Person.__init__(self) - def id(self): - identifier = "TargetLangPerson" - return identifier + def __init__(self): + Person.__init__(self) + def id(self): + identifier = "TargetLangPerson" + return identifier class TargetLangChild(Child): - def __init__(self): - Child.__init__(self) - def id(self): - identifier = "TargetLangChild" - return identifier + def __init__(self): + Child.__init__(self) + def id(self): + identifier = "TargetLangChild" + return identifier class TargetLangGrandChild(GrandChild): - def __init__(self): - GrandChild.__init__(self) - def id(self): - identifier = "TargetLangGrandChild" - return identifier + def __init__(self): + GrandChild.__init__(self) + def id(self): + identifier = "TargetLangGrandChild" + return identifier # Semis - don't override id() in target language class TargetLangSemiPerson(Person): - def __init__(self): - Person.__init__(self) + def __init__(self): + Person.__init__(self) # No id() override class TargetLangSemiChild(Child): - def __init__(self): - Child.__init__(self) + def __init__(self): + Child.__init__(self) # No id() override class TargetLangSemiGrandChild(GrandChild): - def __init__(self): - GrandChild.__init__(self) + def __init__(self): + GrandChild.__init__(self) # No id() override # Orphans - don't override id() in C++ class TargetLangOrphanPerson(OrphanPerson): - def __init__(self): - OrphanPerson.__init__(self) - def id(self): - identifier = "TargetLangOrphanPerson" - return identifier + def __init__(self): + OrphanPerson.__init__(self) + def id(self): + identifier = "TargetLangOrphanPerson" + return identifier class TargetLangOrphanChild(OrphanChild): - def __init__(self): - Child.__init__(self) - def id(self): - identifier = "TargetLangOrphanChild" - return identifier + def __init__(self): + Child.__init__(self) + def id(self): + identifier = "TargetLangOrphanChild" + return identifier def check(person, expected): @@ -61,7 +61,7 @@ def check(person, expected): if (debug): print(ret) if (ret != expected): - raise ("Failed. Received: " + ret + " Expected: " + expected) + raise RuntimeError("Failed. Received: " + str(ret) + " Expected: " + expected) # Polymorphic call from C++ caller = Caller() @@ -70,7 +70,7 @@ def check(person, expected): if (debug): print(ret) if (ret != expected): - raise ("Failed. Received: " + ret + " Expected: " + expected) + raise RuntimeError("Failed. Received: " + str(ret) + " Expected: " + expected) # Polymorphic call of object created in target language and passed to C++ and back again baseclass = caller.baseClass() @@ -78,7 +78,7 @@ def check(person, expected): if (debug): print(ret) if (ret != expected): - raise ("Failed. Received: " + ret + " Expected: " + expected) + raise RuntimeError("Failed. Received: " + str(ret)+ " Expected: " + expected) caller.resetCallback() if (debug): diff --git a/Examples/test-suite/python/director_exception_runme.py b/Examples/test-suite/python/director_exception_runme.py index 7c9e69250..ef7a044f1 100644 --- a/Examples/test-suite/python/director_exception_runme.py +++ b/Examples/test-suite/python/director_exception_runme.py @@ -1,5 +1,8 @@ from director_exception import * -from exceptions import * + +class MyException(Exception): + def __init__(self, a, b): + self.msg = a + b class MyFoo(Foo): def ping(self): @@ -7,39 +10,62 @@ class MyFoo(Foo): class MyFoo2(Foo): def ping(self): - return true + return True pass # error: should return a string -ok = 0 +class MyFoo3(Foo): + def ping(self): + raise MyException("foo", "bar") +# Check that the NotImplementedError raised by MyFoo.ping() is returned by +# MyFoo.pong(). +ok = 0 a = MyFoo() b = launder(a) - try: b.pong() except NotImplementedError, e: - ok = 1 + if str(e) == "MyFoo::ping() EXCEPTION": + ok = 1 + else: + print "Unexpected error message: %s" % str(e) except: pass - if not ok: raise RuntimeError -ok = 0 +# Check that the director returns the appropriate TypeError if the return type +# is wrong. +ok = 0 a = MyFoo2() b = launder(a) - try: b.pong() -except: - ok = 1 - - +except TypeError, e: + if str(e) == "Swig director type mismatch in output value of type 'std::string'": + ok = 1 + else: + print "Unexpected error message: %s" % str(e) if not ok: raise RuntimeError +# Check that the director can return an exception which requires two arguments +# to the constructor, without mangling it. +ok = 0 +a = MyFoo3() +b = launder(a) +try: + b.pong() +except MyException, e: + if e.msg == 'foobar': + ok = 1 + else: + print "Unexpected error message: %s" % str(e) +if not ok: + raise RuntimeError + try: raise Exception2() except Exception2: diff --git a/Examples/test-suite/python/file_test_runme.py b/Examples/test-suite/python/file_test_runme.py index 64154c619..de4e2669e 100644 --- a/Examples/test-suite/python/file_test_runme.py +++ b/Examples/test-suite/python/file_test_runme.py @@ -1,7 +1,8 @@ import sys import file_test -file_test.nfile(sys.stdout) +if sys.version_info < (3,0): + file_test.nfile(sys.stdout) cstdout = file_test.GetStdOut() diff --git a/Examples/test-suite/python/fvirtual_runme.py b/Examples/test-suite/python/fvirtual_runme.py index e06ab5b4f..ada3313de 100644 --- a/Examples/test-suite/python/fvirtual_runme.py +++ b/Examples/test-suite/python/fvirtual_runme.py @@ -1,6 +1,6 @@ from fvirtual import * -sw = Switch() +sw = NodeSwitch() n = Node() i = sw.addChild(n); diff --git a/Examples/test-suite/python/hugemod.pl b/Examples/test-suite/python/hugemod.pl index 15c4ce41b..5420926e4 100644 --- a/Examples/test-suite/python/hugemod.pl +++ b/Examples/test-suite/python/hugemod.pl @@ -2,8 +2,12 @@ use strict; +my $modsize = 399; #adjust it so you can have a smaller or bigger hugemod + +my $runme = shift @ARGV; + open HEADER, ">hugemod.h" or die "error"; -open TEST, ">hugemod_runme.py" or die "error"; +open TEST, ">$runme" or die "error"; open I1, ">hugemod_a.i" or die "error"; open I2, ">hugemod_b.i" or die "error"; @@ -21,7 +25,7 @@ print I2 "\%inline \%{\n"; my $i; -for ($i = 0; $i < 6000; $i++) { +for ($i = 0; $i < $modsize; $i++) { my $t = $i * 4; print HEADER "class type$i { public: int a; };\n"; print I2 "class dtype$i : public type$i { public: int b; };\n"; diff --git a/Examples/test-suite/python/keyword_rename_runme.py b/Examples/test-suite/python/keyword_rename_runme.py new file mode 100644 index 000000000..5646ce7d6 --- /dev/null +++ b/Examples/test-suite/python/keyword_rename_runme.py @@ -0,0 +1,4 @@ +#!/usr/bin/env python +import keyword_rename +keyword_rename._in(1) +keyword_rename._except(1) diff --git a/Examples/test-suite/python/li_std_string_runme.py b/Examples/test-suite/python/li_std_string_runme.py index ed79718d2..c0dae1e25 100644 --- a/Examples/test-suite/python/li_std_string_runme.py +++ b/Examples/test-suite/python/li_std_string_runme.py @@ -121,7 +121,7 @@ if s != "hellohello": raise RuntimeError -if li_std_string.empty() != "": +if li_std_string.stdstring_empty() != "": raise RuntimeError diff --git a/Examples/test-suite/python/operbool_runme.py b/Examples/test-suite/python/operbool_runme.py new file mode 100644 index 000000000..4218b5dd4 --- /dev/null +++ b/Examples/test-suite/python/operbool_runme.py @@ -0,0 +1,4 @@ +#!/usr/bin/env python +import operbool +assert not operbool.Test() + diff --git a/Examples/test-suite/python/pybuf.i b/Examples/test-suite/python/pybuf.i new file mode 100644 index 000000000..207b5b7e9 --- /dev/null +++ b/Examples/test-suite/python/pybuf.i @@ -0,0 +1,34 @@ +%module pybuf +%include + +%pybuffer_mutable_binary(char *buf1, int len); +%pybuffer_mutable_string(char *buf2); +%pybuffer_binary(const char *buf3, int len); +%pybuffer_string(const char *buf4); + +%inline %{ + void func1(char *buf1, int len) + { + int i; + for (i=0; i +%include +%pybuffer_mutable_string(char *str1); +%cstring_mutable(char *str2); + +%inline %{ +void title(char *str) { + int outword = 0; + while(*str) { + if (isalnum(*str)) { + if (outword) { + outword = 1; + *str = toupper(*str); + } + } + else { + outword = 0; + } + str++; + } +} + +void title1(char *str1) { + title(str1); +} +void title2(char *str2) { + title(str2); +} +%} diff --git a/Examples/test-suite/python/pybuf_benchmark_runme.py b/Examples/test-suite/python/pybuf_benchmark_runme.py new file mode 100644 index 000000000..6676a910b --- /dev/null +++ b/Examples/test-suite/python/pybuf_benchmark_runme.py @@ -0,0 +1,16 @@ +import pybuf +import time +k=1000000 +n=7 + +t=time.time() +a = bytearray(b'hello world') +for i in range(k): + pybuf.title1(a) +print "Time used by bytearray:",time.time()-t + +t=time.time() +b = 'hello world' +for i in range(k): + pybuf.title2(b) +print "Time used by string:",time.time()-t diff --git a/Examples/test-suite/python/pybuf_benchmark_runme3.py b/Examples/test-suite/python/pybuf_benchmark_runme3.py new file mode 100644 index 000000000..e412d5993 --- /dev/null +++ b/Examples/test-suite/python/pybuf_benchmark_runme3.py @@ -0,0 +1,16 @@ +import pybuf +import time +k=1000000 +n=7 + +t=time.time() +a = bytearray(b'hello world') +for i in range(k): + pybuf.title1(a) +print("Time used by bytearray:",time.time()-t) + +t=time.time() +b = 'hello world' +for i in range(k): + pybuf.title2(b) +print("Time used by string:",time.time()-t) diff --git a/Examples/test-suite/python/pybuf_runme3.py b/Examples/test-suite/python/pybuf_runme3.py new file mode 100644 index 000000000..462736bf0 --- /dev/null +++ b/Examples/test-suite/python/pybuf_runme3.py @@ -0,0 +1,15 @@ +import pybuf +buf1 = bytearray(10) +buf2 = bytearray(50) + +pybuf.func1(buf1) +assert buf1 == b'a'*10 + +pybuf.func2(buf2) +assert buf2.startswith(b"Hello world!\x00") + +count = pybuf.func3(buf2) +assert count==10 #number of alpha and number in 'Hello world!' + +length = pybuf.func4(buf2) +assert length==12 diff --git a/Examples/test-suite/python/template_typedef_cplx2_runme.py b/Examples/test-suite/python/template_typedef_cplx2_runme.py index 030fe02d8..04c599329 100644 --- a/Examples/test-suite/python/template_typedef_cplx2_runme.py +++ b/Examples/test-suite/python/template_typedef_cplx2_runme.py @@ -1,4 +1,3 @@ -import string from template_typedef_cplx2 import * # @@ -13,7 +12,7 @@ except: raise RuntimeError s = '%s' % d -if string.find(s, 'ArithUnaryFunction') == -1: +if str.find(s, 'ArithUnaryFunction') == -1: print d, "is not an ArithUnaryFunction" raise RuntimeError @@ -25,7 +24,7 @@ except: raise RuntimeError s = '%s' % e -if string.find(s, 'ArithUnaryFunction') == -1: +if str.find(s, 'ArithUnaryFunction') == -1: print e, "is not an ArithUnaryFunction" raise RuntimeError @@ -42,7 +41,7 @@ except: raise RuntimeError s = '%s' % c -if string.find(s, 'ArithUnaryFunction') == -1: +if str.find(s, 'ArithUnaryFunction') == -1: print c, "is not an ArithUnaryFunction" raise RuntimeError @@ -54,7 +53,7 @@ except: raise RuntimeError s = '%s' % f -if string.find(s, 'ArithUnaryFunction') == -1: +if str.find(s, 'ArithUnaryFunction') == -1: print f, "is not an ArithUnaryFunction" raise RuntimeError @@ -70,7 +69,7 @@ except: raise RuntimeError s = '%s' % g -if string.find(s, 'ArithUnaryFunction') == -1: +if str.find(s, 'ArithUnaryFunction') == -1: print g, "is not an ArithUnaryFunction" raise RuntimeError @@ -83,7 +82,7 @@ except: raise RuntimeError s = '%s' % h -if string.find(s, 'ArithUnaryFunction') == -1: +if str.find(s, 'ArithUnaryFunction') == -1: print h, "is not an ArithUnaryFunction" raise RuntimeError diff --git a/Examples/test-suite/python/template_typedef_cplx_runme.py b/Examples/test-suite/python/template_typedef_cplx_runme.py index 99ffcb9aa..2cd9c8348 100644 --- a/Examples/test-suite/python/template_typedef_cplx_runme.py +++ b/Examples/test-suite/python/template_typedef_cplx_runme.py @@ -1,4 +1,3 @@ -import string from template_typedef_cplx import * # @@ -13,7 +12,7 @@ except: raise RuntimeError s = '%s' % d -if string.find(s, 'ArithUnaryFunction') == -1: +if str.find(s, 'ArithUnaryFunction') == -1: print d, "is not an ArithUnaryFunction" raise RuntimeError @@ -25,7 +24,7 @@ except: raise RuntimeError s = '%s' % e -if string.find(s, 'ArithUnaryFunction') == -1: +if str.find(s, 'ArithUnaryFunction') == -1: print e, "is not an ArithUnaryFunction" raise RuntimeError @@ -42,7 +41,7 @@ except: raise RuntimeError s = '%s' % c -if string.find(s, 'ArithUnaryFunction') == -1: +if str.find(s, 'ArithUnaryFunction') == -1: print c, "is not an ArithUnaryFunction" raise RuntimeError @@ -54,7 +53,7 @@ except: raise RuntimeError s = '%s' % f -if string.find(s, 'ArithUnaryFunction') == -1: +if str.find(s, 'ArithUnaryFunction') == -1: print f, "is not an ArithUnaryFunction" raise RuntimeError @@ -70,7 +69,7 @@ except: raise RuntimeError s = '%s' % g -if string.find(s, 'ArithUnaryFunction') == -1: +if str.find(s, 'ArithUnaryFunction') == -1: print g, "is not an ArithUnaryFunction" raise RuntimeError @@ -83,6 +82,6 @@ except: raise RuntimeError s = '%s' % h -if string.find(s, 'ArithUnaryFunction') == -1: +if str.find(s, 'ArithUnaryFunction') == -1: print h, "is not an ArithUnaryFunction" raise RuntimeError diff --git a/Examples/test-suite/r/Makefile.in b/Examples/test-suite/r/Makefile.in index 0a1b3567e..70dd62ec5 100644 --- a/Examples/test-suite/r/Makefile.in +++ b/Examples/test-suite/r/Makefile.in @@ -42,7 +42,7 @@ run_testcase = \ env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH PATH=.:"$$PATH" \ $(RUNTOOL) $(RUNR) $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ;) \ else \ - ($(RUNR) $(srcdir)/$(SCRIPTPREFIX)$*$(WRAPSUFFIX);) \ + ($(RUNTOOL) $(RUNR) $(srcdir)/$(SCRIPTPREFIX)$*$(WRAPSUFFIX);) \ fi; run_multitestcase = \ @@ -51,7 +51,7 @@ run_multitestcase = \ env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH PATH=.:"$$PATH" \ $(RUNTOOL) $(RUNR) $(srcdir)/$(SCRIPTPREFIX)$${f}$(SCRIPTSUFFIX) ;) \ else \ - ($(RUNR) $(srcdir)/$(SCRIPTPREFIX)$${f}$(WRAPSUFFIX);) \ + ($(RUNTOOL) $(RUNR) $(srcdir)/$(SCRIPTPREFIX)$${f}$(WRAPSUFFIX);) \ fi; \ done # Clean diff --git a/Examples/test-suite/ruby/li_std_string_runme.rb b/Examples/test-suite/ruby/li_std_string_runme.rb index f572573bc..dc85b5dab 100644 --- a/Examples/test-suite/ruby/li_std_string_runme.rb +++ b/Examples/test-suite/ruby/li_std_string_runme.rb @@ -124,7 +124,7 @@ if (s != "hellohello") end -if (empty() != "") +if (stdstring_empty() != "") raise RuntimeError end diff --git a/Examples/test-suite/samename.i b/Examples/test-suite/samename.i index 1e9645e70..819cb4abd 100644 --- a/Examples/test-suite/samename.i +++ b/Examples/test-suite/samename.i @@ -1,6 +1,15 @@ %module samename -%inline { +#if !(defined(SWIGCSHARP) || defined(SWIGJAVA)) +class samename { + public: + void do_something() { + // ... + } +}; +#endif + +%{ class samename { public: @@ -9,5 +18,5 @@ class samename { } }; -} +%} diff --git a/Examples/test-suite/template_inherit_abstract.i b/Examples/test-suite/template_inherit_abstract.i index f676b3b3e..89d983de0 100644 --- a/Examples/test-suite/template_inherit_abstract.i +++ b/Examples/test-suite/template_inherit_abstract.i @@ -4,7 +4,7 @@ %warnfilter(SWIGWARN_JAVA_MULTIPLE_INHERITANCE, SWIGWARN_CSHARP_MULTIPLE_INHERITANCE, - SWIGWARN_PHP4_MULTIPLE_INHERITANCE) oss::Module; /* C#, Java, Php4 multiple inheritance */ + SWIGWARN_PHP_MULTIPLE_INHERITANCE) oss::Module; /* C#, Java, PHP multiple inheritance */ %inline %{ diff --git a/Examples/test-suite/template_int_const.i b/Examples/test-suite/template_int_const.i index 37b1cf998..e69a53c4f 100644 --- a/Examples/test-suite/template_int_const.i +++ b/Examples/test-suite/template_int_const.i @@ -10,7 +10,7 @@ static const Polarization polarization = UnaryPolarization; }; template - struct Interface + struct Interface_ { }; @@ -26,16 +26,16 @@ }; %} -%template(Interface_UP) Interface; +%template(Interface_UP) Interface_; %template(Module_1) Module<1>; %inline %{ struct ExtInterface1 : - Interface // works + Interface_ // works { }; struct ExtInterface2 : - Interface // doesn't work + Interface_ // doesn't work { }; struct ExtModule1 : diff --git a/Examples/test-suite/template_typedef_rec.i b/Examples/test-suite/template_typedef_rec.i index 83fe2104a..abdf11382 100644 --- a/Examples/test-suite/template_typedef_rec.i +++ b/Examples/test-suite/template_typedef_rec.i @@ -16,7 +16,7 @@ public: template -class ArrayIterator +class ArrayIterator_ { public: typedef test_Array::intT intT; @@ -38,8 +38,8 @@ class ArrayPrimitiveT public: typedef T ValueT; typedef T valueT; - typedef ArrayIterator Iterator; - typedef ArrayIterator ConstIterator; + typedef ArrayIterator_ Iterator; + typedef ArrayIterator_ ConstIterator; typedef ArrayReverseIterator ReverseIterator; typedef ArrayReverseIterator ConstReverseIterator; }; diff --git a/Examples/test-suite/typemap_namespace.i b/Examples/test-suite/typemap_namespace.i index d30a4ddb1..5375c43b6 100644 --- a/Examples/test-suite/typemap_namespace.i +++ b/Examples/test-suite/typemap_namespace.i @@ -27,7 +27,7 @@ namespace Foo { %typemap(javaout) Str1 * = char *; #endif %typemap(in) Str1 * = char *; -#if !(defined(SWIGCSHARP) || defined(SWIGLUA)) +#if !(defined(SWIGCSHARP) || defined(SWIGLUA) || defined(SWIGPHP)) %typemap(freearg) Str1 * = char *; #endif %typemap(typecheck) Str1 * = char *; diff --git a/Examples/test-suite/using_composition.i b/Examples/test-suite/using_composition.i index 7bb6add2a..bd0f712b5 100644 --- a/Examples/test-suite/using_composition.i +++ b/Examples/test-suite/using_composition.i @@ -2,13 +2,13 @@ %warnfilter(SWIGWARN_JAVA_MULTIPLE_INHERITANCE, SWIGWARN_CSHARP_MULTIPLE_INHERITANCE, - SWIGWARN_PHP4_MULTIPLE_INHERITANCE) FooBar; // C#, Java, Php4 multiple inheritance + SWIGWARN_PHP_MULTIPLE_INHERITANCE) FooBar; // C#, Java, PHP multiple inheritance %warnfilter(SWIGWARN_JAVA_MULTIPLE_INHERITANCE, SWIGWARN_CSHARP_MULTIPLE_INHERITANCE, - SWIGWARN_PHP4_MULTIPLE_INHERITANCE) FooBar2; // C#, Java, Php4 multiple inheritance + SWIGWARN_PHP_MULTIPLE_INHERITANCE) FooBar2; // C#, Java, PHP multiple inheritance %warnfilter(SWIGWARN_JAVA_MULTIPLE_INHERITANCE, SWIGWARN_CSHARP_MULTIPLE_INHERITANCE, - SWIGWARN_PHP4_MULTIPLE_INHERITANCE) FooBar3; // C#, Java, Php4 multiple inheritance + SWIGWARN_PHP_MULTIPLE_INHERITANCE) FooBar3; // C#, Java, PHP multiple inheritance #ifdef SWIGLUA // lua only has one numeric type, so some overloads shadow each other creating warnings %warnfilter(SWIGWARN_LANG_OVERLOAD_SHADOW) blah; #endif diff --git a/Examples/test-suite/using_extend.i b/Examples/test-suite/using_extend.i index 414ceedb4..e14cc28e8 100644 --- a/Examples/test-suite/using_extend.i +++ b/Examples/test-suite/using_extend.i @@ -2,7 +2,7 @@ %warnfilter(SWIGWARN_JAVA_MULTIPLE_INHERITANCE, SWIGWARN_CSHARP_MULTIPLE_INHERITANCE, - SWIGWARN_PHP4_MULTIPLE_INHERITANCE) FooBar; // C#, Java, Php4 multiple inheritance + SWIGWARN_PHP_MULTIPLE_INHERITANCE) FooBar; // C#, Java, PHP multiple inheritance #ifdef SWIGLUA // lua only has one numeric type, so some overloads shadow each other creating warnings %warnfilter(SWIGWARN_LANG_OVERLOAD_SHADOW) blah; #endif diff --git a/Examples/test-suite/using_namespace.i b/Examples/test-suite/using_namespace.i index 1989b6a0d..799c7cfb5 100644 --- a/Examples/test-suite/using_namespace.i +++ b/Examples/test-suite/using_namespace.i @@ -5,7 +5,7 @@ %warnfilter(SWIGWARN_JAVA_MULTIPLE_INHERITANCE, SWIGWARN_CSHARP_MULTIPLE_INHERITANCE, - SWIGWARN_PHP4_MULTIPLE_INHERITANCE) Hi; // C#, Java, Php4 multiple inheritance + SWIGWARN_PHP_MULTIPLE_INHERITANCE) Hi; // C#, Java, PHP multiple inheritance %inline %{ namespace hello diff --git a/Lib/allegrocl/allegrocl.swg b/Lib/allegrocl/allegrocl.swg index 0ae8ed76c..8132e4628 100644 --- a/Lib/allegrocl/allegrocl.swg +++ b/Lib/allegrocl/allegrocl.swg @@ -296,15 +296,30 @@ $body)" sym)))) (cl::defun full-name (id type arity class) - (cl::case type - (:getter (cl::format nil "~@[~A_~]~A" class id)) - (:constructor (cl::format nil "new_~A~@[~A~]" id arity)) - (:destructor (cl::format nil "delete_~A" id)) - (:type (cl::format nil "ff_~A" id)) - (:slot id) - (:ff-operator (cl::format nil "ffi_~A" id)) - (otherwise (cl::format nil "~@[~A_~]~A~@[~A~]" - class id arity)))) + ; We need some kind of a hack here to handle template classes + ; and other synonym types right. We need the original name. + (let*( (sym (read-symbol-from-string + (if (eq *swig-identifier-converter* 'identifier-convert-lispify) + (string-lispify id) + id))) + (sym-class (find-class sym nil)) + (id (cond ( (not sym-class) + id ) + ( (and sym-class + (not (eq (class-name sym-class) + sym))) + (class-name sym-class) ) + ( t + id ))) ) + (cl::case type + (:getter (cl::format nil "~@[~A_~]~A" class id)) + (:constructor (cl::format nil "new_~A~@[~A~]" id arity)) + (:destructor (cl::format nil "delete_~A" id)) + (:type (cl::format nil "ff_~A" id)) + (:slot id) + (:ff-operator (cl::format nil "ffi_~A" id)) + (otherwise (cl::format nil "~@[~A_~]~A~@[~A~]" + class id arity))))) (cl::defun identifier-convert-null (id &key type class arity) (cl::if (cl::eq type :setter) @@ -312,6 +327,27 @@ $body)" id :type :getter :class class :arity arity)) (read-symbol-from-string (full-name id type arity class)))) +(cl::defun string-lispify (str) + (cl::let ( (cname (excl::replace-regexp str "_" "-")) + (lastcase :other) + newcase char res ) + (cl::dotimes (n (cl::length cname)) + (cl::setf char (cl::schar cname n)) + (excl::if* (cl::alpha-char-p char) + then + (cl::setf newcase (cl::if (cl::upper-case-p char) :upper :lower)) + (cl::when (cl::and (cl::eq lastcase :lower) + (cl::eq newcase :upper)) + ;; case change... add a dash + (cl::push #\- res) + (cl::setf newcase :other)) + (cl::push (cl::char-downcase char) res) + (cl::setf lastcase newcase) + else + (cl::push char res) + (cl::setf lastcase :other))) + (cl::coerce (cl::nreverse res) 'string))) + (cl::defun identifier-convert-lispify (cname &key type class arity) (cl::assert (cl::stringp cname)) (cl::when (cl::eq type :setter) @@ -321,31 +357,7 @@ $body)" (cl::setq cname (full-name cname type arity class)) (cl::if (cl::eq type :constant) (cl::setf cname (cl::format nil "*~A*" cname))) - (cl::setf cname (excl::replace-regexp cname "_" "-")) - (cl::let ((lastcase :other) - newcase char res) - (cl::dotimes (n (cl::length cname)) - (cl::setf char (cl::schar cname n)) - (excl::if* (cl::alpha-char-p char) - then - (cl::setf newcase (cl::if (cl::upper-case-p char) :upper :lower)) - - (cl::when (cl::or (cl::and (cl::eq lastcase :upper) - (cl::eq newcase :lower)) - (cl::and (cl::eq lastcase :lower) - (cl::eq newcase :upper))) - ;; case change... add a dash - (cl::push #\- res) - (cl::setf newcase :other)) - - (cl::push (cl::char-downcase char) res) - - (cl::setf lastcase newcase) - - else - (cl::push char res) - (cl::setf lastcase :other))) - (read-symbol-from-string (cl::coerce (cl::nreverse res) 'string)))) + (read-symbol-from-string (string-lispify cname))) (cl::defun id-convert-and-export (name &rest kwargs) (cl::multiple-value-bind (symbol package) diff --git a/Lib/cdata.i b/Lib/cdata.i index a9e74ed8a..67601f737 100644 --- a/Lib/cdata.i +++ b/Lib/cdata.i @@ -29,6 +29,11 @@ typedef struct SWIGCDATA { $result = C_string(&string_space, $1.len, $1.data); } %typemap(in) (const void *indata, int inlen) = (char *STRING, int LENGTH); +#elif SWIGPHP +%typemap(out) SWIGCDATA { + ZVAL_STRINGL($result, $1.data, $1.len, 1); +} +%typemap(in) (const void *indata, int inlen) = (char *STRING, int LENGTH); #else %echo "cdata.i module not supported." #endif @@ -76,7 +81,3 @@ SWIGCDATA cdata_##NAME(TYPE *ptr, int nelements); /* Memory move function */ void memmove(void *data, const void *indata, int inlen); - - - - diff --git a/Lib/cffi/cffi.swg b/Lib/cffi/cffi.swg index 63bd0b040..c832e00d2 100644 --- a/Lib/cffi/cffi.swg +++ b/Lib/cffi/cffi.swg @@ -86,7 +86,7 @@ short, signed short, unsigned short, int, signed int, unsigned int, long, signed long, unsigned long, - float, double, long double, char *, void * + float, double, long double, char *, void *, enum SWIGTYPE, SWIGTYPE *, SWIGTYPE[ANY], SWIGTYPE & "$result = $1;"; #ifdef __cplusplus @@ -125,8 +125,9 @@ int, signed int, unsigned int, long, signed long, unsigned long, enum SWIGTYPE "cl:integer"; -%typemap(lispclass) float "cl:single-float"; -%typemap(lispclass) double "cl:double-float"; +/* CLOS methods can't be specialized on single-float or double-float */ +%typemap(lispclass) float "cl:number"; +%typemap(lispclass) double "cl:number"; %typemap(lispclass) char * "cl:string"; diff --git a/Lib/chicken/chicken.swg b/Lib/chicken/chicken.swg index d8b71874e..a8d1b5a57 100644 --- a/Lib/chicken/chicken.swg +++ b/Lib/chicken/chicken.swg @@ -10,6 +10,7 @@ /* chicken.h has to appear first. */ %insert(runtime) %{ +#include #include %} diff --git a/Lib/chicken/chickenkw.swg b/Lib/chicken/chickenkw.swg index f01faf14f..d2c26c74c 100644 --- a/Lib/chicken/chickenkw.swg +++ b/Lib/chicken/chickenkw.swg @@ -3,7 +3,7 @@ /* Warnings for certain CHICKEN keywords. From Section 7.1.1 of Revised^5 Report on the Algorithmic Language Scheme */ -#define CHICKENKW(x) %namewarn("314:" #x " is a R^5RS syntatic keyword") #x +#define CHICKENKW(x) %namewarn("314: '" #x "' is a R^5RS syntatic keyword") #x CHICKENKW(else); CHICKENKW(=>); diff --git a/Lib/chicken/chickenrun.swg b/Lib/chicken/chickenrun.swg index bd7242407..8703ea65a 100644 --- a/Lib/chicken/chickenrun.swg +++ b/Lib/chicken/chickenrun.swg @@ -7,6 +7,7 @@ * ----------------------------------------------------------------------------- */ #include +#include #include #include #include diff --git a/Lib/csharp/csharp.swg b/Lib/csharp/csharp.swg index 35e5c26d7..e381ff9ae 100644 --- a/Lib/csharp/csharp.swg +++ b/Lib/csharp/csharp.swg @@ -428,7 +428,8 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) { %typemap(directorin) SWIGTYPE & %{ $input = ($1_ltype) &$1; %} -%typemap(csdirectorin) SWIGTYPE *, SWIGTYPE (CLASS::*), SWIGTYPE & "new $csclassname($iminput, false)" +%typemap(csdirectorin) SWIGTYPE *, SWIGTYPE (CLASS::*) "($iminput == IntPtr.Zero) ? null : new $csclassname($iminput, false)" +%typemap(csdirectorin) SWIGTYPE & "new $csclassname($iminput, false)" %typemap(csdirectorout) SWIGTYPE *, SWIGTYPE (CLASS::*), SWIGTYPE & "$csclassname.getCPtr($cscall).Handle" /* Default array handling */ diff --git a/Lib/csharp/csharphead.swg b/Lib/csharp/csharphead.swg index 7938dee04..ffff70372 100644 --- a/Lib/csharp/csharphead.swg +++ b/Lib/csharp/csharphead.swg @@ -73,7 +73,7 @@ static SWIG_CSharpExceptionArgument_t SWIG_csharp_exceptions_argument[] = { static void SWIGUNUSED SWIG_CSharpSetPendingException(SWIG_CSharpExceptionCodes code, const char *msg) { SWIG_CSharpExceptionCallback_t callback = SWIG_csharp_exceptions[SWIG_CSharpApplicationException].callback; - if (code >=0 && (size_t)code < sizeof(SWIG_csharp_exceptions)/sizeof(SWIG_CSharpException_t)) { + if ((size_t)code < sizeof(SWIG_csharp_exceptions)/sizeof(SWIG_CSharpException_t)) { callback = SWIG_csharp_exceptions[code].callback; } callback(msg); @@ -81,7 +81,7 @@ static void SWIGUNUSED SWIG_CSharpSetPendingException(SWIG_CSharpExceptionCodes static void SWIGUNUSED SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpExceptionArgumentCodes code, const char *msg, const char *param_name) { SWIG_CSharpExceptionArgumentCallback_t callback = SWIG_csharp_exceptions_argument[SWIG_CSharpArgumentException].callback; - if (code >=0 && (size_t)code < sizeof(SWIG_csharp_exceptions_argument)/sizeof(SWIG_CSharpExceptionArgument_t)) { + if ((size_t)code < sizeof(SWIG_csharp_exceptions_argument)/sizeof(SWIG_CSharpExceptionArgument_t)) { callback = SWIG_csharp_exceptions_argument[code].callback; } callback(msg, param_name); diff --git a/Lib/csharp/csharpkw.swg b/Lib/csharp/csharpkw.swg index c96042d2d..9a6d979f1 100644 --- a/Lib/csharp/csharpkw.swg +++ b/Lib/csharp/csharpkw.swg @@ -2,7 +2,7 @@ #define CSHARP_CSHARPKW_SWG_ /* Warnings for C# keywords */ -#define CSHARPKW(x) %namewarn("314:" #x " is a csharp keyword") #x +#define CSHARPKW(x) %keywordwarn("'" `x` "' is a C# keyword, renaming to '_" `x` "'",rename="_%s") `x` /* from diff --git a/Lib/csharp/std_vector.i b/Lib/csharp/std_vector.i index a04831f75..2e4d47c00 100755 --- a/Lib/csharp/std_vector.i +++ b/Lib/csharp/std_vector.i @@ -231,14 +231,14 @@ return new std::vector(self->begin()+index, self->begin()+index+count); } void Insert(int index, const value_type& x) throw (std::out_of_range) { - if (index>=0 && index<(int)self->size()+1) + if (index>=0 && index<(int)self->size()) self->insert(self->begin()+index, x); else throw std::out_of_range("index"); } // Takes a deep copy of the elements unlike ArrayList.InsertRange void InsertRange(int index, const std::vector& values) throw (std::out_of_range) { - if (index>=0 && index<(int)self->size()+1) + if (index>=0 && index<(int)self->size()) self->insert(self->begin()+index, values.begin(), values.end()); else throw std::out_of_range("index"); diff --git a/Lib/java/director.swg b/Lib/java/director.swg index bade80c9d..fa588671d 100644 --- a/Lib/java/director.swg +++ b/Lib/java/director.swg @@ -117,12 +117,18 @@ namespace Swig { JNIEnv *jenv_; public: JNIEnvWrapper(const Director *director) : director_(director), jenv_(0) { +#if defined(SWIG_JAVA_ATTACH_CURRENT_THREAD_AS_DAEMON) + // Attach a daemon thread to the JVM. Useful when the JVM should not wait for + // the thread to exit upon shutdown. Only for jdk-1.4 and later. + director_->swig_jvm_->AttachCurrentThreadAsDaemon((void **) &jenv_, NULL); +#else director_->swig_jvm_->AttachCurrentThread((void **) &jenv_, NULL); +#endif } ~JNIEnvWrapper() { -// Some JVMs, eg JDK 1.4.2 and lower on Solaris have a bug and crash with the DetachCurrentThread call. -// However, without this call, the JVM hangs on exit when the thread was not created by the JVM and creates a memory leak. #if !defined(SWIG_JAVA_NO_DETACH_CURRENT_THREAD) + // Some JVMs, eg jdk-1.4.2 and lower on Solaris have a bug and crash with the DetachCurrentThread call. + // However, without this call, the JVM hangs on exit when the thread was not created by the JVM and creates a memory leak. director_->swig_jvm_->DetachCurrentThread(); #endif } diff --git a/Lib/java/java.swg b/Lib/java/java.swg index b7c5607c3..7d1808632 100644 --- a/Lib/java/java.swg +++ b/Lib/java/java.swg @@ -620,7 +620,8 @@ %typemap(directorin,descriptor="L$packagepath/$javaclassname;") SWIGTYPE & %{ *($&1_ltype)&$input = ($1_ltype) &$1; %} -%typemap(javadirectorin) SWIGTYPE *, SWIGTYPE (CLASS::*), SWIGTYPE & "new $javaclassname($jniinput, false)" +%typemap(javadirectorin) SWIGTYPE *, SWIGTYPE (CLASS::*) "($jniinput == 0) ? null : new $javaclassname($jniinput, false)" +%typemap(javadirectorin) SWIGTYPE & "new $javaclassname($jniinput, false)" %typemap(javadirectorout) SWIGTYPE *, SWIGTYPE (CLASS::*), SWIGTYPE & "$javaclassname.getCPtr($javacall)" /* Default array handling */ diff --git a/Lib/java/javakw.swg b/Lib/java/javakw.swg index 9dcd97062..99cd54770 100644 --- a/Lib/java/javakw.swg +++ b/Lib/java/javakw.swg @@ -2,7 +2,7 @@ #define JAVA_JAVAKW_SWG_ /* Warnings for Java keywords */ -#define JAVAKW(x) %namewarn("314:" #x " is a java keyword") #x +#define JAVAKW(x) %keywordwarn("'" `x` "' is a java keyword, renaming to '_"`x`"'",rename="_%s") `x` /* from diff --git a/Lib/java/various.i b/Lib/java/various.i index c53f08aa2..733b8fa79 100644 --- a/Lib/java/various.i +++ b/Lib/java/various.i @@ -60,7 +60,7 @@ #endif } -%typemap(out) char **STRING_ARRAY (char *s) { +%typemap(out) char **STRING_ARRAY { int i; int len=0; jstring temp_string; diff --git a/Lib/lua/luatypemaps.swg b/Lib/lua/luatypemaps.swg index 462d6a055..0941c9da1 100644 --- a/Lib/lua/luatypemaps.swg +++ b/Lib/lua/luatypemaps.swg @@ -73,7 +73,7 @@ %{$1 = (lua_toboolean(L, $input)!=0);%} %typemap(out) bool -%{ lua_pushboolean(L,(int)($1==true)); SWIG_arg++;%} +%{ lua_pushboolean(L,(int)($1!=0)); SWIG_arg++;%} // for const bool&, SWIG treats this as a const bool* so we must dereference it %typemap(in,checkfn="lua_isboolean") const bool& (bool temp) @@ -81,7 +81,7 @@ $1=&temp;%} %typemap(out) const bool& -%{ lua_pushboolean(L,(int)(*$1==true)); SWIG_arg++;%} +%{ lua_pushboolean(L,(int)((*$1)!=0)); SWIG_arg++;%} // strings (char* and char[]) %typemap(in,checkfn="lua_isstring") const char*, char* diff --git a/Lib/lua/typemaps.i b/Lib/lua/typemaps.i index e0adcf192..fa0c0d0e5 100644 --- a/Lib/lua/typemaps.i +++ b/Lib/lua/typemaps.i @@ -80,6 +80,22 @@ SWIG_NUMBER_TYPEMAP(long long); SWIG_NUMBER_TYPEMAP(unsigned long long); SWIG_NU // note we dont do char, as a char* is probably a string not a ptr to a single char +// similar for booleans +%typemap(in,checkfn="lua_isboolean") bool *INPUT(bool temp), bool &INPUT(bool temp) +%{ temp = (lua_toboolean(L,$input)!=0); + $1 = &temp; %} + +%typemap(in, numinputs=0) bool *OUTPUT (bool temp),bool &OUTPUT (bool temp) +%{ $1 = &temp; %} + +%typemap(argout) bool *OUTPUT,bool &OUTPUT +%{ lua_pushboolean(L, (int)((*$1)!=0)); SWIG_arg++;%} + +%typemap(in) bool *INOUT = bool *INPUT; +%typemap(argout) bool *INOUT = bool *OUTPUT; +%typemap(in) bool &INOUT = bool &INPUT; +%typemap(argout) bool &INOUT = bool &OUTPUT; + /* ----------------------------------------------------------------------------- * Basic Array typemaps * ----------------------------------------------------------------------------- */ @@ -320,6 +336,11 @@ for array handling %typemap(freearg) (TYPE *INOUT,int)=(TYPE *INPUT,int); // TODO out variable arrays (is there a standard form for such things?) + +// referencing so that (int *INPUT,int) and (int INPUT[],int) are the same +%typemap(in) (TYPE INPUT[],int)=(TYPE *INPUT,int); +%typemap(freearg) (TYPE INPUT[],int)=(TYPE *INPUT,int); + %enddef // the following line of code diff --git a/Lib/ocaml/ocamlkw.swg b/Lib/ocaml/ocamlkw.swg index ba06f238e..9b9096e2b 100644 --- a/Lib/ocaml/ocamlkw.swg +++ b/Lib/ocaml/ocamlkw.swg @@ -2,7 +2,7 @@ #define OCAML_OCAMLKW_SWG_ /* Warnings for Ocaml keywords */ -#define OCAMLKW(x) %namewarn("314:" #x " is a ocaml keyword and it will properly renamed") #x +#define OCAMLKW(x) %namewarn("314: '" #x "' is a ocaml keyword and it will properly renamed") #x /* from diff --git a/Lib/perl5/noembed.h b/Lib/perl5/noembed.h index a29de61f5..8d3dc7338 100644 --- a/Lib/perl5/noembed.h +++ b/Lib/perl5/noembed.h @@ -91,3 +91,7 @@ #ifdef open #undef open #endif +#ifdef readdir + #undef readdir +#endif + diff --git a/Lib/perl5/perlkw.swg b/Lib/perl5/perlkw.swg index 71a229c66..00648e0bf 100644 --- a/Lib/perl5/perlkw.swg +++ b/Lib/perl5/perlkw.swg @@ -1,6 +1,6 @@ /* Warnings for Perl keywords */ -#define PERLKW(x) %keywordwarn(`x` " is a perl keyword") `x` -#define PERLBN(x) %builtinwarn(`x` " conflicts with a built-in name in perl") "::" `x` +#define PERLKW(x) %keywordwarn("'" `x` "' is a perl keyword") `x` +#define PERLBN(x) %builtinwarn("'" `x` "' conflicts with a built-in name in perl") "::" `x` /* diff --git a/Lib/php4/const.i b/Lib/php/const.i similarity index 100% rename from Lib/php4/const.i rename to Lib/php/const.i diff --git a/Lib/php4/globalvar.i b/Lib/php/globalvar.i similarity index 100% rename from Lib/php4/globalvar.i rename to Lib/php/globalvar.i diff --git a/Lib/php4/php4.swg b/Lib/php/php.swg similarity index 96% rename from Lib/php4/php4.swg rename to Lib/php/php.swg index feaee68f6..d30e0b2a9 100644 --- a/Lib/php4/php4.swg +++ b/Lib/php/php.swg @@ -2,15 +2,15 @@ * See the LICENSE file for information on copyright, usage and redistribution * of SWIG, and the README file for authors - http://www.swig.org/release.html. * - * php4.swg + * php.swg * - * PHP4 configuration file + * PHP configuration file * ----------------------------------------------------------------------------- */ %runtime "swigrun.swg" // Common C API type-checking code -%runtime "php4run.swg" // Php4 runtime functions +%runtime "phprun.swg" // PHP runtime functions -%include // Php4 initialization routine. +%include // PHP initialization routine. %include // Global variables. %include @@ -73,6 +73,13 @@ $1 = ($1_ltype) Z_STRVAL_PP($input); } +%typemap(in) (char *STRING, int LENGTH) +{ + convert_to_string_ex($input); + $1 = ($1_ltype) Z_STRVAL_PP($input); + $2 = ($2_ltype) Z_STRLEN_PP($input); +} + /* Object passed by value. Convert to a pointer */ %typemap(in) SWIGTYPE ($&1_ltype tmp) { @@ -295,4 +302,4 @@ /* php keywords */ -%include +%include diff --git a/Lib/php4/php4init.swg b/Lib/php/phpinit.swg similarity index 100% rename from Lib/php4/php4init.swg rename to Lib/php/phpinit.swg diff --git a/Lib/php4/php4kw.swg b/Lib/php/phpkw.swg similarity index 93% rename from Lib/php4/php4kw.swg rename to Lib/php/phpkw.swg index 0d28994c5..3d1a62511 100644 --- a/Lib/php4/php4kw.swg +++ b/Lib/php/phpkw.swg @@ -2,21 +2,21 @@ * See the LICENSE file for information on copyright, usage and redistribution * of SWIG, and the README file for authors - http://www.swig.org/release.html. * - * php4kw.swg + * phpkw.swg * * The 'keywords' in PHP are global, ie, the following names are fine * when used as class methods. * ----------------------------------------------------------------------------- */ -#define PHPKW(x) %keywordwarn(`x` " is a php keyword, renamed as c_"`x`,sourcefmt="%(lower)s", rename="c_%s",fullname=1) `x` +#define PHPKW(x) %keywordwarn("'" `x` "' is a php keyword, renamed as 'c_" `x` "'",sourcefmt="%(lower)s", rename="c_%s",fullname=1) `x` %define PHPCN(x) -%keywordwarn(`x` " is a php reserved class name, class renamed as c_"`x`,%$isclass,rename="c_%s") `x`; -%keywordwarn(`x` " is a php reserved class name, constructor renamed as c_"`x`,%$isconstructor,rename="c_%s") `x`; +%keywordwarn("'" `x` "' is a php reserved class name, class renamed as 'c_" `x` "'",%$isclass,rename="c_%s") `x`; +%keywordwarn("'" `x` "' is a php reserved class name, constructor renamed as 'c_" `x` "'",%$isconstructor,rename="c_%s") `x`; %enddef -#define PHPBN1(x) %builtinwarn(`x` " conflicts with a built-in name in php",sourcefmt="%(lower)s",fullname=1) `x` -#define PHPBN2(x) %builtinwarn(`x` " conflicts with a built-in name in php") "::" `x` +#define PHPBN1(x) %builtinwarn("'" `x` "' conflicts with a built-in name in php",sourcefmt="%(lower)s",fullname=1) `x` +#define PHPBN2(x) %builtinwarn("'" `x` "' conflicts with a built-in name in php") "::" `x` /* @@ -67,7 +67,7 @@ PHPKW(include_once); PHPKW(isset); PHPKW(list); PHPKW(new); -PHPKW(old_function); /* No longer reserved in PHP5 */ +// PHPKW(old_function); /* No longer reserved in PHP5 */ PHPKW(or); PHPKW(print); PHPKW(require); diff --git a/Lib/php4/phppointers.i b/Lib/php/phppointers.i similarity index 100% rename from Lib/php4/phppointers.i rename to Lib/php/phppointers.i diff --git a/Lib/php4/php4run.swg b/Lib/php/phprun.swg similarity index 99% rename from Lib/php4/php4run.swg rename to Lib/php/phprun.swg index d38452764..b4e4276f5 100644 --- a/Lib/php4/php4run.swg +++ b/Lib/php/phprun.swg @@ -2,9 +2,9 @@ * See the LICENSE file for information on copyright, usage and redistribution * of SWIG, and the README file for authors - http://www.swig.org/release.html. * - * php4run.swg + * phprun.swg * - * PHP4 runtime library + * PHP runtime library * ----------------------------------------------------------------------------- */ #ifdef __cplusplus diff --git a/Lib/php4/std_common.i b/Lib/php/std_common.i similarity index 100% rename from Lib/php4/std_common.i rename to Lib/php/std_common.i diff --git a/Lib/php4/std_deque.i b/Lib/php/std_deque.i similarity index 100% rename from Lib/php4/std_deque.i rename to Lib/php/std_deque.i diff --git a/Lib/php4/std_map.i b/Lib/php/std_map.i similarity index 97% rename from Lib/php4/std_map.i rename to Lib/php/std_map.i index c35f21dc7..c6721806b 100644 --- a/Lib/php4/std_map.i +++ b/Lib/php/std_map.i @@ -30,6 +30,7 @@ namespace std { map(const map &); unsigned int size() const; + %rename(is_empty) empty; bool empty() const; void clear(); %extend { @@ -69,6 +70,7 @@ namespace std { map(const map &); unsigned int size() const; + %rename(is_empty) empty; bool empty() const; void clear(); %extend { @@ -105,6 +107,7 @@ namespace std { map(const map &); unsigned int size() const; + %rename(is_empty) empty; bool empty() const; void clear(); %extend { @@ -142,6 +145,7 @@ namespace std { map(const map &); unsigned int size() const; + %rename(is_empty) empty; bool empty() const; void clear(); %extend { diff --git a/Lib/php4/std_pair.i b/Lib/php/std_pair.i similarity index 100% rename from Lib/php4/std_pair.i rename to Lib/php/std_pair.i diff --git a/Lib/php4/std_string.i b/Lib/php/std_string.i similarity index 100% rename from Lib/php4/std_string.i rename to Lib/php/std_string.i diff --git a/Lib/php4/std_vector.i b/Lib/php/std_vector.i similarity index 98% rename from Lib/php4/std_vector.i rename to Lib/php/std_vector.i index fe084aca4..b54181618 100644 --- a/Lib/php4/std_vector.i +++ b/Lib/php/std_vector.i @@ -48,6 +48,7 @@ namespace std { public: vector(unsigned int size = 0); unsigned int size() const; + %rename(is_empty) empty; bool empty() const; void clear(); %rename(push) push_back; @@ -86,6 +87,7 @@ namespace std { public: vector(unsigned int size = 0); unsigned int size() const; + %rename(is_empty) empty; bool empty() const; void clear(); %rename(push) push_back; diff --git a/Lib/php4/stl.i b/Lib/php/stl.i similarity index 100% rename from Lib/php4/stl.i rename to Lib/php/stl.i diff --git a/Lib/php4/typemaps.i b/Lib/php/typemaps.i similarity index 85% rename from Lib/php4/typemaps.i rename to Lib/php/typemaps.i index c388fdf96..c5b749578 100644 --- a/Lib/php4/typemaps.i +++ b/Lib/php/typemaps.i @@ -107,6 +107,17 @@ int_typemap(unsigned char); %typemap(in) unsigned long *INOUT = unsigned long *INPUT; %typemap(in) unsigned char *INOUT = unsigned char *INPUT; +%typemap(in) float &INOUT = float *INPUT; +%typemap(in) double &INOUT = double *INPUT; + +%typemap(in) int &INOUT = int *INPUT; +%typemap(in) short &INOUT = short *INPUT; +%typemap(in) long &INOUT = long *INPUT; +%typemap(in) unsigned &INOUT = unsigned *INPUT; +%typemap(in) unsigned short &INOUT = unsigned short *INPUT; +%typemap(in) unsigned long &INOUT = unsigned long *INPUT; +%typemap(in) unsigned char &INOUT = unsigned char *INPUT; + %typemap(argout) float *INOUT = float *OUTPUT; %typemap(argout) double *INOUT= double *OUTPUT; @@ -117,6 +128,16 @@ int_typemap(unsigned char); %typemap(argout) unsigned long *INOUT = unsigned long *OUTPUT; %typemap(argout) unsigned char *INOUT = unsigned char *OUTPUT; +%typemap(argout) float &INOUT = float *OUTPUT; +%typemap(argout) double &INOUT= double *OUTPUT; + +%typemap(argout) int &INOUT = int *OUTPUT; +%typemap(argout) short &INOUT = short *OUTPUT; +%typemap(argout) long &INOUT= long *OUTPUT; +%typemap(argout) unsigned short &INOUT= unsigned short *OUTPUT; +%typemap(argout) unsigned long &INOUT = unsigned long *OUTPUT; +%typemap(argout) unsigned char &INOUT = unsigned char *OUTPUT; + %typemap(in) char INPUT[ANY] ( char temp[$1_dim0] ) %{ convert_to_string_ex($input); diff --git a/Lib/php4/utils.i b/Lib/php/utils.i similarity index 96% rename from Lib/php4/utils.i rename to Lib/php/utils.i index f7241187c..661a48777 100644 --- a/Lib/php4/utils.i +++ b/Lib/php/utils.i @@ -29,14 +29,14 @@ %enddef %define %pass_by_val( TYPE, CONVERT_IN ) -%typemap(in) TYPE +%typemap(in) TYPE, const TYPE & %{ CONVERT_IN($1,$1_ltype,$input); %} %enddef %fragment("t_output_helper","header") %{ -void +static void t_output_helper( zval **target, zval *o) { if ( (*target)->type == IS_ARRAY ) { /* it's already an array, just append */ diff --git a/Lib/pike/pikekw.swg b/Lib/pike/pikekw.swg index 85fd091a8..844b1f189 100644 --- a/Lib/pike/pikekw.swg +++ b/Lib/pike/pikekw.swg @@ -2,7 +2,7 @@ #define PIKE_PIKEKW_SWG_ /* Warnings for Pike keywords */ -#define PIKEKW(x) %namewarn("314:" #x " is a pike keyword") #x +#define PIKEKW(x) %namewarn("314: '" #x "' is a pike keyword") #x /* from diff --git a/Lib/python/director.swg b/Lib/python/director.swg index 176ee3336..836d107ce 100644 --- a/Lib/python/director.swg +++ b/Lib/python/director.swg @@ -107,7 +107,7 @@ namespace Swig { /* memory handler */ struct GCItem { - virtual ~GCItem() = 0; + virtual ~GCItem() {} virtual int get_own() const { @@ -115,10 +115,6 @@ namespace Swig { } }; - GCItem::~GCItem() - { - } - struct GCItem_var { GCItem_var(GCItem *item = 0) : _item(item) @@ -212,10 +208,7 @@ namespace Swig { swig_msg += msg; } if (!PyErr_Occurred()) { - swig_msg.insert(0, ": "); PyErr_SetString(error, getMessage()); - } else { - SWIG_Python_AddErrorMsg(getMessage()); } SWIG_PYTHON_THREAD_END_BLOCK; } diff --git a/Lib/python/file.i b/Lib/python/file.i index c0e7d5ea9..294ab9178 100644 --- a/Lib/python/file.i +++ b/Lib/python/file.i @@ -20,11 +20,13 @@ SWIG_AsValFilePtr(PyObject *obj, FILE **val) { if ((SWIG_ConvertPtr(obj, &vptr, desc, 0)) == SWIG_OK) { if (val) *val = (FILE *)vptr; return SWIG_OK; - } + } +%#if PY_VERSION_HEX < 0x03000000 if (PyFile_Check(obj)) { if (val) *val = PyFile_AsFile(obj); return SWIG_OK; } +%#endif return SWIG_TypeError; } } diff --git a/Lib/python/pyabc.i b/Lib/python/pyabc.i new file mode 100644 index 000000000..3da06b5a9 --- /dev/null +++ b/Lib/python/pyabc.i @@ -0,0 +1,10 @@ +%define %pythonabc(Type, Abc) + %feature("python:abc", #Abc) Type; +%enddef +%pythoncode {import collections}; +%pythonabc(std::vector, collections.MutableSequence); +%pythonabc(std::list, collections.MutableSequence); +%pythonabc(std::map, collections.MutableMapping); +%pythonabc(std::multimap, collections.MutableMapping); +%pythonabc(std::set, collections.MutableSet); +%pythonabc(std::multiset, collections.MutableSet); diff --git a/Lib/python/pyapi.swg b/Lib/python/pyapi.swg index 1d5148dbf..d980f9263 100644 --- a/Lib/python/pyapi.swg +++ b/Lib/python/pyapi.swg @@ -27,6 +27,20 @@ typedef struct swig_const_info { swig_type_info **ptype; } swig_const_info; + +/* ----------------------------------------------------------------------------- + * Wrapper of PyInstanceMethod_New() used in Python 3 + * It is exported to the generated module, used for -fastproxy + * ----------------------------------------------------------------------------- */ +SWIGRUNTIME PyObject* SWIG_PyInstanceMethod_New(PyObject *self, PyObject *func) +{ +#if PY_VERSION_HEX >= 0x03000000 + return PyInstanceMethod_New(func); +#else + return NULL; +#endif +} + #ifdef __cplusplus #if 0 { /* cc-mode */ diff --git a/Lib/python/pybuffer.i b/Lib/python/pybuffer.i new file mode 100644 index 000000000..3dc4c2121 --- /dev/null +++ b/Lib/python/pybuffer.i @@ -0,0 +1,107 @@ +/* Impelementing buffer protocol typemaps */ + +/* %pybuffer_mutable_binary(TYPEMAP, SIZE) + * + * Macro for functions accept mutable buffer pointer with a size. + * This can be used for both input and output. For example: + * + * %pybuffer_mutable_binary(char *buff, int size); + * void foo(char *buff, int size) { + * for(int i=0; i ObjX > ObjB + but ObjA < ObjB + */ + if( PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_TypeError) ) + { + /* Objects can't be compared, this mostly occured in Python 3.0 */ + /* Compare their ptr directly for a workaround */ + res = (v < w); + PyErr_Clear(); + } SWIG_PYTHON_THREAD_END_BLOCK; return res; } @@ -597,6 +608,11 @@ namespace swig return !(self->empty()); } + /* Alias for Python 3 compatibility */ + bool __bool__() const { + return !(self->empty()); + } + size_type __len__() const { return self->size(); } @@ -618,6 +634,14 @@ namespace swig return x; } + /* typemap for slice object support */ + %typemap(in) PySliceObject* { + $1 = (PySliceObject *) $input; + } + %typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER) PySliceObject* { + $1 = PySlice_Check($input); + } + Sequence* __getslice__(difference_type i, difference_type j) throw (std::out_of_range) { return swig::getslice(self, i, j); } @@ -634,6 +658,43 @@ namespace swig void __delitem__(difference_type i) throw (std::out_of_range) { self->erase(swig::getpos(self,i)); } + + + /* Overloaded methods for Python 3 compatibility + * (Also useful in Python 2.x) + */ + Sequence* __getitem__(PySliceObject *slice) throw (std::out_of_range) { + Py_ssize_t i, j, step; + if( !PySlice_Check(slice) ) { + SWIG_Error(SWIG_TypeError, "Slice object expected."); + return NULL; + } + PySlice_GetIndices(slice, self->size(), &i, &j, &step); + return swig::getslice(self, i, j); + } + + void __setitem__(PySliceObject *slice, const Sequence& v) + throw (std::out_of_range, std::invalid_argument) { + Py_ssize_t i, j, step; + if( !PySlice_Check(slice) ) { + SWIG_Error(SWIG_TypeError, "Slice object expected."); + return; + } + PySlice_GetIndices(slice, self->size(), &i, &j, &step); + swig::setslice(self, i, j, v); + } + + void __delitem__(PySliceObject *slice) + throw (std::out_of_range) { + Py_ssize_t i, j, step; + if( !PySlice_Check(slice) ) { + SWIG_Error(SWIG_TypeError, "Slice object expected."); + return; + } + PySlice_GetIndices(slice, self->size(), &i, &j, &step); + swig::delslice(self, i,j); + } + } %enddef @@ -738,12 +799,12 @@ namespace swig { typedef typename sequence::const_iterator const_iterator; static PyObject *from(const sequence& seq) { -#ifdef SWIG_PYTHON_EXTRA_NATIVE_CONTAINERS +%#ifdef SWIG_PYTHON_EXTRA_NATIVE_CONTAINERS swig_type_info *desc = swig::type_info(); if (desc && desc->clientdata) { return SWIG_NewPointerObj(new sequence(seq), desc, SWIG_POINTER_OWN); } -#endif +%#endif size_type size = seq.size(); if (size <= (size_type)INT_MAX) { PyObject *obj = PyTuple_New((int)size); diff --git a/Lib/python/pyerrors.swg b/Lib/python/pyerrors.swg index e287e2fc8..01cf53e9b 100644 --- a/Lib/python/pyerrors.swg +++ b/Lib/python/pyerrors.swg @@ -58,12 +58,12 @@ SWIG_Python_AddErrorMsg(const char* mesg) PyObject *old_str = PyObject_Str(value); PyErr_Clear(); Py_XINCREF(type); - PyErr_Format(type, "%s %s", PyString_AsString(old_str), mesg); + + PyErr_Format(type, "%s %s", + SWIG_Python_str_AsChar(old_str), mesg); Py_DECREF(old_str); Py_DECREF(value); } else { PyErr_SetString(PyExc_RuntimeError, mesg); } } - - diff --git a/Lib/python/pyhead.swg b/Lib/python/pyhead.swg index 7839511bc..d73d3d112 100644 --- a/Lib/python/pyhead.swg +++ b/Lib/python/pyhead.swg @@ -1,3 +1,47 @@ +/* Compatibility marcos for Python 3 */ +#if PY_VERSION_HEX >= 0x03000000 + +#define PyClass_Check(obj) PyObject_IsInstance(obj, (PyObject *)&PyType_Type) + +#define PyInt_Check(x) PyLong_Check(x) +#define PyInt_AsLong(x) PyLong_AsLong(x) +#define PyInt_FromLong(x) PyLong_FromLong(x) + +#define PyString_Format(fmt, args) PyUnicode_Format(fmt, args) +#endif + +#ifndef Py_TYPE +# define Py_TYPE(op) ((op)->ob_type) +#endif + +/* SWIG APIs for compatibility of boht Python 2 & 3 */ + +#if PY_VERSION_HEX >= 0x03000000 +# define SWIG_Python_str_FromFormat PyUnicode_FromFormat +#else +# define SWIG_Python_str_FromFormat PyString_FromFormat +#endif + +SWIGINTERN char* +SWIG_Python_str_AsChar(PyObject *str) +{ +#if PY_VERSION_HEX >= 0x03000000 + str = PyUnicode_AsUTF8String(str); + return PyBytes_AsString(str); +#else + return PyString_AsString(str); +#endif +} + +SWIGINTERN PyObject* +SWIG_Python_str_FromChar(const char *c) +{ +#if PY_VERSION_HEX >= 0x03000000 + return PyUnicode_FromString(c); +#else + return PyString_FromString(c); +#endif +} /* Add PyOS_snprintf for old Pythons */ #if PY_VERSION_HEX < 0x02020000 diff --git a/Lib/python/pyinit.swg b/Lib/python/pyinit.swg index e6109b7bd..ab55765ad 100644 --- a/Lib/python/pyinit.swg +++ b/Lib/python/pyinit.swg @@ -33,18 +33,48 @@ typedef struct swig_varlinkobject { SWIGINTERN PyObject * swig_varlink_repr(swig_varlinkobject *SWIGUNUSEDPARM(v)) { +#if PY_VERSION_HEX >= 0x03000000 + return PyUnicode_InternFromString(""); +#else return PyString_FromString(""); +#endif } SWIGINTERN PyObject * swig_varlink_str(swig_varlinkobject *v) { +#if PY_VERSION_HEX >= 0x03000000 + PyObject *str = PyUnicode_InternFromString("("); + PyObject *tail; + PyObject *joined; + swig_globalvar *var; + for (var = v->vars; var; var=var->next) { + tail = PyUnicode_FromString(var->name); + joined = PyUnicode_Concat(str, tail); + Py_DecRef(str); + Py_DecRef(tail); + str = joined; + if (var->next) { + tail = PyUnicode_InternFromString(", "); + joined = PyUnicode_Concat(str, tail); + Py_DecRef(str); + Py_DecRef(tail); + str = joined; + } + } + tail = PyUnicode_InternFromString(")"); + joined = PyUnicode_Concat(str, tail); + Py_DecRef(str); + Py_DecRef(tail); + str = joined; +#else PyObject *str = PyString_FromString("("); - swig_globalvar *var; + swig_globalvar *var; for (var = v->vars; var; var=var->next) { PyString_ConcatAndDel(&str,PyString_FromString(var->name)); if (var->next) PyString_ConcatAndDel(&str,PyString_FromString(", ")); } PyString_ConcatAndDel(&str,PyString_FromString(")")); +#endif return str; } @@ -52,7 +82,7 @@ SWIGINTERN int swig_varlink_print(swig_varlinkobject *v, FILE *fp, int SWIGUNUSEDPARM(flags)) { PyObject *str = swig_varlink_str(v); fprintf(fp,"Swig global variables "); - fprintf(fp,"%s\n", PyString_AsString(str)); + fprintf(fp,"%s\n", SWIG_Python_str_AsChar(str)); Py_DECREF(str); return 0; } @@ -110,8 +140,13 @@ swig_varlink_type(void) { if (!type_init) { const PyTypeObject tmp = { + /* PyObject header changed in Python 3 */ +#if PY_VERSION_HEX >= 0x03000000 + PyVarObject_HEAD_INIT(&PyType_Type, 0) +#else PyObject_HEAD_INIT(NULL) 0, /* Number of items in variable part (ob_size) */ +#endif (char *)"swigvarlink", /* Type name (tp_name) */ sizeof(swig_varlinkobject), /* Basic size (tp_basicsize) */ 0, /* Itemsize (tp_itemsize) */ @@ -147,7 +182,10 @@ swig_varlink_type(void) { #endif }; varlink_type = tmp; + /* for Python 3 we already assigned the ob_type in PyVarObject_HEAD_INIT() */ +#if PY_VERSION_HEX < 0x03000000 varlink_type.ob_type = &PyType_Type; +#endif type_init = 1; } return &varlink_type; @@ -272,13 +310,35 @@ SWIG_Python_FixMethods(PyMethodDef *methods, #ifdef __cplusplus extern "C" #endif -SWIGEXPORT void SWIG_init(void) { + +SWIGEXPORT +#if PY_VERSION_HEX >= 0x03000000 + PyObject* +#else + void +#endif +SWIG_init(void) { PyObject *m, *d; /* Fix SwigMethods to carry the callback ptrs when needed */ SWIG_Python_FixMethods(SwigMethods, swig_const_table, swig_types, swig_type_initial); - +#if PY_VERSION_HEX >= 0x03000000 + static struct PyModuleDef SWIG_module = { + PyModuleDef_HEAD_INIT, + (char *) SWIG_name, + NULL, + -1, + SwigMethods, + NULL, + NULL, + NULL, + NULL + }; + + m = PyModule_Create(&SWIG_module); +#else m = Py_InitModule((char *) SWIG_name, SwigMethods); +#endif d = PyModule_GetDict(m); SWIG_InitializeModule(0); diff --git a/Lib/python/pyiterators.swg b/Lib/python/pyiterators.swg index e2dfbc3f5..62a7eaf70 100644 --- a/Lib/python/pyiterators.swg +++ b/Lib/python/pyiterators.swg @@ -38,18 +38,18 @@ namespace swig { virtual PySwigIterator *incr(size_t n = 1) = 0; // Backward iterator method, very common in C++, but not required in Python - virtual PySwigIterator *decr(size_t n = 1) + virtual PySwigIterator *decr(size_t /*n*/ = 1) { throw stop_iteration(); } // Random access iterator methods, but not required in Python - virtual ptrdiff_t distance(const PySwigIterator &x) const + virtual ptrdiff_t distance(const PySwigIterator &/*x*/) const { throw std::invalid_argument("operation not supported"); } - virtual bool equal (const PySwigIterator &x) const + virtual bool equal (const PySwigIterator &/*x*/) const { throw std::invalid_argument("operation not supported"); } @@ -66,6 +66,12 @@ namespace swig { return obj; } + /* Make an alias for Python 3.x */ + PyObject *__next__() + { + return next(); + } + PyObject *previous() { SWIG_PYTHON_THREAD_BEGIN_BLOCK; // disable threads @@ -335,6 +341,7 @@ namespace swig %catches(swig::stop_iteration) PySwigIterator::decr(size_t n = 1); %catches(std::invalid_argument) PySwigIterator::distance(const PySwigIterator &x) const; %catches(std::invalid_argument) PySwigIterator::equal (const PySwigIterator &x) const; + %catches(swig::stop_iteration) PySwigIterator::__next__(); %catches(swig::stop_iteration) PySwigIterator::next(); %catches(swig::stop_iteration) PySwigIterator::previous(); %catches(swig::stop_iteration) PySwigIterator::advance(ptrdiff_t n); @@ -370,6 +377,7 @@ namespace swig virtual PySwigIterator *copy() const = 0; PyObject *next(); + PyObject *__next__(); PyObject *previous(); PySwigIterator *advance(ptrdiff_t n); diff --git a/Lib/python/pyopers.swg b/Lib/python/pyopers.swg index 76f1e6789..bd5c954f0 100644 --- a/Lib/python/pyopers.swg +++ b/Lib/python/pyopers.swg @@ -33,6 +33,12 @@ /* Special cases */ %rename(__invert__) *::operator~; %rename(__call__) *::operator(); + +%feature("shadow") *::operator bool %{ +def __nonzero__(self): + return $action(self) +__bool__ = __nonzero__ +%}; %rename(__nonzero__) *::operator bool; /* Ignored operators */ diff --git a/Lib/python/pyrun.swg b/Lib/python/pyrun.swg index 844a66bec..4f51d3a95 100644 --- a/Lib/python/pyrun.swg +++ b/Lib/python/pyrun.swg @@ -348,9 +348,13 @@ PySwigObject_format(const char* fmt, PySwigObject *v) PyObject *args = PyTuple_New(1); if (args) { if (PyTuple_SetItem(args, 0, PySwigObject_long(v)) == 0) { - PyObject *ofmt = PyString_FromString(fmt); + PyObject *ofmt = SWIG_Python_str_FromChar(fmt); if (ofmt) { +#if PY_VERSION_HEX >= 0x03000000 + res = PyUnicode_Format(ofmt,args); +#else res = PyString_Format(ofmt,args); +#endif Py_DECREF(ofmt); } Py_DECREF(args); @@ -380,7 +384,7 @@ PySwigObject_repr(PySwigObject *v, PyObject *args) { const char *name = SWIG_TypePrettyName(v->ty); PyObject *hex = PySwigObject_hex(v); - PyObject *repr = PyString_FromFormat("", name, PyString_AsString(hex)); + PyObject *repr = SWIG_Python_str_FromFormat("", name, hex); Py_DECREF(hex); if (v->next) { #ifdef METH_NOARGS @@ -388,7 +392,14 @@ PySwigObject_repr(PySwigObject *v, PyObject *args) #else PyObject *nrep = PySwigObject_repr((PySwigObject *)v->next, args); #endif +#if PY_VERSION_HEX >= 0x03000000 + PyObject *joined = PyUnicode_Concat(repr, nrep); + Py_DecRef(repr); + Py_DecRef(nrep); + repr = joined; +#else PyString_ConcatAndDel(&repr,nrep); +#endif } return repr; } @@ -402,7 +413,7 @@ PySwigObject_print(PySwigObject *v, FILE *fp, int SWIGUNUSEDPARM(flags)) PyObject *repr = PySwigObject_repr(v, NULL); #endif if (repr) { - fputs(PyString_AsString(repr), fp); + fputs(SWIG_Python_str_AsChar(repr), fp); Py_DECREF(repr); return 0; } else { @@ -415,7 +426,7 @@ PySwigObject_str(PySwigObject *v) { char result[SWIG_BUFFER_SIZE]; return SWIG_PackVoidPtr(result, v->ptr, v->ty->name, sizeof(result)) ? - PyString_FromString(result) : 0; + SWIG_Python_str_FromChar(result) : 0; } SWIGRUNTIME int @@ -426,6 +437,24 @@ PySwigObject_compare(PySwigObject *v, PySwigObject *w) return (i < j) ? -1 : ((i > j) ? 1 : 0); } +/* Added for Python 3.x, whould it also useful for Python 2.x? */ +SWIGRUNTIME PyObject* +PySwigObject_richcompare(PySwigObject *v, PySwigObject *w, int op) +{ + PyObject* res; + if( op != Py_EQ && op != Py_NE ) { + Py_INCREF(Py_NotImplemented); + return Py_NotImplemented; + } + if( (PySwigObject_compare(v, w)==0) == (op == Py_EQ) ) + res = Py_True; + else + res = Py_False; + Py_INCREF(res); + return res; +} + + SWIGRUNTIME PyTypeObject* _PySwigObject_type(void); SWIGRUNTIME PyTypeObject* @@ -436,8 +465,8 @@ PySwigObject_type(void) { SWIGRUNTIMEINLINE int PySwigObject_Check(PyObject *op) { - return ((op)->ob_type == PySwigObject_type()) - || (strcmp((op)->ob_type->tp_name,"PySwigObject") == 0); + return (Py_TYPE(op) == PySwigObject_type()) + || (strcmp(Py_TYPE(op)->tp_name,"PySwigObject") == 0); } SWIGRUNTIME PyObject * @@ -610,7 +639,10 @@ _PySwigObject_type(void) { (binaryfunc)0, /*nb_add*/ (binaryfunc)0, /*nb_subtract*/ (binaryfunc)0, /*nb_multiply*/ + /* nb_divide removed in Python 3 */ +#if PY_VERSION_HEX < 0x03000000 (binaryfunc)0, /*nb_divide*/ +#endif (binaryfunc)0, /*nb_remainder*/ (binaryfunc)0, /*nb_divmod*/ (ternaryfunc)0,/*nb_power*/ @@ -624,13 +656,19 @@ _PySwigObject_type(void) { 0, /*nb_and*/ 0, /*nb_xor*/ 0, /*nb_or*/ - (coercion)0, /*nb_coerce*/ +#if PY_VERSION_HEX < 0x03000000 + 0, /*nb_coerce*/ +#endif (unaryfunc)PySwigObject_long, /*nb_int*/ (unaryfunc)PySwigObject_long, /*nb_long*/ (unaryfunc)0, /*nb_float*/ +#if PY_VERSION_HEX < 0x03000000 (unaryfunc)PySwigObject_oct, /*nb_oct*/ (unaryfunc)PySwigObject_hex, /*nb_hex*/ -#if PY_VERSION_HEX >= 0x02050000 /* 2.5.0 */ +#endif +#if PY_VERSION_HEX >= 0x03000000 /* 3.0 */ + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_index, nb_inplace_divide removed */ +#elif PY_VERSION_HEX >= 0x02050000 /* 2.5.0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_index */ #elif PY_VERSION_HEX >= 0x02020000 /* 2.2.0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_true_divide */ @@ -644,8 +682,13 @@ _PySwigObject_type(void) { if (!type_init) { const PyTypeObject tmp = { - PyObject_HEAD_INIT(NULL) - 0, /* ob_size */ + /* PyOjbect header changed in Python 3 */ +#if PY_VERSION_HEX >= 0x03000000 + PyVarObject_HEAD_INIT(&PyType_Type, 0) +#else + PyObject_HEAD_INIT(NULL) + 0, /* ob_size */ +#endif (char *)"PySwigObject", /* tp_name */ sizeof(PySwigObject), /* tp_basicsize */ 0, /* tp_itemsize */ @@ -672,7 +715,7 @@ _PySwigObject_type(void) { swigobject_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ - 0, /* tp_richcompare */ + (richcmpfunc)PySwigObject_richcompare, /* tp_richcompare */ 0, /* tp_weaklistoffset */ #if PY_VERSION_HEX >= 0x02020000 0, /* tp_iter */ @@ -704,7 +747,10 @@ _PySwigObject_type(void) { #endif }; pyswigobject_type = tmp; + /* for Python 3 we already assigned the ob_type in PyVarObject_HEAD_INIT() */ +#if PY_VERSION_HEX < 0x03000000 pyswigobject_type.ob_type = &PyType_Type; +#endif type_init = 1; } return &pyswigobject_type; @@ -753,9 +799,9 @@ PySwigPacked_repr(PySwigPacked *v) { char result[SWIG_BUFFER_SIZE]; if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))) { - return PyString_FromFormat("", result, v->ty->name); + return SWIG_Python_str_FromFormat("", result, v->ty->name); } else { - return PyString_FromFormat("", v->ty->name); + return SWIG_Python_str_FromFormat("", v->ty->name); } } @@ -764,9 +810,9 @@ PySwigPacked_str(PySwigPacked *v) { char result[SWIG_BUFFER_SIZE]; if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))){ - return PyString_FromFormat("%s%s", result, v->ty->name); + return SWIG_Python_str_FromFormat("%s%s", result, v->ty->name); } else { - return PyString_FromString(v->ty->name); + return SWIG_Python_str_FromChar(v->ty->name); } } @@ -811,8 +857,13 @@ _PySwigPacked_type(void) { if (!type_init) { const PyTypeObject tmp = { + /* PyObject header changed in Python 3 */ +#if PY_VERSION_HEX>=0x03000000 + PyVarObject_HEAD_INIT(&PyType_Type, 0) +#else PyObject_HEAD_INIT(NULL) - 0, /* ob_size */ + 0, /* ob_size */ +#endif (char *)"PySwigPacked", /* tp_name */ sizeof(PySwigPacked), /* tp_basicsize */ 0, /* tp_itemsize */ @@ -867,7 +918,10 @@ _PySwigPacked_type(void) { #endif }; pyswigpacked_type = tmp; + /* for Python 3 the ob_type already assigned in PyVarObject_HEAD_INIT() */ +#if PY_VERSION_HEX < 0x03000000 pyswigpacked_type.ob_type = &PyType_Type; +#endif type_init = 1; } return &pyswigpacked_type; @@ -912,7 +966,7 @@ PySwigPacked_UnpackData(PyObject *obj, void *ptr, size_t size) SWIGRUNTIMEINLINE PyObject * _SWIG_This(void) { - return PyString_FromString("this"); + return SWIG_Python_str_FromChar("this"); } SWIGRUNTIME PyObject * @@ -924,6 +978,11 @@ SWIG_This(void) /* #define SWIG_PYTHON_SLOW_GETSET_THIS */ +/* TODO: I don't know how to implement the fast getset in Python 3 right now */ +#if PY_VERSION_HEX>=0x03000000 +#define SWIG_PYTHON_SLOW_GETSET_THIS +#endif + SWIGRUNTIME PySwigObject * SWIG_Python_GetSwigThis(PyObject *pyobj) { @@ -1161,10 +1220,17 @@ SWIG_Python_NewShadowInstance(PySwigClientData *data, PyObject *swig_this) #endif } } else { +#if PY_VERSION_HEX >= 0x03000000 + inst = PyBaseObject_Type.tp_new((PyTypeObject*) data->newargs, Py_None, Py_None); + Py_INCREF(data->newargs); + PyObject_SetAttr(inst, SWIG_This(), swig_this); + Py_TYPE(inst)->tp_flags &= ~Py_TPFLAGS_VALID_VERSION_TAG; +#else PyObject *dict = PyDict_New(); PyDict_SetItem(dict, SWIG_This(), swig_this); inst = PyInstance_NewRaw(data->newargs, dict); Py_DECREF(dict); +#endif } return inst; #else @@ -1344,8 +1410,13 @@ SWIGRUNTIME void SWIG_Python_SetModule(swig_module_info *swig_module) { static PyMethodDef swig_empty_runtime_method_table[] = { {NULL, NULL, 0, NULL} };/* Sentinel */ +#if PY_VERSION_HEX >= 0x03000000 + /* Add a dummy module object into sys.modules */ + PyObject *module = PyImport_AddModule((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION); +#else PyObject *module = Py_InitModule((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION, swig_empty_runtime_method_table); +#endif PyObject *pointer = PyCObject_FromVoidPtr((void *) swig_module, SWIG_Python_DestroyModule); if (pointer && module) { PyModule_AddObject(module, (char*)"type_pointer" SWIG_TYPE_TABLE_NAME, pointer); @@ -1365,7 +1436,7 @@ SWIGRUNTIME swig_type_info * SWIG_Python_TypeQuery(const char *type) { PyObject *cache = SWIG_Python_TypeCache(); - PyObject *key = PyString_FromString(type); + PyObject *key = SWIG_Python_str_FromChar(type); PyObject *obj = PyDict_GetItem(cache, key); swig_type_info *descriptor; if (obj) { @@ -1403,9 +1474,9 @@ SWIG_Python_AddErrMesg(const char* mesg, int infront) Py_XINCREF(type); PyErr_Clear(); if (infront) { - PyErr_Format(type, "%s %s", mesg, PyString_AsString(old_str)); + PyErr_Format(type, "%s %s", mesg, SWIG_Python_str_AsChar(old_str)); } else { - PyErr_Format(type, "%s %s", PyString_AsString(old_str), mesg); + PyErr_Format(type, "%s %s", SWIG_Python_str_AsChar(old_str), mesg); } Py_DECREF(old_str); } @@ -1454,7 +1525,7 @@ SWIG_Python_TypeError(const char *type, PyObject *obj) const char *otype = (obj ? obj->ob_type->tp_name : 0); if (otype) { PyObject *str = PyObject_Str(obj); - const char *cstr = str ? PyString_AsString(str) : 0; + const char *cstr = str ? SWIG_Python_str_AsChar(str) : 0; if (cstr) { PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s(%s)' is received", type, otype, cstr); diff --git a/Lib/python/pystrings.swg b/Lib/python/pystrings.swg index d4d60c42b..5a06792d7 100644 --- a/Lib/python/pystrings.swg +++ b/Lib/python/pystrings.swg @@ -5,10 +5,20 @@ SWIGINTERN int SWIG_AsCharPtrAndSize(PyObject *obj, char** cptr, size_t* psize, int *alloc) { - if (PyString_Check(obj)) { +%#if PY_VERSION_HEX>=0x03000000 + if (PyUnicode_Check(obj)) +%#else + if (PyString_Check(obj)) +%#endif + { char *cstr; Py_ssize_t len; +%#if PY_VERSION_HEX>=0x03000000 + obj = PyUnicode_AsUTF8String(obj); + PyBytes_AsStringAndSize(obj, &cstr, &len); +%#else PyString_AsStringAndSize(obj, &cstr, &len); - if (cptr) { +%#endif + if (cptr) { if (alloc) { /* In python the user should not be able to modify the inner @@ -33,7 +43,7 @@ SWIG_AsCharPtrAndSize(PyObject *obj, char** cptr, size_t* psize, int *alloc) *alloc = SWIG_OLDOBJ; } } else { - *cptr = PyString_AsString(obj); + *cptr = SWIG_Python_str_AsChar(obj); } } if (psize) *psize = len + 1; @@ -64,7 +74,11 @@ SWIG_FromCharPtrAndSize(const char* carray, size_t size) return pchar_descriptor ? SWIG_NewPointerObj(%const_cast(carray,char *), pchar_descriptor, 0) : SWIG_Py_Void(); } else { +%#if PY_VERSION_HEX >= 0x03000000 + return PyUnicode_FromStringAndSize(carray, %numeric_cast(size,int)); +%#else return PyString_FromStringAndSize(carray, %numeric_cast(size,int)); +%#endif } } else { return SWIG_Py_Void(); diff --git a/Lib/python/pythonkw.swg b/Lib/python/pythonkw.swg index f57d34ce4..2ee233516 100644 --- a/Lib/python/pythonkw.swg +++ b/Lib/python/pythonkw.swg @@ -2,8 +2,8 @@ Warnings for Python keywords, built-in names and bad names. */ -#define PYTHONKW(x) %keywordwarn(`x` " is a python keyword, symbol will be renamed as '_" `x`"'", rename="_%s") `x` -#define PYTHONBN(x) %builtinwarn(`x` " conflicts with a built-in name in python") "::"`x` +#define PYTHONKW(x) %keywordwarn("'" `x` "' is a python keyword, renaming to '_" `x` "'", rename="_%s") `x` +#define PYTHONBN(x) %builtinwarn("'" `x` "' conflicts with a built-in name in python") "::"`x` /* diff --git a/Lib/python/pywstrings.swg b/Lib/python/pywstrings.swg index 8254bf8f7..4161dcb0f 100644 --- a/Lib/python/pywstrings.swg +++ b/Lib/python/pywstrings.swg @@ -8,12 +8,14 @@ SWIG_AsWCharPtrAndSize(PyObject *obj, wchar_t **cptr, size_t *psize, int *alloc) { PyObject *tmp = 0; int isunicode = PyUnicode_Check(obj); +%#if PY_VERSION_HEX < 0x03000000 if (!isunicode && PyString_Check(obj)) { if (cptr) { obj = tmp = PyUnicode_FromObject(obj); } isunicode = 1; } +%#endif if (isunicode) { int len = PyUnicode_GetSize(obj); if (cptr) { diff --git a/Lib/python/std_map.i b/Lib/python/std_map.i index 12dc23ccf..b080731f0 100644 --- a/Lib/python/std_map.i +++ b/Lib/python/std_map.i @@ -22,6 +22,10 @@ int res = SWIG_ERROR; if (PyDict_Check(obj)) { PyObject_var items = PyObject_CallMethod(obj,(char *)"items",NULL); +%#if PY_VERSION_HEX >= 0x03000000 + /* In Python 3.x the ".items()" method return a dict_items object */ + items = PySequence_Fast(items, ".items() havn't returned a sequence!"); +%#endif res = traits_asptr_stdseq, std::pair >::asptr(items, val); } else { map_type *p; diff --git a/Lib/r/r.swg b/Lib/r/r.swg index 3095529a0..0a4d0c36e 100644 --- a/Lib/r/r.swg +++ b/Lib/r/r.swg @@ -12,6 +12,8 @@ SWIGEXPORT void SWIG_init(void) { %} +%include + #define %Rruntime %insert("s") #define SWIG_Object SEXP @@ -77,7 +79,7 @@ SWIG_InitializeModule(0); %typemap(scheck) int %{ if(length($input) > 1) { - Rf_warning("using only the first element of $input") + warning("using only the first element of $input") } %} diff --git a/Lib/r/rkw.swg b/Lib/r/rkw.swg new file mode 100644 index 000000000..2c181faa0 --- /dev/null +++ b/Lib/r/rkw.swg @@ -0,0 +1,32 @@ +/* + Warnings for R keywords, built-in names and bad names. +*/ + +#define RKW(x) %keywordwarn("'" `x` "' is a R keyword, renaming to '_" `x`"'", rename="_%s") `x` + +/* + Warnings for R reserved words taken from + http://cran.r-project.org/doc/manuals/R-lang.html#Reserved-words +*/ + +RKW(if); +RKW(else); +RKW(repeat); +RKW(while); +RKW(function); +RKW(for); +RKW(in); +RKW(next); +RKW(break); +RKW(TRUE); +RKW(FALSE); +RKW(NULL); +RKW(Inf); +RKW(NaN); +RKW(NA); +RKW(NA_integer_); +RKW(NA_real_); +RKW(NA_complex_); +RKW(NA_character_); + +#undef RKW diff --git a/Lib/ruby/rubycontainer.swg b/Lib/ruby/rubycontainer.swg index e3cae5778..919695ec2 100644 --- a/Lib/ruby/rubycontainer.swg +++ b/Lib/ruby/rubycontainer.swg @@ -691,10 +691,12 @@ namespace swig for ( ; i != e; ) { VALUE r = swig::from< Sequence::value_type >(*i); - if ( RTEST( rb_yield(r) ) ) + if ( RTEST( rb_yield(r) ) ) { $self->erase(i++); - else + e = self->end(); + } else { ++i; + } } return self; diff --git a/Lib/ruby/rubykw.swg b/Lib/ruby/rubykw.swg index fec47baff..194687b95 100644 --- a/Lib/ruby/rubykw.swg +++ b/Lib/ruby/rubykw.swg @@ -2,7 +2,7 @@ #define RUBY_RUBYKW_SWG_ /* Warnings for Ruby keywords */ -#define RUBYKW(x) %keywordwarn("'" `x` "' is a ruby keyword, and it will renamed as 'C_"`x`"'",rename="C_%s",fullname=1) `x` +#define RUBYKW(x) %keywordwarn("'" `x` "' is a ruby keyword, renaming to 'C_" `x` "'",rename="C_%s",fullname=1) `x` /* diff --git a/Lib/swiglabels.swg b/Lib/swiglabels.swg index 09de6c969..b943afb47 100644 --- a/Lib/swiglabels.swg +++ b/Lib/swiglabels.swg @@ -40,6 +40,12 @@ # endif #endif +#ifndef SWIG_MSC_UNSUPPRESS_4505 +# if defined(_MSC_VER) +# pragma warning(disable : 4505) /* unreferenced local function has been removed */ +# endif +#endif + #ifndef SWIGUNUSEDPARM # ifdef __cplusplus # define SWIGUNUSEDPARM(p) diff --git a/Lib/typemaps/primtypes.swg b/Lib/typemaps/primtypes.swg index c59aa1d1e..42728e5fe 100644 --- a/Lib/typemaps/primtypes.swg +++ b/Lib/typemaps/primtypes.swg @@ -283,6 +283,7 @@ _apply_macro(Macro, ptrdiff_t , Arg2); _apply_macro(Macro, std::size_t, Arg2); _apply_macro(Macro, std::ptrdiff_t, Arg2); _apply_macro(Macro, std::string, Arg2); +_apply_macro(Macro, std::wstring, Arg2); _apply_macro(Macro, std::complex, Arg2); _apply_macro(Macro, std::complex, Arg2); %enddef diff --git a/README b/README index 61550e558..2898130b0 100644 --- a/README +++ b/README @@ -1,6 +1,6 @@ SWIG (Simplified Wrapper and Interface Generator) -Version: 1.3.35 (7 April 2008) +Version: 1.3.36 (24 June 2008) Tagline: SWIG is a compiler that integrates C and C++ with languages including Perl, Python, Tcl, Ruby, PHP, Java, Ocaml, Lua, @@ -91,6 +91,13 @@ A SWIG FAQ and other hints can be found on the SWIG Wiki: What's New? =========== +SWIG-1.3.36 summary: +- Enhancement to directors to wrap all protected members +- Optimisation feature for objects returned by value +- A few bugs fixes in the PHP, Java, Ruby, R, C#, Python, Lua and + Perl modules +- Other minor generic bug fixes + SWIG-1.3.35 summary: - Octave language module added - Bug fixes in Python, Lua, Java, C#, Perl modules diff --git a/Source/CParse/cscanner.c b/Source/CParse/cscanner.c index 13e976b95..12556dcf6 100644 --- a/Source/CParse/cscanner.c +++ b/Source/CParse/cscanner.c @@ -420,23 +420,23 @@ int yylook(void) { return HBLOCK; case SWIG_TOKEN_COMMENT: - { - String *cmt = Scanner_text(scan); - char *loc = Char(cmt); - if ((strncmp(loc,"/*@SWIG@",6) == 0) && (loc[Len(cmt)-3] == '@')) { - scanner_locator(cmt); - } - if (strncmp(loc, "/**<", 4) == 0 || strncmp(loc, "///<", 4) == 0||strncmp(loc, "/*!<", 4) == 0||strncmp(loc, "//!<", 4) == 0) { - printf("Doxygen Post Comment: %s lines %d-%d [%s]\n", Char(Scanner_file(scan)), Scanner_start_line(scan), Scanner_line(scan), loc); - yylval.str = NewString(loc); - return DOXYGENPOSTSTRING; - } - if (strncmp(loc, "/**", 3) == 0 || strncmp(loc, "///", 3) == 0||strncmp(loc, "/*!", 3) == 0||strncmp(loc, "//!", 3) == 0) { - printf("Doxygen Comment: %s lines %d-%d [%s]\n", Char(Scanner_file(scan)), Scanner_start_line(scan), Scanner_line(scan), loc); - yylval.str = NewString(loc); - return DOXYGENSTRING; - } - } + { + String *cmt = Scanner_text(scan); + char *loc = Char(cmt); + if ((strncmp(loc,"/*@SWIG",7) == 0) && (loc[Len(cmt)-3] == '@')) { + scanner_locator(cmt); + } + if (strncmp(loc, "/**<", 4) == 0 || strncmp(loc, "///<", 4) == 0||strncmp(loc, "/*!<", 4) == 0||strncmp(loc, "//!<", 4) == 0) { + printf("Doxygen Post Comment: %s lines %d-%d [%s]\n", Char(Scanner_file(scan)), Scanner_start_line(scan), Scanner_line(scan), loc); + yylval.str = NewString(loc); + return DOXYGENPOSTSTRING; + } + if (strncmp(loc, "/**", 3) == 0 || strncmp(loc, "///", 3) == 0||strncmp(loc, "/*!", 3) == 0||strncmp(loc, "//!", 3) == 0) { + printf("Doxygen Comment: %s lines %d-%d [%s]\n", Char(Scanner_file(scan)), Scanner_start_line(scan), Scanner_line(scan), loc); + yylval.str = NewString(loc); + return DOXYGENSTRING; + } + } break; case SWIG_TOKEN_ENDLINE: break; @@ -700,7 +700,15 @@ int yylex(void) { termtoken = SWIG_TOKEN_LPAREN; termvalue = "("; break; - } else if (nexttok == SWIG_TOKEN_SEMI) { + } else if (nexttok == SWIG_TOKEN_CODEBLOCK) { + termtoken = SWIG_TOKEN_CODEBLOCK; + termvalue = Scanner_text(scan); + break; + } else if (nexttok == SWIG_TOKEN_LBRACE) { + termtoken = SWIG_TOKEN_LBRACE; + termvalue = "{"; + break; + } else if (nexttok == SWIG_TOKEN_SEMI) { termtoken = SWIG_TOKEN_SEMI; termvalue = ";"; break; @@ -869,8 +877,14 @@ int yylex(void) { return (INLINE); if (strcmp(yytext, "%typemap") == 0) return (TYPEMAP); - if (strcmp(yytext, "%feature") == 0) + if (strcmp(yytext, "%feature") == 0) { + /* The rename_active indicates we don't need the information of the + * following function's return type. This applied for %rename, so do + * %feature. + */ + rename_active = 1; return (FEATURE); + } if (strcmp(yytext, "%except") == 0) return (EXCEPT); if (strcmp(yytext, "%importfile") == 0) diff --git a/Source/CParse/parser.y b/Source/CParse/parser.y index 09aeb7381..d16a743e4 100644 --- a/Source/CParse/parser.y +++ b/Source/CParse/parser.y @@ -383,7 +383,9 @@ static void add_symbols(Node *n) { Delete(prefix); } - if (0 && !Getattr(n,"parentNode") && class_level) set_parentNode(n,class_decl[class_level - 1]); + /* + if (!Getattr(n,"parentNode") && class_level) set_parentNode(n,class_decl[class_level - 1]); + */ Setattr(n,"ismember","1"); } } @@ -2348,21 +2350,25 @@ feature_directive : FEATURE LPAREN idstring RPAREN declarator cpp_const stringbr String *val = $7 ? NewString($7) : NewString("1"); new_feature($3, val, 0, $5.id, $5.type, $5.parms, $6.qualifier); $$ = 0; + scanner_clear_rename(); } | FEATURE LPAREN idstring COMMA stringnum RPAREN declarator cpp_const SEMI { String *val = Len($5) ? NewString($5) : 0; new_feature($3, val, 0, $7.id, $7.type, $7.parms, $8.qualifier); $$ = 0; + scanner_clear_rename(); } | FEATURE LPAREN idstring featattr RPAREN declarator cpp_const stringbracesemi { String *val = $8 ? NewString($8) : NewString("1"); new_feature($3, val, $4, $6.id, $6.type, $6.parms, $7.qualifier); $$ = 0; + scanner_clear_rename(); } | FEATURE LPAREN idstring COMMA stringnum featattr RPAREN declarator cpp_const SEMI { String *val = Len($5) ? NewString($5) : 0; new_feature($3, val, $6, $8.id, $8.type, $8.parms, $9.qualifier); $$ = 0; + scanner_clear_rename(); } /* Global feature */ @@ -2370,21 +2376,25 @@ feature_directive : FEATURE LPAREN idstring RPAREN declarator cpp_const stringbr String *val = $5 ? NewString($5) : NewString("1"); new_feature($3, val, 0, 0, 0, 0, 0); $$ = 0; + scanner_clear_rename(); } | FEATURE LPAREN idstring COMMA stringnum RPAREN SEMI { String *val = Len($5) ? NewString($5) : 0; new_feature($3, val, 0, 0, 0, 0, 0); $$ = 0; + scanner_clear_rename(); } | FEATURE LPAREN idstring featattr RPAREN stringbracesemi { String *val = $6 ? NewString($6) : NewString("1"); new_feature($3, val, $4, 0, 0, 0, 0); $$ = 0; + scanner_clear_rename(); } | FEATURE LPAREN idstring COMMA stringnum featattr RPAREN SEMI { String *val = Len($5) ? NewString($5) : 0; new_feature($3, val, $6, 0, 0, 0, 0); $$ = 0; + scanner_clear_rename(); } ; @@ -4215,10 +4225,11 @@ cpp_destructor_decl : NOT idtemplate LPAREN parms RPAREN cpp_end { /* Check for template names. If the class is a template and the constructor is missing the template part, we add it */ - if (Classprefix && (c = strchr(Char(Classprefix),'<'))) { - if (!Strchr($3,'<')) { - $3 = NewStringf("%s%s",$3,c); - } + if (Classprefix) { + c = strchr(Char(Classprefix),'<'); + if (c && !Strchr($3,'<')) { + $3 = NewStringf("%s%s",$3,c); + } } Setattr($$,"storage","virtual"); name = NewStringf("%s",$3); @@ -4534,12 +4545,8 @@ parms : rawparms { ; rawparms : parm ptail { - if (1) { - set_nextSibling($1,$2); - $$ = $1; - } else { - $$ = $2; - } + set_nextSibling($1,$2); + $$ = $1; } | empty { $$ = 0; } ; @@ -4592,12 +4599,8 @@ valparms : rawvalparms { ; rawvalparms : valparm valptail { - if (1) { - set_nextSibling($1,$2); - $$ = $1; - } else { - $$ = $2; - } + set_nextSibling($1,$2); + $$ = $1; } | empty { $$ = 0; } ; diff --git a/Source/CParse/templ.c b/Source/CParse/templ.c index a1f0c8e08..a3e992f83 100644 --- a/Source/CParse/templ.c +++ b/Source/CParse/templ.c @@ -167,18 +167,21 @@ static int cparse_template_expand(Node *n, String *tname, String *rname, String add_parms(Getattr(n, "throws"), cpatchlist, typelist); } else if (Equal(nodeType, "destructor")) { String *name = Getattr(n, "name"); - if (name && strchr(Char(name), '<')) { - Append(patchlist, Getattr(n, "name")); - } else { - Append(name, templateargs); + if (name) { + if (strchr(Char(name), '<')) + Append(patchlist, Getattr(n, "name")); + else + Append(name, templateargs); } name = Getattr(n, "sym:name"); - if (name && strchr(Char(name), '<')) { - String *sn = Copy(tname); - Setattr(n, "sym:name", sn); - Delete(sn); - } else { - Replace(name, tname, rname, DOH_REPLACE_ANY); + if (name) { + if (strchr(Char(name), '<')) { + String *sn = Copy(tname); + Setattr(n, "sym:name", sn); + Delete(sn); + } else { + Replace(name, tname, rname, DOH_REPLACE_ANY); + } } /* Setattr(n,"sym:name",name); */ Append(cpatchlist, Getattr(n, "code")); @@ -281,13 +284,13 @@ int Swig_cparse_template_expand(Node *n, String *rname, ParmList *tparms, Symtab Delete(ptargs); } - if (0) { + /* Parm *p = tparms; while (p) { Printf(stdout, "tparm: '%s' '%s' '%s'\n", Getattr(p, "name"), Getattr(p, "type"), Getattr(p, "value")); p = nextSibling(p); } - } + */ /* Printf(stdout,"targs = '%s'\n", templateargs); Printf(stdout,"rname = '%s'\n", rname); diff --git a/Source/DOH/hash.c b/Source/DOH/hash.c index ccb94314a..62aef10f2 100644 --- a/Source/DOH/hash.c +++ b/Source/DOH/hash.c @@ -112,12 +112,11 @@ static void DelHash(DOH *ho) { int i; for (i = 0; i < h->hashsize; i++) { - if ((n = h->hashtable[i])) { - while (n) { - next = n->next; - DelNode(n); - n = next; - } + n = h->hashtable[i]; + while (n) { + next = n->next; + DelNode(n); + n = next; } } DohFree(h->hashtable); @@ -138,12 +137,11 @@ static void Hash_clear(DOH *ho) { int i; for (i = 0; i < h->hashsize; i++) { - if ((n = h->hashtable[i])) { - while (n) { - next = n->next; - DelNode(n); - n = next; - } + n = h->hashtable[i]; + while (n) { + next = n->next; + DelNode(n); + n = next; } h->hashtable[i] = 0; } @@ -454,11 +452,10 @@ static DOH *CopyHash(DOH *ho) { nho = DohObjMalloc(&DohHashType, nh); for (i = 0; i < h->hashsize; i++) { - if ((n = h->hashtable[i])) { - while (n) { - Hash_setattr(nho, n->key, n->object); - n = n->next; - } + n = h->hashtable[i]; + while (n) { + Hash_setattr(nho, n->key, n->object); + n = n->next; } } return nho; diff --git a/Source/Include/swigwarn.h b/Source/Include/swigwarn.h index 174e8b001..8c4678847 100644 --- a/Source/Include/swigwarn.h +++ b/Source/Include/swigwarn.h @@ -247,10 +247,17 @@ /* please leave 850-869 free for Modula 3 */ -#define WARN_PHP4_MULTIPLE_INHERITANCE 870 -#define WARN_PHP4_UNKNOWN_PRAGMA 871 +/* These are needed for backward compatibility, but you don't need to add + * PHP4 versions of new warnings since existing user interface files can't + * be using them. + */ +#define WARN_PHP4_MULTIPLE_INHERITANCE 870 +#define WARN_PHP4_UNKNOWN_PRAGMA 871 -/* please leave 870-889 free for Php */ +#define WARN_PHP_MULTIPLE_INHERITANCE 870 +#define WARN_PHP_UNKNOWN_PRAGMA 871 + +/* please leave 870-889 free for PHP */ /* Feel free to claim any number in this space that's not currently being used. Just make sure you diff --git a/Source/Makefile.am b/Source/Makefile.am index 1abe41cbd..65b5c6f6f 100644 --- a/Source/Makefile.am +++ b/Source/Makefile.am @@ -57,7 +57,7 @@ eswig_SOURCES = CParse/cscanner.c \ Modules/octave.cxx \ Modules/overload.cxx \ Modules/perl5.cxx \ - Modules/php4.cxx \ + Modules/php.cxx \ Modules/pike.cxx \ Modules/python.cxx \ Modules/r.cxx \ diff --git a/Source/Modules/allegrocl.cxx b/Source/Modules/allegrocl.cxx index 561997276..217c89b1f 100644 --- a/Source/Modules/allegrocl.cxx +++ b/Source/Modules/allegrocl.cxx @@ -1084,7 +1084,8 @@ void emit_synonym(Node *synonym) { of_ltype = lookup_defined_foreign_ltype(of_name); // Printf(f_clhead,";; from emit-synonym\n"); - Printf(f_clhead, "(swig-def-synonym-type %s\n %s\n %s)\n", syn_ltype, of_ltype, syn_type); + if( of_ltype ) + Printf(f_clhead, "(swig-def-synonym-type %s\n %s\n %s)\n", syn_ltype, of_ltype, syn_type); Delete(synonym_ns); Delete(of_ns_list); @@ -1521,6 +1522,8 @@ void ALLEGROCL::main(int argc, char *argv[]) { } + Preprocessor_define("SWIGALLEGROCL 1", 0); + allow_overloading(); } @@ -1531,7 +1534,7 @@ int ALLEGROCL::top(Node *n) { swig_package = unique_swig_package ? NewStringf("swig.%s", module_name) : NewString("swig"); - Printf(cl_filename, "%s%s.cl", SWIG_output_directory(), Swig_file_basename(Getattr(n,"infile"))); + Printf(cl_filename, "%s%s.cl", SWIG_output_directory(), module_name); f_cl = NewFile(cl_filename, "w"); if (!f_cl) { @@ -2271,7 +2274,7 @@ int ALLEGROCL::emit_dispatch_defun(Node *n) { return SWIG_OK; } -int ALLEGROCL::emit_defun(Node *n, File *f_cl) { +int ALLEGROCL::emit_defun(Node *n, File *fcl) { #ifdef ALLEGROCL_WRAP_DEBUG Printf(stderr, "emit_defun: ENTER... "); #endif @@ -2307,27 +2310,27 @@ int ALLEGROCL::emit_defun(Node *n, File *f_cl) { if (Generate_Wrapper) { String *extra_parms = id_converter_arguments(n)->noname_str(); if (Getattr(n, "sym:overloaded")) - Printf(f_cl, "(swig-defmethod (\"%s\" \"%s\"%s)\n", funcname, mangled_name, extra_parms); + Printf(fcl, "(swig-defmethod (\"%s\" \"%s\"%s)\n", funcname, mangled_name, extra_parms); else - Printf(f_cl, "(swig-defun (\"%s\" \"%s\"%s)\n", funcname, mangled_name, extra_parms); + Printf(fcl, "(swig-defun (\"%s\" \"%s\"%s)\n", funcname, mangled_name, extra_parms); Delete(extra_parms); } // Just C else { - Printf(f_cl, "(swig-defun (\"%s\" \"%s\")\n", funcname, Generate_Wrapper ? mangled_name : funcname); + Printf(fcl, "(swig-defun (\"%s\" \"%s\")\n", funcname, Generate_Wrapper ? mangled_name : funcname); } ////////////////////////////////////// // Lisp foreign call parameter list // ////////////////////////////////////// - Printf(f_cl, " ("); + Printf(fcl, " ("); /* Special cases */ if (ParmList_len(pl) == 0) { - Printf(f_cl, ":void"); + Printf(fcl, ":void"); /* } else if (any_varargs(pl)) { - Printf(f_cl, "#| varargs |#"); + Printf(fcl, "#| varargs |#"); varargs=1; */ } else { String *largs = NewString(""); @@ -2337,7 +2340,7 @@ int ALLEGROCL::emit_defun(Node *n, File *f_cl) { SwigType *argtype = Swig_cparse_type(Getattr(p, "tmap:ctype")); if (!first) { - Printf(f_cl, "\n "); + Printf(fcl, "\n "); } if (SwigType_isvarargs(argtype)) { @@ -2393,7 +2396,7 @@ int ALLEGROCL::emit_defun(Node *n, File *f_cl) { // if this parameter has been removed from the C/++ wrapper // it shouldn't be in the lisp wrapper either. if (!checkAttribute(p, "tmap:in:numinputs", "0")) { - Printf(f_cl, "(%s %s %s %s %s)", + Printf(fcl, "(%s %s %s %s %s)", // parms in the ff wrapper, but not in the lisp wrapper. (checkAttribute(p, "tmap:lin:numinputs", "0") ? ":p-" : ":p+"), argname, dispatchtype, ffitype, lisptype); @@ -2479,12 +2482,12 @@ int ALLEGROCL::emit_defun(Node *n, File *f_cl) { Replaceall(wrap->code, "$ldestructor", ldestructor); Delete(ldestructor); - Printf(f_cl, ")\n"); /* finish arg list */ + Printf(fcl, ")\n"); /* finish arg list */ ///////////////////////////////////////////////////// // Lisp foreign call return type and optimizations // ///////////////////////////////////////////////////// - Printf(f_cl, " (:returning (%s %s)", compose_foreign_type(result_type), get_lisp_type(Getattr(n, "type"), "result")); + Printf(fcl, " (:returning (%s %s)", compose_foreign_type(result_type), get_lisp_type(Getattr(n, "type"), "result")); for (Iterator option = First(n); option.item; option = Next(option)) { if (Strncmp("feature:ffargs:", option.key, 15)) @@ -2494,12 +2497,12 @@ int ALLEGROCL::emit_defun(Node *n, File *f_cl) { Replaceall(option_name, "_", "-"); // TODO: varargs vs call-direct ? - Printf(f_cl, "\n %s %s", option_name, option_val); + Printf(fcl, "\n %s %s", option_name, option_val); Delete(option_name); } - Printf(f_cl, ")\n %s)\n\n", wrap->code); + Printf(fcl, ")\n %s)\n\n", wrap->code); // Wrapper_print(wrap, stderr); Delete(result_type); @@ -2518,6 +2521,8 @@ int ALLEGROCL::functionWrapper(Node *n) { ParmList *parms = CopyParmList(Getattr(n, "parms")); Wrapper *f = NewWrapper(); + SwigType *t = Getattr(n, "type"); + String *name = Getattr(n, "name"); String *raw_return_type = Swig_typemap_lookup("ctype", n, "", 0); SwigType *return_type = Swig_cparse_type(raw_return_type); @@ -2556,7 +2561,7 @@ int ALLEGROCL::functionWrapper(Node *n) { if (Getattr(n, "overload:ignore")) { // if we're the last overload, make sure to force the emit // of the rest of the overloads before we leave. - Printf(stderr, "ignored overload %s(%x)\n", Getattr(n, "name"), Getattr(n, "sym:nextSibling")); + Printf(stderr, "ignored overload %s(%x)\n", name, Getattr(n, "sym:nextSibling")); if (!Getattr(n, "sym:nextSibling")) { update_package_if_needed(n); emit_buffered_defuns(n); @@ -2571,7 +2576,7 @@ int ALLEGROCL::functionWrapper(Node *n) { int gencomma = 0; #ifdef ALLEGROCL_DEBUG - Printf(stderr, "Walking parameters for %s '%s'\n", Getattr(n, "allegrocl:kind"), Getattr(n, "name")); + Printf(stderr, "Walking parameters for %s '%s'\n", Getattr(n, "allegrocl:kind"), name); #endif // Now walk the function parameter list and generate code to get arguments String *name_and_parms = NewStringf("%s (", mangled); @@ -2625,12 +2630,16 @@ int ALLEGROCL::functionWrapper(Node *n) { String *actioncode = emit_action(n); - String *result_convert = Swig_typemap_lookup_out("out", n, "result", f, actioncode); - Replaceall(result_convert, "$result", "lresult"); - Printf(f->code, "%s\n", result_convert); - Printf(f->code, " return lresult;\n"); - Delete(result_convert); - emit_return_variable(n, Getattr(n, "type"), f); + String *tm = Swig_typemap_lookup_out("out", n, "result", f, actioncode); + if (!is_void_return && tm) { + Replaceall(tm, "$result", "lresult"); + Printf(f->code, "%s\n", tm); + Printf(f->code, " return lresult;\n"); + Delete(tm); + } else { + Swig_warning(WARN_TYPEMAP_OUT_UNDEF, input_file, line_number, "Unable to use return type %s in function %s.\n", SwigType_str(t, 0), name); + } + emit_return_variable(n, t, f); if (CPlusPlus) { Printf(f->code, " } catch (...) {\n"); @@ -2935,11 +2944,9 @@ int ALLEGROCL::classHandler(Node *n) { #endif if (Generate_Wrapper) - return cppClassHandler(n); + return cppClassHandler(n); else - return cClassHandler(n); - - return SWIG_OK; + return cClassHandler(n); } int ALLEGROCL::cClassHandler(Node *n) { diff --git a/Source/Modules/cffi.cxx b/Source/Modules/cffi.cxx index fb37392e8..4b3ddac70 100644 --- a/Source/Modules/cffi.cxx +++ b/Source/Modules/cffi.cxx @@ -444,7 +444,7 @@ int CFFI::functionWrapper(Node *n) { String *result_convert = Swig_typemap_lookup_out("out", n, "result", f, actioncode); Replaceall(result_convert, "$result", "lresult"); Printf(f->code, "%s\n", result_convert); - Printf(f->code, " return lresult;\n"); + if(!is_void_return) Printf(f->code, " return lresult;\n"); Delete(result_convert); emit_return_variable(n, Getattr(n, "type"), f); @@ -630,7 +630,7 @@ int CFFI::enumDeclaration(Node *n) { else { String *type = Getattr(c, "type"); String *converted_value = convert_literal(value, type); - Printf(f_cl, "\n\t(%s %s)", slot_name, converted_value); + Printf(f_cl, "\n\t(%s #.%s)", slot_name, converted_value); Delete(converted_value); } Delete(value); @@ -673,7 +673,7 @@ void CFFI::emit_class(Node *n) { Printf(supers, ")"); Printf(f_clos, "\n(cl:defclass %s%s", lisp_name, supers); - Printf(f_clos, "\n ((ff :reader ff-pointer)))\n\n"); + Printf(f_clos, "\n ((ff-pointer :reader ff-pointer)))\n\n"); Parm *pattern = NewParm(Getattr(n, "name"), NULL); diff --git a/Source/Modules/chicken.cxx b/Source/Modules/chicken.cxx index a76e09945..2298d2939 100644 --- a/Source/Modules/chicken.cxx +++ b/Source/Modules/chicken.cxx @@ -329,7 +329,6 @@ int CHICKEN::functionWrapper(Node *n) { Parm *p; int i; String *wname; - String *source; Wrapper *f; String *mangle = NewString(""); String *get_pointers; @@ -398,8 +397,6 @@ int CHICKEN::functionWrapper(Node *n) { SwigType *pt = Getattr(p, "type"); String *ln = Getattr(p, "lname"); - source = NewStringf("scm%d", i + 1); - Printf(f->def, ", C_word scm%d", i + 1); Printf(declfunc, ",C_word"); @@ -407,6 +404,7 @@ int CHICKEN::functionWrapper(Node *n) { if ((tm = Getattr(p, "tmap:in"))) { String *parse = Getattr(p, "tmap:in:parse"); if (!parse) { + String *source = NewStringf("scm%d", i + 1); Replaceall(tm, "$source", source); Replaceall(tm, "$target", ln); Replaceall(tm, "$input", source); @@ -445,20 +443,15 @@ int CHICKEN::functionWrapper(Node *n) { } } } - - } else { + Delete(source); } - p = Getattr(p, "tmap:in:next"); continue; } else { Swig_warning(WARN_TYPEMAP_IN_UNDEF, input_file, line_number, "Unable to use type %s as a function argument.\n", SwigType_str(pt, 0)); break; } - - Delete(source); - p = nextSibling(p); } /* finish argument marshalling */ @@ -1510,7 +1503,7 @@ int CHICKEN::validIdentifier(String *s) { /* ------------------------------------------------------------ * closNameMapping() * Maps the identifier from C++ to the CLOS based on command - * line paramaters and such. + * line parameters and such. * If class_name = "" that means the mapping is for a function or * variable not attached to any class. * ------------------------------------------------------------ */ diff --git a/Source/Modules/csharp.cxx b/Source/Modules/csharp.cxx index df4677e26..431181355 100644 --- a/Source/Modules/csharp.cxx +++ b/Source/Modules/csharp.cxx @@ -1073,7 +1073,9 @@ public: global_variable_flag = false; generate_property_declaration_flag = false; - Printf(module_class_code, "\n }\n\n"); + if (proxy_flag) { + Printf(module_class_code, "\n }\n\n"); + } return ret; } @@ -1885,6 +1887,7 @@ public: bool setter_flag = false; String *pre_code = NewString(""); String *post_code = NewString(""); + String *terminator_code = NewString(""); if (!proxy_flag) return; @@ -1924,7 +1927,7 @@ public: Swig_warning(WARN_CSHARP_TYPEMAP_CSWTYPE_UNDEF, input_file, line_number, "No cstype typemap defined for %s\n", SwigType_str(t, 0)); } - if (proxy_flag && wrapping_member_flag && !enum_constant_flag) { + if (wrapping_member_flag && !enum_constant_flag) { // Properties setter_flag = (Cmp(Getattr(n, "sym:name"), Swig_name_set(Swig_name_member(proxy_class_name, variable_name))) == 0); if (setter_flag) @@ -1996,7 +1999,8 @@ public: if (!(variable_wrapper_flag && i == 0)) { SwigType *pt = Getattr(p, "type"); String *param_type = NewString(""); - last_parm = p; + if (setter_flag) + last_parm = p; /* Get the C# parameter type */ if ((tm = Getattr(p, "tmap:cstype"))) { @@ -2032,6 +2036,14 @@ public: Printf(post_code, "\n"); Printv(post_code, post, NIL); } + String *terminator = Getattr(p, "tmap:csin:terminator"); + if (terminator) { + substituteClassname(pt, terminator); + Replaceall(terminator, "$csinput", arg); + if (Len(terminator_code) > 0) + Insert(terminator_code, 0, "\n"); + Insert(terminator_code, 0, terminator); + } Printv(imcall, tm, NIL); } else { Swig_warning(WARN_CSHARP_TYPEMAP_CSIN_UNDEF, input_file, line_number, "No csin typemap defined for %s\n", SwigType_str(pt, 0)); @@ -2057,7 +2069,8 @@ public: excodeSubstitute(n, tm, "csout", n); bool is_pre_code = Len(pre_code) > 0; bool is_post_code = Len(post_code) > 0; - if (is_pre_code || is_post_code) { + bool is_terminator_code = Len(terminator_code) > 0; + if (is_pre_code || is_post_code || is_terminator_code) { Replaceall(tm, "\n ", "\n "); // add extra indentation to code in typemap if (is_post_code) { Insert(tm, 0, "\n try "); @@ -2069,6 +2082,9 @@ public: Insert(tm, 0, pre_code); Insert(tm, 0, "\n"); } + if (is_terminator_code) { + Printv(tm, "\n", terminator_code, NIL); + } Insert(tm, 0, "{"); Printf(tm, "\n }"); } @@ -2107,7 +2123,7 @@ public: Swig_warning(WARN_CSHARP_TYPEMAP_CSOUT_UNDEF, input_file, line_number, "No csout typemap defined for %s\n", SwigType_str(t, 0)); } - if (proxy_flag && wrapping_member_flag && !enum_constant_flag) { + if (wrapping_member_flag && !enum_constant_flag) { // Properties if (generate_property_declaration_flag) { // Ensure the declaration is generated just once should the property contain both a set and get // Get the C# variable type - obtained differently depending on whether a setter is required. @@ -2168,6 +2184,7 @@ public: Delete(pre_code); Delete(post_code); + Delete(terminator_code); Delete(function_code); Delete(return_type); Delete(imcall); @@ -2188,6 +2205,7 @@ public: String *helper_args = NewString(""); String *pre_code = NewString(""); String *post_code = NewString(""); + String *terminator_code = NewString(""); String *im_return_type = NewString(""); bool feature_director = (parentNode(n) && Swig_directorclass(n)); @@ -2283,6 +2301,14 @@ public: Printf(post_code, "\n"); Printv(post_code, post, NIL); } + String *terminator = Getattr(p, "tmap:csin:terminator"); + if (terminator) { + substituteClassname(pt, terminator); + Replaceall(terminator, "$csinput", arg); + if (Len(terminator_code) > 0) + Insert(terminator_code, 0, "\n"); + Insert(terminator_code, 0, terminator); + } cshin = Getattr(p, "tmap:csin:cshin"); if (cshin) Replaceall(cshin, "$csinput", arg); @@ -2339,7 +2365,8 @@ public: bool is_pre_code = Len(pre_code) > 0; bool is_post_code = Len(post_code) > 0; - if (is_pre_code || is_post_code) { + bool is_terminator_code = Len(terminator_code) > 0; + if (is_pre_code || is_post_code || is_terminator_code) { Printf(helper_code, " {\n"); if (is_pre_code) { Printv(helper_code, pre_code, "\n", NIL); @@ -2351,6 +2378,9 @@ public: } else { Printv(helper_code, " return ", imcall, ";", NIL); } + if (is_terminator_code) { + Printv(helper_code, "\n", terminator_code, NIL); + } Printf(helper_code, "\n }\n"); String *helper_name = NewStringf("%s.SwigConstruct%s(%s)", proxy_class_name, proxy_class_name, helper_args); String *im_outattributes = Getattr(n, "tmap:imtype:outattributes"); @@ -2369,6 +2399,7 @@ public: Delete(im_return_type); Delete(pre_code); Delete(post_code); + Delete(terminator_code); Delete(construct_tm); Delete(attributes); Delete(overloaded_name); @@ -2486,6 +2517,7 @@ public: bool setter_flag = false; String *pre_code = NewString(""); String *post_code = NewString(""); + String *terminator_code = NewString(""); if (l) { if (SwigType_type(Getattr(l, "type")) == T_VOID) { @@ -2541,6 +2573,7 @@ public: num_arguments = emit_num_arguments(l); num_required = emit_num_required(l); + bool global_or_member_variable = global_variable_flag || (wrapping_member_flag && !enum_constant_flag); int gencomma = 0; /* Output each parameter */ @@ -2567,7 +2600,7 @@ public: if (gencomma) Printf(imcall, ", "); - String *arg = makeParameterName(n, p, i, setter_flag); + String *arg = makeParameterName(n, p, i, global_or_member_variable); // Use typemaps to transform type used in C# wrapper function (in proxy class) to type used in PInvoke function (in intermediary class) if ((tm = Getattr(p, "tmap:csin"))) { @@ -2589,6 +2622,14 @@ public: Printf(post_code, "\n"); Printv(post_code, post, NIL); } + String *terminator = Getattr(p, "tmap:csin:terminator"); + if (terminator) { + substituteClassname(pt, terminator); + Replaceall(terminator, "$csinput", arg); + if (Len(terminator_code) > 0) + Insert(terminator_code, 0, "\n"); + Insert(terminator_code, 0, terminator); + } Printv(imcall, tm, NIL); } else { Swig_warning(WARN_CSHARP_TYPEMAP_CSIN_UNDEF, input_file, line_number, "No csin typemap defined for %s\n", SwigType_str(pt, 0)); @@ -2613,7 +2654,8 @@ public: excodeSubstitute(n, tm, "csout", n); bool is_pre_code = Len(pre_code) > 0; bool is_post_code = Len(post_code) > 0; - if (is_pre_code || is_post_code) { + bool is_terminator_code = Len(terminator_code) > 0; + if (is_pre_code || is_post_code || is_terminator_code) { Replaceall(tm, "\n ", "\n "); // add extra indentation to code in typemap if (is_post_code) { Insert(tm, 0, "\n try "); @@ -2625,6 +2667,9 @@ public: Insert(tm, 0, pre_code); Insert(tm, 0, "\n"); } + if (is_terminator_code) { + Printv(tm, "\n", terminator_code, NIL); + } Insert(tm, 0, "{"); Printf(tm, "\n }"); } @@ -2700,6 +2745,7 @@ public: Delete(pre_code); Delete(post_code); + Delete(terminator_code); Delete(function_code); Delete(return_type); Delete(imcall); @@ -2755,7 +2801,7 @@ public: value = Getattr(n, "enumvalue") ? Copy(Getattr(n, "enumvalue")) : Copy(Getattr(n, "enumvalueex")); } else { // Get the enumvalue from a PINVOKE call - if (!getCurrentClass() || !cparse_cplusplus) { + if (!getCurrentClass() || !cparse_cplusplus || !proxy_flag) { // Strange hack to change the name Setattr(n, "name", Getattr(n, "value")); /* for wrapping of enums in a namespace when emit_action is used */ constantWrapper(n); @@ -2877,7 +2923,7 @@ public: * n - Node * p - parameter node * arg_num - parameter argument number - * setter - set this flag when wrapping member variables + * setter - set this flag when wrapping variables * Return: * arg - a unique parameter name * ----------------------------------------------------------------------------- */ @@ -2886,20 +2932,22 @@ public: String *arg = 0; String *pn = Getattr(p, "name"); - if (setter) { + + // Use C parameter name unless it is a duplicate or an empty parameter name + int count = 0; + ParmList *plist = Getattr(n, "parms"); + while (plist) { + if ((Cmp(pn, Getattr(plist, "name")) == 0)) + count++; + plist = nextSibling(plist); + } + String *wrn = pn ? Swig_name_warning(p, 0, pn, 0) : 0; + arg = (!pn || (count > 1) || wrn) ? NewStringf("arg%d", arg_num) : Copy(pn); + + if (setter && Cmp(arg, "self") != 0) { // Note that in C# properties, the input variable name is always called 'value' + Delete(arg); arg = NewString("value"); - } else { - // Use C parameter name unless it is a duplicate or an empty parameter name - int count = 0; - ParmList *plist = Getattr(n, "parms"); - while (plist) { - if ((Cmp(pn, Getattr(plist, "name")) == 0)) - count++; - plist = nextSibling(plist); - } - String *wrn = pn ? Swig_name_warning(p, 0, pn, 0) : 0; - arg = (!pn || (count > 1) || wrn) ? NewStringf("arg%d", arg_num) : Copy(pn); } return arg; diff --git a/Source/Modules/guile.cxx b/Source/Modules/guile.cxx index 2390e8ad6..f5f080034 100644 --- a/Source/Modules/guile.cxx +++ b/Source/Modules/guile.cxx @@ -1649,7 +1649,7 @@ public: /* ------------------------------------------------------------ * goopsNameMapping() * Maps the identifier from C++ to the GOOPS based * on command - * line paramaters and such. + * line parameters and such. * If class_name = "" that means the mapping is for a function or * variable not attached to any class. * ------------------------------------------------------------ */ diff --git a/Source/Modules/java.cxx b/Source/Modules/java.cxx index a21e37bf4..961f9098c 100644 --- a/Source/Modules/java.cxx +++ b/Source/Modules/java.cxx @@ -2016,7 +2016,7 @@ public: Swig_warning(WARN_JAVA_TYPEMAP_JSTYPE_UNDEF, input_file, line_number, "No jstype typemap defined for %s\n", SwigType_str(t, 0)); } - if (proxy_flag && wrapping_member_flag && !enum_constant_flag) { + if (wrapping_member_flag && !enum_constant_flag) { // For wrapping member variables (Javabean setter) setter_flag = (Cmp(Getattr(n, "sym:name"), Swig_name_set(Swig_name_member(proxy_class_name, variable_name))) == 0); } @@ -2578,6 +2578,7 @@ public: num_arguments = emit_num_arguments(l); num_required = emit_num_required(l); + bool global_or_member_variable = global_variable_flag || (wrapping_member_flag && !enum_constant_flag); int gencomma = 0; /* Output each parameter */ @@ -2602,7 +2603,7 @@ public: if (gencomma) Printf(imcall, ", "); - String *arg = makeParameterName(n, p, i, setter_flag); + String *arg = makeParameterName(n, p, i, global_or_member_variable); // Use typemaps to transform type used in Java wrapper function (in proxy class) to type used in JNI function (in intermediary class) if ((tm = Getattr(p, "tmap:javain"))) { @@ -2747,7 +2748,7 @@ public: value = Getattr(n, "enumvalue") ? Copy(Getattr(n, "enumvalue")) : Copy(Getattr(n, "enumvalueex")); } else { // Get the enumvalue from a JNI call - if (!getCurrentClass() || !cparse_cplusplus) { + if (!getCurrentClass() || !cparse_cplusplus || !proxy_flag) { // Strange hack to change the name Setattr(n, "name", Getattr(n, "value")); /* for wrapping of enums in a namespace when emit_action is used */ constantWrapper(n); @@ -2874,7 +2875,7 @@ public: * n - Node * p - parameter node * arg_num - parameter argument number - * setter - set this flag when wrapping member variables + * setter - set this flag when wrapping variables * Return: * arg - a unique parameter name * ----------------------------------------------------------------------------- */ @@ -2883,21 +2884,23 @@ public: String *arg = 0; String *pn = Getattr(p, "name"); - if (setter) { + + // Use C parameter name unless it is a duplicate or an empty parameter name + int count = 0; + ParmList *plist = Getattr(n, "parms"); + while (plist) { + if ((Cmp(pn, Getattr(plist, "name")) == 0)) + count++; + plist = nextSibling(plist); + } + String *wrn = pn ? Swig_name_warning(p, 0, pn, 0) : 0; + arg = (!pn || (count > 1) || wrn) ? NewStringf("arg%d", arg_num) : Copy(pn); + + if (setter && Cmp(arg, "self") != 0) { // Note that for setters the parameter name is always set but sometimes includes C++ // scope resolution, so we need to strip off the scope resolution to make a valid name. + Delete(arg); arg = NewString("value"); //Swig_scopename_last(pn); - } else { - // Use C parameter name unless it is a duplicate or an empty parameter name - int count = 0; - ParmList *plist = Getattr(n, "parms"); - while (plist) { - if ((Cmp(pn, Getattr(plist, "name")) == 0)) - count++; - plist = nextSibling(plist); - } - String *wrn = pn ? Swig_name_warning(p, 0, pn, 0) : 0; - arg = (!pn || (count > 1) || wrn) ? NewStringf("arg%d", arg_num) : Copy(pn); } return arg; diff --git a/Source/Modules/lang.cxx b/Source/Modules/lang.cxx index 368dc2c85..e2fd93f7b 100644 --- a/Source/Modules/lang.cxx +++ b/Source/Modules/lang.cxx @@ -1105,38 +1105,33 @@ int Language::globalfunctionHandler(Node *n) { String *name = Getattr(n, "name"); String *symname = Getattr(n, "sym:name"); SwigType *type = Getattr(n, "type"); - String *storage = Getattr(n, "storage"); ParmList *parms = Getattr(n, "parms"); - if (0 && (Cmp(storage, "static") == 0)) { - Swig_restore(n); - return SWIG_NOWRAP; /* Can't wrap static functions */ - } else { - /* Check for callback mode */ - String *cb = GetFlagAttr(n, "feature:callback"); - if (cb) { - String *cbname = Getattr(n, "feature:callback:name"); - if (!cbname) { - cbname = NewStringf(cb, symname); - Setattr(n, "feature:callback:name", cbname); - } - - callbackfunctionHandler(n); - if (Cmp(cbname, symname) == 0) { - Delete(cbname); - Swig_restore(n); - return SWIG_NOWRAP; - } - Delete(cbname); + /* Check for callback mode */ + String *cb = GetFlagAttr(n, "feature:callback"); + if (cb) { + String *cbname = Getattr(n, "feature:callback:name"); + if (!cbname) { + cbname = NewStringf(cb, symname); + Setattr(n, "feature:callback:name", cbname); } - Setattr(n, "parms", nonvoid_parms(parms)); - String *call = Swig_cfunction_call(name, parms); - String *cres = Swig_cresult(type, "result", call); - Setattr(n, "wrap:action", cres); - Delete(cres); - Delete(call); - functionWrapper(n); + + callbackfunctionHandler(n); + if (Cmp(cbname, symname) == 0) { + Delete(cbname); + Swig_restore(n); + return SWIG_NOWRAP; + } + Delete(cbname); } + Setattr(n, "parms", nonvoid_parms(parms)); + String *call = Swig_cfunction_call(name, parms); + String *cres = Swig_cresult(type, "result", call); + Setattr(n, "wrap:action", cres); + Delete(cres); + Delete(call); + functionWrapper(n); + Swig_restore(n); return SWIG_OK; } @@ -1384,9 +1379,6 @@ int Language::variableHandler(Node *n) { * ---------------------------------------------------------------------- */ int Language::globalvariableHandler(Node *n) { - String *storage = Getattr(n, "storage"); - if (0 && (Cmp(storage, "static") == 0)) - return SWIG_NOWRAP; variableWrapper(n); return SWIG_OK; } @@ -2116,8 +2108,8 @@ int Language::classDirector(Node *n) { String *using_protected_members_code = NewString(""); for (ni = Getattr(n, "firstChild"); ni; ni = nextSibling(ni)) { Node *nodeType = Getattr(ni, "nodeType"); - bool cdecl = (Cmp(nodeType, "cdecl") == 0); - if (cdecl && !GetFlag(ni, "feature:ignore")) { + bool cdeclaration = (Cmp(nodeType, "cdecl") == 0); + if (cdeclaration && !GetFlag(ni, "feature:ignore")) { if (is_non_virtual_protected_access(ni)) { Node *overloaded = Getattr(ni, "sym:overloaded"); // emit the using base::member statement (but only once if the method is overloaded) @@ -3410,7 +3402,8 @@ int Language::is_assignable(Node *n) { SwigType *ftd = SwigType_typedef_resolve_all(type); SwigType *td = SwigType_strip_qualifiers(ftd); if (SwigType_type(td) == T_USER) { - if ((cn = Swig_symbol_clookup(td, 0))) { + cn = Swig_symbol_clookup(td, 0); + if (cn) { if ((Strcmp(nodeType(cn), "class") == 0)) { if (Getattr(cn, "allocate:noassign")) { SetFlag(n, "feature:immutable"); diff --git a/Source/Modules/lua.cxx b/Source/Modules/lua.cxx index f46c9e809..6113da960 100644 --- a/Source/Modules/lua.cxx +++ b/Source/Modules/lua.cxx @@ -490,8 +490,6 @@ public: Swig_warning(WARN_TYPEMAP_IN_UNDEF, input_file, line_number, "Unable to use type %s as a function argument.\n", SwigType_str(pt, 0)); break; } - - p = nextSibling(p); } // add all argcheck code @@ -1101,7 +1099,6 @@ public: virtual int staticmemberfunctionHandler(Node *n) { current = STATIC_FUNC; return Language::staticmemberfunctionHandler(n); - current = NO_CPP; } /* ------------------------------------------------------------ @@ -1123,7 +1120,6 @@ public: // REPORT("staticmembervariableHandler",n); current = STATIC_VAR; return Language::staticmembervariableHandler(n); - current = NO_CPP; } /* --------------------------------------------------------------------- diff --git a/Source/Modules/main.cxx b/Source/Modules/main.cxx index 3453f5de2..901ee812e 100644 --- a/Source/Modules/main.cxx +++ b/Source/Modules/main.cxx @@ -33,7 +33,7 @@ int GenerateDefault = 1; // Generate default constructors int Verbose = 0; int AddExtern = 0; int NoExcept = 0; -int SwigRuntime = 0; // 0 = no option, 1 = -c or -runtime, 2 = -noruntime +int SwigRuntime = 0; // 0 = no option, 1 = -runtime, 2 = -noruntime /* Suppress warning messages for private inheritance, preprocessor evaluation etc... WARN_PP_EVALUATION 202 @@ -491,13 +491,13 @@ void SWIG_getoptions(int argc, char *argv[]) { Wrapper_compact_print_mode_set(1); Wrapper_virtual_elimination_mode_set(1); Swig_mark_arg(i); - } else if (strcmp(argv[i], "-runtime") == 0) { + } else if (strcmp(argv[i], "-runtime") == 0) { // Used to also accept -c. removed in swig-1.3.36 Swig_mark_arg(i); - Swig_warning(WARN_DEPRECATED_OPTC, "SWIG", 1, "-c, -runtime, -noruntime command line options are deprecated.\n"); + Swig_warning(WARN_DEPRECATED_OPTC, "SWIG", 1, "-runtime, -noruntime command line options are deprecated.\n"); SwigRuntime = 1; - } else if ((strcmp(argv[i], "-c") == 0) || (strcmp(argv[i], "-noruntime") == 0)) { + } else if (strcmp(argv[i], "-noruntime") == 0) { Swig_mark_arg(i); - Swig_warning(WARN_DEPRECATED_OPTC, "SWIG", 1, "-c, -runtime, -noruntime command line options are deprecated.\n"); + Swig_warning(WARN_DEPRECATED_OPTC, "SWIG", 1, "-runtime, -noruntime command line options are deprecated.\n"); SwigRuntime = 2; } else if (strcmp(argv[i], "-external-runtime") == 0) { external_runtime = 1; diff --git a/Source/Modules/modula3.cxx b/Source/Modules/modula3.cxx index 99d28e167..6cb24d39a 100644 --- a/Source/Modules/modula3.cxx +++ b/Source/Modules/modula3.cxx @@ -472,9 +472,9 @@ MODULA3(): cap = true; } else { if (cap) { - m3sym[i] = toupper(c); + m3sym[i] = (char)toupper(c); } else { - m3sym[i] = tolower(c); + m3sym[i] = (char)tolower(c); } cap = false; } diff --git a/Source/Modules/ocaml.cxx b/Source/Modules/ocaml.cxx index 9f5677ba5..0d0f4c7f2 100755 --- a/Source/Modules/ocaml.cxx +++ b/Source/Modules/ocaml.cxx @@ -1292,56 +1292,50 @@ public: * which means looking up and registering by typedef and enum name. */ int enumDeclaration(Node *n) { String *name = Getattr(n, "name"); - String *oname = name ? NewString(name) : NULL; - /* name is now fully qualified */ - String *fully_qualified_name = NewString(name); - bool seen_enum = false; - if (name_qualifier) - Delete(name_qualifier); - char *strip_position; - name_qualifier = fully_qualify_enum_name(n, NewString("")); + if (name) { + String *oname = NewString(name); + /* name is now fully qualified */ + String *fully_qualified_name = NewString(name); + bool seen_enum = false; + if (name_qualifier) + Delete(name_qualifier); + char *strip_position; + name_qualifier = fully_qualify_enum_name(n, NewString("")); - /* Recent changes have distrubed enum and template naming again. - * Will try to keep it consistent by can't guarantee much given - * that these things move around a lot. - * - * I need to figure out a way to isolate this module better. - */ - if (oname) { strip_position = strstr(Char(oname), "::"); while (strip_position) { - strip_position += 2; - oname = NewString(strip_position); - strip_position = strstr(Char(oname), "::"); - } - } - - seen_enum = oname ? (Getattr(seen_enums, fully_qualified_name) ? true : false) : false; - - if (oname && !seen_enum) { - const_enum = true; - Printf(f_enum_to_int, "| `%s -> (match y with\n", oname); - Printf(f_int_to_enum, "| `%s -> C_enum (\n", oname); - /* * * * A note about enum name resolution * * * * - * This code should now work, but I think we can do a bit better. - * The problem I'm having is that swig isn't very precise about - * typedef name resolution. My opinion is that SwigType_typedef - * resolve_all should *always* return the enum tag if one exists, - * rather than the admittedly friendlier enclosing typedef. - * - * This would make one of the cases below unnecessary. - * * * */ - Printf(f_mlbody, "let _ = Callback.register \"%s_marker\" (`%s)\n", fully_qualified_name, oname); - if (!strncmp(Char(fully_qualified_name), "enum ", 5)) { - String *fq_noenum = NewString(Char(fully_qualified_name) + 5); - Printf(f_mlbody, - "let _ = Callback.register \"%s_marker\" (`%s)\n" "let _ = Callback.register \"%s_marker\" (`%s)\n", fq_noenum, oname, fq_noenum, name); + strip_position += 2; + oname = NewString(strip_position); + strip_position = strstr(Char(oname), "::"); } - Printf(f_enumtypes_type, "| `%s\n", oname); - Insert(fully_qualified_name, 0, "enum "); - Setattr(seen_enums, fully_qualified_name, n); + seen_enum = (Getattr(seen_enums, fully_qualified_name) ? true : false); + + if (!seen_enum) { + const_enum = true; + Printf(f_enum_to_int, "| `%s -> (match y with\n", oname); + Printf(f_int_to_enum, "| `%s -> C_enum (\n", oname); + /* * * * A note about enum name resolution * * * * + * This code should now work, but I think we can do a bit better. + * The problem I'm having is that swig isn't very precise about + * typedef name resolution. My opinion is that SwigType_typedef + * resolve_all should *always* return the enum tag if one exists, + * rather than the admittedly friendlier enclosing typedef. + * + * This would make one of the cases below unnecessary. + * * * */ + Printf(f_mlbody, "let _ = Callback.register \"%s_marker\" (`%s)\n", fully_qualified_name, oname); + if (!strncmp(Char(fully_qualified_name), "enum ", 5)) { + String *fq_noenum = NewString(Char(fully_qualified_name) + 5); + Printf(f_mlbody, + "let _ = Callback.register \"%s_marker\" (`%s)\n" "let _ = Callback.register \"%s_marker\" (`%s)\n", fq_noenum, oname, fq_noenum, name); + } + + Printf(f_enumtypes_type, "| `%s\n", oname); + Insert(fully_qualified_name, 0, "enum "); + Setattr(seen_enums, fully_qualified_name, n); + } } int ret = Language::enumDeclaration(n); diff --git a/Source/Modules/php4.cxx b/Source/Modules/php.cxx similarity index 64% rename from Source/Modules/php4.cxx rename to Source/Modules/php.cxx index cfe948e3f..9369c2489 100644 --- a/Source/Modules/php4.cxx +++ b/Source/Modules/php.cxx @@ -13,11 +13,9 @@ * Short term: * * Sort out auto-renaming of method and class names which are reserved - * words (e.g. empty, clone, exception, etc.) vs -php4/-php5 in some - * sane way. + * words (e.g. empty, clone, exception, etc.) * - * Sort out wrapping of static member variables in OO PHP5 (which first may - * mean we need to sort them out for PHP4!) + * Sort out wrapping of static member variables in OO PHP5. * * Medium term: * @@ -39,7 +37,7 @@ /* * TODO: Replace remaining stderr messages with Swig_error or Swig_warning - * (may need to add more WARN_PHP4_xxx codes...) + * (may need to add more WARN_PHP_xxx codes...) */ char cvsroot_php4_cxx[] = "$Id$"; @@ -50,16 +48,10 @@ char cvsroot_php4_cxx[] = "$Id$"; #include static const char *usage = (char *) "\ -PHP Options (available with -php4 or -php5)\n\ +PHP Options (available with -php5)\n\ -cppext - cpp file extension (default to .cpp)\n\ -noproxy - Don't generate proxy classes.\n\ -prefix - Prepend to all class names in PHP5 wrappers\n\ - -make - Create simple makefile\n\ - -phpfull - Create full make files\n\ - -withincs - With -phpfull writes needed incs in config.m4\n\ - -withlibs - With -phpfull writes needed libs in config.m4\n\ - -withc - With -phpfull makes extra C files in Makefile.in\n\ - -withcxx - With -phpfull makes extra C++ files in Makefile.in\n\ \n"; /* The original class wrappers for PHP4 store the pointer to the C++ class in @@ -76,16 +68,9 @@ static Node *classnode = 0; static String *module = 0; static String *cap_module = 0; static String *prefix = 0; -static String *withlibs = 0; -static String *withincs = 0; -static String *withc = 0; -static String *withcxx = 0; static String *shadow_classname = 0; -static int gen_extra = 0; -static int gen_make = 0; - static File *f_runtime = 0; static File *f_h = 0; static File *f_phpcode = 0; @@ -116,9 +101,6 @@ static Node *current_class = 0; static Hash *shadow_get_vars; static Hash *shadow_set_vars; -#define NATIVE_CONSTRUCTOR 1 -#define ALTERNATIVE_CONSTRUCTOR 2 -static int native_constructor = 0; static Hash *zend_types = 0; static int shadow = 1; @@ -150,45 +132,44 @@ void SwigPHP_emit_resource_registrations() { ki = First(zend_types); if (ki.key) Printf(s_oinit, "\n/* Register resource destructors for pointer types */\n"); - while (ki.key) - if (1 /* is pointer type */ ) { - DOH *key = ki.key; - Node *class_node = ki.item; - String *human_name = key; + while (ki.key) { + DOH *key = ki.key; + Node *class_node = ki.item; + String *human_name = key; - // Write out destructor function header - Printf(s_wrappers, "/* NEW Destructor style */\nstatic ZEND_RSRC_DTOR_FUNC(_wrap_destroy%s) {\n", key); + // Write out destructor function header + Printf(s_wrappers, "/* NEW Destructor style */\nstatic ZEND_RSRC_DTOR_FUNC(_wrap_destroy%s) {\n", key); - // write out body - if ((class_node != NOTCLASS)) { - String *destructor = Getattr(class_node, "destructor"); - human_name = Getattr(class_node, "sym:name"); - if (!human_name) - human_name = Getattr(class_node, "name"); - // Do we have a known destructor for this type? - if (destructor) { - Printf(s_wrappers, " %s(rsrc, SWIGTYPE%s->name TSRMLS_CC);\n", destructor, key); - } else { - Printf(s_wrappers, " /* No destructor for class %s */\n", human_name); - } + // write out body + if ((class_node != NOTCLASS)) { + String *destructor = Getattr(class_node, "destructor"); + human_name = Getattr(class_node, "sym:name"); + if (!human_name) + human_name = Getattr(class_node, "name"); + // Do we have a known destructor for this type? + if (destructor) { + Printf(s_wrappers, " %s(rsrc, SWIGTYPE%s->name TSRMLS_CC);\n", destructor, key); } else { - Printf(s_wrappers, " /* No destructor for simple type %s */\n", key); + Printf(s_wrappers, " /* No destructor for class %s */\n", human_name); } - - // close function - Printf(s_wrappers, "}\n"); - - // declare le_swig_ to store php registration - Printf(s_vdecl, "static int le_swig_%s=0; /* handle for %s */\n", key, human_name); - - // register with php - Printf(s_oinit, "le_swig_%s=zend_register_list_destructors_ex" "(_wrap_destroy%s,NULL,(char *)(SWIGTYPE%s->name),module_number);\n", key, key, key); - - // store php type in class struct - Printf(s_oinit, "SWIG_TypeClientData(SWIGTYPE%s,&le_swig_%s);\n", key, key); - - ki = Next(ki); + } else { + Printf(s_wrappers, " /* No destructor for simple type %s */\n", key); } + + // close function + Printf(s_wrappers, "}\n"); + + // declare le_swig_ to store php registration + Printf(s_vdecl, "static int le_swig_%s=0; /* handle for %s */\n", key, human_name); + + // register with php + Printf(s_oinit, "le_swig_%s=zend_register_list_destructors_ex" "(_wrap_destroy%s,NULL,(char *)(SWIGTYPE%s->name),module_number);\n", key, key, key); + + // store php type in class struct + Printf(s_oinit, "SWIG_TypeClientData(SWIGTYPE%s,&le_swig_%s);\n", key, key); + + ki = Next(ki); + } } class PHP:public Language { @@ -217,327 +198,56 @@ public: * ------------------------------------------------------------ */ virtual void main(int argc, char *argv[]) { - int i; - SWIG_library_directory("php4"); + SWIG_library_directory("php"); SWIG_config_cppext("cpp"); - for (i = 1; i < argc; i++) { - if (argv[i]) { - if (strcmp(argv[i], "-phpfull") == 0) { - gen_extra = 1; + for (int i = 1; i < argc; i++) { + if (strcmp(argv[i], "-prefix") == 0) { + if (argv[i + 1]) { + prefix = NewString(argv[i + 1]); Swig_mark_arg(i); - } else if (strcmp(argv[i], "-dlname") == 0) { - Printf(stderr, "*** -dlname is no longer supported\n*** if you want to change the module name, use -module instead.\n"); - SWIG_exit(EXIT_FAILURE); - } else if (strcmp(argv[i], "-prefix") == 0) { - if (argv[i + 1]) { - prefix = NewString(argv[i + 1]); - Swig_mark_arg(i); - Swig_mark_arg(i + 1); - i++; - } else { - Swig_arg_error(); - } - } else if (strcmp(argv[i], "-withlibs") == 0) { - if (argv[i + 1]) { - withlibs = NewString(argv[i + 1]); - Swig_mark_arg(i); - Swig_mark_arg(i + 1); - i++; - } else { - Swig_arg_error(); - } - } else if (strcmp(argv[i], "-withincs") == 0) { - if (argv[i + 1]) { - withincs = NewString(argv[i + 1]); - Swig_mark_arg(i); - Swig_mark_arg(i + 1); - i++; - } else { - Swig_arg_error(); - } - } else if (strcmp(argv[i], "-withc") == 0) { - if (argv[i + 1]) { - withc = NewString(argv[i + 1]); - Swig_mark_arg(i); - Swig_mark_arg(i + 1); - i++; - } else { - Swig_arg_error(); - } - } else if (strcmp(argv[i], "-withcxx") == 0) { - if (argv[i + 1]) { - withcxx = NewString(argv[i + 1]); - Swig_mark_arg(i); - Swig_mark_arg(i + 1); - i++; - } else { - Swig_arg_error(); - } - } else if (strcmp(argv[i], "-cppext") == 0) { - if (argv[i + 1]) { - SWIG_config_cppext(argv[i + 1]); - Swig_mark_arg(i); - Swig_mark_arg(i + 1); - i++; - } else { - Swig_arg_error(); - } - } else if ((strcmp(argv[i], "-noshadow") == 0) || (strcmp(argv[i], "-noproxy") == 0)) { - shadow = 0; - Swig_mark_arg(i); - } else if (strcmp(argv[i], "-make") == 0) { - gen_make = 1; - Swig_mark_arg(i); - } else if (strcmp(argv[i], "-help") == 0) { - fputs(usage, stdout); + Swig_mark_arg(i + 1); + i++; + } else { + Swig_arg_error(); } + } else if (strcmp(argv[i], "-cppext") == 0) { + if (argv[i + 1]) { + SWIG_config_cppext(argv[i + 1]); + Swig_mark_arg(i); + Swig_mark_arg(i + 1); + i++; + } else { + Swig_arg_error(); + } + } else if ((strcmp(argv[i], "-noshadow") == 0) || (strcmp(argv[i], "-noproxy") == 0)) { + shadow = 0; + Swig_mark_arg(i); + } else if (strcmp(argv[i], "-help") == 0) { + fputs(usage, stdout); + } else if (strcmp(argv[i], "-make") == 0 || + strcmp(argv[i], "-withc") == 0 || + strcmp(argv[i], "-withcxx") == 0) { + Printf(stderr, "*** %s is no longer supported.\n", argv[i]); + SWIG_exit(EXIT_FAILURE); + } else if (strcmp(argv[i], "-phpfull") == 0 || + strcmp(argv[i], "-withlibs") == 0 || + strcmp(argv[i], "-withincs") == 0) { + Printf(stderr, "*** %s is no longer supported.\n*** We recommend building as a dynamically loadable module.\n", argv[i]); + SWIG_exit(EXIT_FAILURE); + } else if (strcmp(argv[i], "-dlname") == 0) { + Printf(stderr, "*** -dlname is no longer supported.\n*** If you want to change the module name, use -module instead.\n"); + SWIG_exit(EXIT_FAILURE); } } - Preprocessor_define((void *) "SWIGPHP 1", 0); - if (php_version == 4) { - Preprocessor_define((void *) "SWIGPHP4 1", 0); - } else if (php_version == 5) { - Preprocessor_define((void *) "SWIGPHP5 1", 0); - } + Preprocessor_define("SWIGPHP 1", 0); + Preprocessor_define("SWIGPHP5 1", 0); SWIG_typemap_lang("php4"); - /* DB: Suggest using a language configuration file */ - SWIG_config_file("php4.swg"); + SWIG_config_file("php.swg"); allow_overloading(); } - void create_simple_make(void) { - File *f_make; - - f_make = NewFile((void *) "makefile", "w"); - Printf(f_make, "CC=gcc\n"); - Printf(f_make, "CXX=g++\n"); - Printf(f_make, "CXX_SOURCES=%s\n", withcxx); - Printf(f_make, "C_SOURCES=%s\n", withc); - Printf(f_make, "OBJS=%s_wrap.o $(C_SOURCES:.c=.o) $(CXX_SOURCES:.cxx=.o)\n", module); - Printf(f_make, "MODULE=%s.so\n", module); - Printf(f_make, "CFLAGS=-fpic\n"); - Printf(f_make, "LDFLAGS=-shared\n"); - Printf(f_make, "PHP_INC=`php-config --includes`\n"); - Printf(f_make, "EXTRA_INC=\n"); - Printf(f_make, "EXTRA_LIB=\n\n"); - Printf(f_make, "$(MODULE): $(OBJS)\n"); - if (CPlusPlus || (withcxx != NULL)) { - Printf(f_make, "\t$(CXX) $(LDFLAGS) $(OBJS) -o $@ $(EXTRA_LIB)\n\n"); - } else { - Printf(f_make, "\t$(CC) $(LDFLAGS) $(OBJS) -o $@ $(EXTRA_LIB)\n\n"); - } - Printf(f_make, "%%.o: %%.cpp\n"); - Printf(f_make, "\t$(CXX) $(EXTRA_INC) $(PHP_INC) $(CFLAGS) -c $<\n"); - Printf(f_make, "%%.o: %%.cxx\n"); - Printf(f_make, "\t$(CXX) $(EXTRA_INC) $(PHP_INC) $(CFLAGS) -c $<\n"); - Printf(f_make, "%%.o: %%.c\n"); - Printf(f_make, "\t$(CC) $(EXTRA_INC) $(PHP_INC) $(CFLAGS) -c $<\n"); - - Close(f_make); - } - - void create_extra_files(String *outfile) { - File *f_extra; - - static String *configm4 = 0; - static String *makefilein = 0; - static String *credits = 0; - - configm4 = NewStringEmpty(); - Printv(configm4, SWIG_output_directory(), "config.m4", NIL); - - makefilein = NewStringEmpty(); - Printv(makefilein, SWIG_output_directory(), "Makefile.in", NIL); - - credits = NewStringEmpty(); - Printv(credits, SWIG_output_directory(), "CREDITS", NIL); - - // are we a --with- or --enable- - int with = (withincs || withlibs) ? 1 : 0; - - // Note Makefile.in only copes with one source file - // also withincs and withlibs only take one name each now - // the code they generate should be adapted to take multiple lines - - /* Write out Makefile.in */ - f_extra = NewFile(makefilein, "w"); - if (!f_extra) { - FileErrorDisplay(makefilein); - SWIG_exit(EXIT_FAILURE); - } - - Printf(f_extra, "# $Id$\n\n" "LTLIBRARY_NAME = %s.la\n", module); - - // C++ has more and different entries to C in Makefile.in - if (!CPlusPlus) { - Printf(f_extra, "LTLIBRARY_SOURCES = %s %s\n", Swig_file_filename(outfile), withc); - Printf(f_extra, "LTLIBRARY_SOURCES_CPP = %s\n", withcxx); - } else { - Printf(f_extra, "LTLIBRARY_SOURCES = %s\n", withc); - Printf(f_extra, "LTLIBRARY_SOURCES_CPP = %s %s\n", Swig_file_filename(outfile), withcxx); - Printf(f_extra, "LTLIBRARY_OBJECTS_X = $(LTLIBRARY_SOURCES_CPP:.cpp=.lo) $(LTLIBRARY_SOURCES_CPP:.cxx=.lo)\n"); - } - Printf(f_extra, "LTLIBRARY_SHARED_NAME = %s.la\n", module); - Printf(f_extra, "LTLIBRARY_SHARED_LIBADD = $(%s_SHARED_LIBADD)\n\n", cap_module); - Printf(f_extra, "include $(top_srcdir)/build/dynlib.mk\n"); - - Printf(f_extra, "\n# patch in .cxx support to php build system to work like .cpp\n"); - Printf(f_extra, ".SUFFIXES: .cxx\n\n"); - - Printf(f_extra, ".cxx.o:\n"); - Printf(f_extra, "\t$(CXX_COMPILE) -c $<\n\n"); - - Printf(f_extra, ".cxx.lo:\n"); - Printf(f_extra, "\t$(CXX_PHP_COMPILE)\n\n"); - Printf(f_extra, ".cxx.slo:\n"); - - Printf(f_extra, "\t$(CXX_SHARED_COMPILE)\n\n"); - - Printf(f_extra, "\n# make it easy to test module\n"); - Printf(f_extra, "testmodule:\n"); - Printf(f_extra, "\tphp -q -d extension_dir=modules %s\n\n", Swig_file_filename(phpfilename)); - - Close(f_extra); - - /* Now config.m4 */ - // Note: # comments are OK in config.m4 if you don't mind them - // appearing in the final ./configure file - // (which can help with ./configure debugging) - - // NOTE2: phpize really ought to be able to write out a sample - // config.m4 based on some simple data, I'll take this up with - // the php folk! - f_extra = NewFile(configm4, "w"); - if (!f_extra) { - FileErrorDisplay(configm4); - SWIG_exit(EXIT_FAILURE); - } - - Printf(f_extra, "dnl $Id$\n"); - Printf(f_extra, "dnl ***********************************************************************\n"); - Printf(f_extra, "dnl ** THIS config.m4 is provided for PHPIZE and PHP's consumption NOT\n"); - Printf(f_extra, "dnl ** for any part of the rest of the %s build system\n", module); - Printf(f_extra, "dnl ***********************************************************************\n\n"); - - - if (!with) { // must be enable then - Printf(f_extra, "PHP_ARG_ENABLE(%s, whether to enable %s support,\n", module, module); - Printf(f_extra, "[ --enable-%s Enable %s support])\n\n", module, module); - } else { - Printf(f_extra, "PHP_ARG_WITH(%s, for %s support,\n", module, module); - Printf(f_extra, "[ --with-%s[=DIR] Include %s support.])\n\n", module, module); - // These tests try and file the library we need - Printf(f_extra, "dnl THESE TESTS try and find the library and header files\n"); - Printf(f_extra, "dnl your new php module needs. YOU MAY NEED TO EDIT THEM\n"); - Printf(f_extra, "dnl as written they assume your header files are all in the same place\n\n"); - - Printf(f_extra, "dnl ** are we looking for %s_lib.h or something else?\n", module); - if (withincs) - Printf(f_extra, "HNAMES=\"%s\"\n\n", withincs); - else - Printf(f_extra, "HNAMES=\"\"; # %s_lib.h ?\n\n", module); - - Printf(f_extra, "dnl ** Are we looking for lib%s.a or lib%s.so or something else?\n", module, module); - - if (withlibs) - Printf(f_extra, "LIBNAMES=\"%s\"\n\n", withlibs); - else - Printf(f_extra, "LIBNAMES=\"\"; # lib%s.so ?\n\n", module); - - Printf(f_extra, "dnl IF YOU KNOW one of the symbols in the library and you\n"); - Printf(f_extra, "dnl specify it below then we can have a link test to see if it works\n"); - Printf(f_extra, "LIBSYMBOL=\"\"\n\n"); - } - - // Now write out tests to find thing.. they may need to extend tests - Printf(f_extra, "if test \"$PHP_%s\" != \"no\"; then\n\n", cap_module); - - // Ready for when we add libraries as we find them - Printf(f_extra, " PHP_SUBST(%s_SHARED_LIBADD)\n\n", cap_module); - - if (withlibs) { // find more than one library - Printf(f_extra, " for LIBNAME in $LIBNAMES ; do\n"); - Printf(f_extra, " LIBDIR=\"\"\n"); - // For each path element to try... - Printf(f_extra, " for i in $PHP_%s $PHP_%s/lib /usr/lib /usr/local/lib ; do\n", cap_module, cap_module); - Printf(f_extra, " if test -r $i/lib$LIBNAME.a -o -r $i/lib$LIBNAME.so ; then\n"); - Printf(f_extra, " LIBDIR=\"$i\"\n"); - Printf(f_extra, " break\n"); - Printf(f_extra, " fi\n"); - Printf(f_extra, " done\n\n"); - Printf(f_extra, " dnl ** and $LIBDIR should be the library path\n"); - Printf(f_extra, " if test \"$LIBNAME\" != \"\" -a -z \"$LIBDIR\" ; then\n"); - Printf(f_extra, " AC_MSG_RESULT(Library files $LIBNAME not found)\n"); - Printf(f_extra, " AC_MSG_ERROR(Is the %s distribution installed properly?)\n", module); - Printf(f_extra, " else\n"); - Printf(f_extra, " AC_MSG_RESULT(Library files $LIBNAME found in $LIBDIR)\n"); - Printf(f_extra, " PHP_ADD_LIBRARY_WITH_PATH($LIBNAME, $LIBDIR, %s_SHARED_LIBADD)\n", cap_module); - Printf(f_extra, " fi\n"); - Printf(f_extra, " done\n\n"); - } - - if (withincs) { // Find more than once include - Printf(f_extra, " for HNAME in $HNAMES ; do\n"); - Printf(f_extra, " INCDIR=\"\"\n"); - // For each path element to try... - Printf(f_extra, " for i in $PHP_%s $PHP_%s/include $PHP_%s/includes $PHP_%s/inc $PHP_%s/incs /usr/local/include /usr/include; do\n", cap_module, - cap_module, cap_module, cap_module, cap_module); - // Try and find header files - Printf(f_extra, " if test \"$HNAME\" != \"\" -a -r $i/$HNAME ; then\n"); - Printf(f_extra, " INCDIR=\"$i\"\n"); - Printf(f_extra, " break\n"); - Printf(f_extra, " fi\n"); - Printf(f_extra, " done\n\n"); - - Printf(f_extra, " dnl ** Now $INCDIR should be the include file path\n"); - Printf(f_extra, " if test \"$HNAME\" != \"\" -a -z \"$INCDIR\" ; then\n"); - Printf(f_extra, " AC_MSG_RESULT(Include files $HNAME not found)\n"); - Printf(f_extra, " AC_MSG_ERROR(Is the %s distribution installed properly?)\n", module); - Printf(f_extra, " else\n"); - Printf(f_extra, " AC_MSG_RESULT(Include files $HNAME found in $INCDIR)\n"); - Printf(f_extra, " PHP_ADD_INCLUDE($INCDIR)\n"); - Printf(f_extra, " fi\n\n"); - Printf(f_extra, " done\n\n"); - } - - if (CPlusPlus) { - Printf(f_extra, " # As this is a C++ module..\n"); - } - - Printf(f_extra, " PHP_REQUIRE_CXX\n"); - Printf(f_extra, " AC_CHECK_LIB(stdc++, cin)\n"); - - if (with) { - Printf(f_extra, " if test \"$LIBSYMBOL\" != \"\" ; then\n"); - Printf(f_extra, " old_LIBS=\"$LIBS\"\n"); - Printf(f_extra, " LIBS=\"$LIBS -L$TEST_DIR/lib -lm -ldl\"\n"); - Printf(f_extra, " AC_CHECK_LIB($LIBNAME, $LIBSYMBOL, [AC_DEFINE(HAVE_TESTLIB,1, [ ])],\n"); - Printf(f_extra, " [AC_MSG_ERROR(wrong test lib version or lib not found)])\n"); - Printf(f_extra, " LIBS=\"$old_LIBS\"\n"); - Printf(f_extra, " fi\n\n"); - } - - Printf(f_extra, " AC_DEFINE(HAVE_%s, 1, [ ])\n", cap_module); - Printf(f_extra, "dnl AC_DEFINE_UNQUOTED(PHP_%s_DIR, \"$%s_DIR\", [ ])\n", cap_module, cap_module); - Printf(f_extra, " PHP_EXTENSION(%s, $ext_shared)\n", module); - - // and thats all! - Printf(f_extra, "fi\n"); - - Close(f_extra); - - /* CREDITS */ - f_extra = NewFile(credits, "w"); - if (!f_extra) { - FileErrorDisplay(credits); - SWIG_exit(EXIT_FAILURE); - } - Printf(f_extra, "%s\n", module); - Close(f_extra); - } - /* ------------------------------------------------------------ * top() * ------------------------------------------------------------ */ @@ -610,9 +320,8 @@ public: Printf(f_phpcode, " if (strtolower(substr(PHP_OS, 0, 3)) === 'win') {\n"); Printf(f_phpcode, " if (!dl('php_%s.dll')) return;\n", module); Printf(f_phpcode, " } else {\n"); - Printf(f_phpcode, " // PHP_SHLIB_SUFFIX is available as of PHP 4.3.0, for older PHP assume 'so'.\n"); - Printf(f_phpcode, " // It gives 'dylib' on MacOS X which is for libraries, modules are 'so'.\n"); - Printf(f_phpcode, " if (PHP_SHLIB_SUFFIX === 'PHP_SHLIB_SUFFIX' || PHP_SHLIB_SUFFIX === 'dylib') {\n"); + Printf(f_phpcode, " // PHP_SHLIB_SUFFIX gives 'dylib' on MacOS X but modules are 'so'.\n"); + Printf(f_phpcode, " if (PHP_SHLIB_SUFFIX === 'dylib') {\n"); Printf(f_phpcode, " if (!dl('%s.so')) return;\n", module); Printf(f_phpcode, " } else {\n"); Printf(f_phpcode, " if (!dl('%s.'.PHP_SHLIB_SUFFIX)) return;\n", module); @@ -728,9 +437,6 @@ public: Printf(s_init, "};\n"); Printf(s_init, "zend_module_entry* SWIG_module_entry = &%s_module_entry;\n\n", module); - if (gen_extra) { - Printf(s_init, "#ifdef COMPILE_DL_%s\n", cap_module); - } Printf(s_init, "#ifdef __cplusplus\n"); Printf(s_init, "extern \"C\" {\n"); Printf(s_init, "#endif\n"); @@ -741,10 +447,6 @@ public: Printf(s_init, "}\n"); Printf(s_init, "#endif\n\n"); - if (gen_extra) { - Printf(s_init, "#endif\n\n"); - } - /* We have to register the constants before they are (possibly) used * by the pointer typemaps. This all needs re-arranging really as * things are being called in the wrong order @@ -841,22 +543,12 @@ public: Printf(f_phpcode, "%s\n?>\n", s_phpclasses); Close(f_phpcode); - if (gen_extra) { - create_extra_files(outfile); - } else if (gen_make) { - create_simple_make(); - } - return SWIG_OK; } /* Just need to append function names to function table to register with PHP. */ void create_command(String *cname, String *iname) { // This is for the single main zend_function_entry record - if (shadow && php_version == 4) { - if (wrapperType != standard) - return; - } Printf(f_h, "ZEND_NAMED_FUNCTION(%s);\n", iname); String * s = cs_entry; if (!s) s = s_entry; @@ -873,8 +565,6 @@ public: String *tmp = NewStringEmpty(); String *dispatch = Swig_overload_dispatch(n, "return %s(INTERNAL_FUNCTION_PARAM_PASSTHRU);", &maxargs); - int has_this_ptr = (wrapperType == memberfn && shadow && php_version == 4); - /* Generate a dispatch wrapper for all overloaded functions */ Wrapper *f = NewWrapper(); @@ -891,13 +581,7 @@ public: Printf(f->code, "argc = ZEND_NUM_ARGS();\n"); - if (has_this_ptr) { - Printf(f->code, "argv[0] = &this_ptr;\n"); - Printf(f->code, "zend_get_parameters_array_ex(argc,argv+1);\n"); - Printf(f->code, "argc++;\n"); - } else { - Printf(f->code, "zend_get_parameters_array_ex(argc,argv);\n"); - } + Printf(f->code, "zend_get_parameters_array_ex(argc,argv);\n"); Replaceall(dispatch, "$args", "self,args"); @@ -946,8 +630,6 @@ public: int numopt; String *tm; Wrapper *f; - bool mvr = (shadow && php_version == 4 && wrapperType == membervar); - bool mvrset = (mvr && (Strcmp(iname, Swig_name_set(Swig_name_member(shadow_classname, name))) == 0)); String *wname; int overloaded = 0; @@ -972,19 +654,6 @@ public: if (overname) { Printf(wname, "%s", overname); } - // if PHP4, shadow and variable wrapper we want to snag the main contents - // of this function to stick in to the property handler... - if (mvr) { - String *php_function_name = NewString(iname); - if (Strcmp(iname, Swig_name_set(Swig_name_member(shadow_classname, name))) == 0) { - Setattr(shadow_set_vars, php_function_name, name); - } - if (Strcmp(iname, Swig_name_get(Swig_name_member(shadow_classname, name))) == 0) { - Setattr(shadow_get_vars, php_function_name, name); - } - - Delete(php_function_name); - } f = NewWrapper(); numopt = 0; @@ -992,20 +661,11 @@ public: String *outarg = NewStringEmpty(); String *cleanup = NewStringEmpty(); - if (mvr) { // do prop[gs]et header - if (mvrset) { - Printf(f->def, "static int _wrap_%s(zend_property_reference *property_reference, pval *value) {\n", iname); - } else { - Printf(f->def, "static pval _wrap_%s(zend_property_reference *property_reference) {\n", iname); - } - } else { - // regular header - // Not issued for overloaded functions or static member variables. - if (!overloaded && wrapperType != staticmembervar) { - create_command(iname, wname); - } - Printv(f->def, "ZEND_NAMED_FUNCTION(", wname, ") {\n", NIL); + // Not issued for overloaded functions or static member variables. + if (!overloaded && wrapperType != staticmembervar) { + create_command(iname, wname); } + Printv(f->def, "ZEND_NAMED_FUNCTION(", wname, ") {\n", NIL); emit_parameter_variables(l, f); /* Attach standard typemaps */ @@ -1019,10 +679,8 @@ public: int num_required = emit_num_required(l); numopt = num_arguments - num_required; - int has_this_ptr = (wrapperType == memberfn && shadow && php_version == 4); - - if (num_arguments - has_this_ptr > 0) { - String *args = NewStringf("zval **args[%d]", num_arguments - has_this_ptr); + if (num_arguments > 0) { + String *args = NewStringf("zval **args[%d]", num_arguments); Wrapper_add_local(f, "args", args); Delete(args); args = NULL; @@ -1037,34 +695,17 @@ public: Printf(f->code, "SWIG_ResetError();\n"); - if (has_this_ptr) - Printf(f->code, "/* This function uses a this_ptr*/\n"); - - if (native_constructor) { - if (native_constructor == NATIVE_CONSTRUCTOR) { - Printf(f->code, "/* NATIVE Constructor */\n"); - } else { - Printf(f->code, "/* ALTERNATIVE Constructor */\n"); - } - } - - if (mvr && !mvrset) { - Wrapper_add_local(f, "_return_value", "zval _return_value"); - Wrapper_add_local(f, "return_value", "zval *return_value=&_return_value"); - } - if (numopt > 0) { // membervariable wrappers do not have optional args Wrapper_add_local(f, "arg_count", "int arg_count"); Printf(f->code, "arg_count = ZEND_NUM_ARGS();\n"); Printf(f->code, "if(arg_count<%d || arg_count>%d ||\n", num_required, num_arguments); Printf(f->code, " zend_get_parameters_array_ex(arg_count,args)!=SUCCESS)\n"); Printf(f->code, "\tWRONG_PARAM_COUNT;\n\n"); - } else if (!mvr) { - int num = num_arguments - has_this_ptr; - if (num == 0) { + } else { + if (num_arguments == 0) { Printf(f->code, "if(ZEND_NUM_ARGS() != 0) {\n"); } else { - Printf(f->code, "if(ZEND_NUM_ARGS() != %d || zend_get_parameters_array_ex(%d, args) != SUCCESS) {\n", num, num); + Printf(f->code, "if(ZEND_NUM_ARGS() != %d || zend_get_parameters_array_ex(%d, args) != SUCCESS) {\n", num_arguments, num_arguments); } Printf(f->code, "WRONG_PARAM_COUNT;\n}\n\n"); } @@ -1090,19 +731,7 @@ public: SwigType *pt = Getattr(p, "type"); - if (mvr) { // do we assert that numargs=2, that i<2 - if (i == 0) { - source = NewString("&(property_reference->object)"); - } else { - source = NewString("&value"); - } - } else { - if (i == 0 && has_this_ptr) { - source = NewString("&this_ptr"); - } else { - source = NewStringf("args[%d]", i - has_this_ptr); - } - } + source = NewStringf("args[%d]", i); String *ln = Getattr(p, "lname"); @@ -1184,24 +813,6 @@ public: Replaceall(tm, "$result", "return_value"); Replaceall(tm, "$owner", newobject ? "1" : "0"); Printf(f->code, "%s\n", tm); - // Are we returning a wrapable object? - if (shadow && php_version == 4 && is_shadow(d) && (SwigType_type(d) != T_ARRAY)) { - // Make object. - Printf(f->code, "{\n/* Wrap this return value */\n"); - Printf(f->code, "zval *_cPtr;\n"); - Printf(f->code, "ALLOC_ZVAL(_cPtr);\n"); - Printf(f->code, "*_cPtr = *return_value;\n"); - Printf(f->code, "INIT_ZVAL(*return_value);\n"); - if (native_constructor == NATIVE_CONSTRUCTOR) { - Printf(f->code, "add_property_zval(this_ptr,\"" SWIG_PTR "\",_cPtr);\n"); - } else { - String *shadowrettype = SwigToPhpType(n, true); - Printf(f->code, "object_init_ex(return_value,ptr_ce_swig_%s);\n", shadowrettype); - Delete(shadowrettype); - Printf(f->code, "add_property_zval(return_value,\"" SWIG_PTR "\",_cPtr);\n"); - } - Printf(f->code, "}\n"); - } } else { Swig_warning(WARN_TYPEMAP_OUT_UNDEF, input_file, line_number, "Unable to use return type %s in function %s.\n", SwigType_str(d, 0), name); } @@ -1229,16 +840,7 @@ public: Delete(tm); } - - if (mvr) { - if (!mvrset) { - Printf(f->code, "return _return_value;\n"); - } else { - Printf(f->code, "return SUCCESS;\n"); - } - } else { - Printf(f->code, "return;\n"); - } + Printf(f->code, "return;\n"); /* Error handling code */ Printf(f->code, "fail:\n"); @@ -1440,6 +1042,10 @@ public: if (wrapperType == memberfn) p = nextSibling(p); while (p) { + if (GetInt(p, "tmap:in:numinputs") == 0) { + p = nextSibling(p); + continue; + } assert(0 <= argno && argno < max_num_of_arguments); String *&pname = arg_names[argno]; const char *pname_cstr = GetChar(p, "name"); @@ -1635,8 +1241,8 @@ public: Setattr(seen, "this", seen); /* We use $r to store the return value, so disallow that as a parameter * name in case the user uses the "call-time pass-by-reference" feature - * (it's deprecated and off by default in PHP5 and even later PHP4 - * versions apparently, but we want to be maximally portable). + * (it's deprecated and off by default in PHP5, but we want to be + * maximally portable). */ Setattr(seen, "r", seen); @@ -1750,7 +1356,8 @@ public: } Printf(output, "\n"); - if (wrapperType == memberfn || newobject) { + // If it's a member function or a class constructor... + if (wrapperType == memberfn || (newobject && current_class)) { Printf(output, "\tfunction %s(%s) {\n", methodname, args); // We don't need this code if the wrapped class has a copy ctor // since the flat function new_CLASSNAME will handle it for us. @@ -1984,7 +1591,7 @@ public: Printf(pragma_phpinfo, "%s\n", value); } } else { - Swig_warning(WARN_PHP4_UNKNOWN_PRAGMA, input_file, line_number, "Unrecognized pragma <%s>.\n", type); + Swig_warning(WARN_PHP_UNKNOWN_PRAGMA, input_file, line_number, "Unrecognized pragma <%s>.\n", type); } } } @@ -2014,52 +1621,7 @@ public: current_class = n; // String *use_class_name=SwigType_manglestr(SwigType_ltype(t)); - if (shadow && php_version == 4) { - char *rename = GetChar(n, "sym:name"); - - if (!addSymbol(rename, n)) - return SWIG_ERROR; - shadow_classname = NewString(rename); - cs_entry = NewStringEmpty(); - Printf(cs_entry, "/* Function entries for %s */\n", shadow_classname); - Printf(cs_entry, "static zend_function_entry %s_functions[] = {\n", shadow_classname); - - if (Strcmp(shadow_classname, module) == 0) { - Printf(stderr, "class name cannot be equal to module name: %s\n", module); - SWIG_exit(1); - } - - shadow_get_vars = NewHash(); - shadow_set_vars = NewHash(); - - /* Deal with inheritance */ - List *baselist = Getattr(n, "bases"); - if (baselist) { - Iterator base = First(baselist); - while (base.item && GetFlag(base.item, "feature:ignore")) { - base = Next(base); - } - base = Next(base); - if (base.item) { - /* Warn about multiple inheritance for additional base class(es) */ - while (base.item) { - if (GetFlag(base.item, "feature:ignore")) { - base = Next(base); - continue; - } - String *proxyclassname = SwigType_str(Getattr(n, "classtypeobj"), 0); - String *baseclassname = SwigType_str(Getattr(base.item, "name"), 0); - Swig_warning(WARN_PHP4_MULTIPLE_INHERITANCE, input_file, line_number, - "Warning for %s proxy: Base %s ignored. Multiple inheritance is not supported in Php4.\n", proxyclassname, baseclassname); - base = Next(base); - } - } - } - - /* Write out class init code */ - Printf(s_vdecl, "static zend_class_entry ce_swig_%s;\n", shadow_classname); - Printf(s_vdecl, "static zend_class_entry* ptr_ce_swig_%s=NULL;\n", shadow_classname); - } else if (shadow && php_version == 5) { + if (shadow) { char *rename = GetChar(n, "sym:name"); if (!addSymbol(rename, n)) @@ -2086,7 +1648,7 @@ public: } String *proxyclassname = SwigType_str(Getattr(n, "classtypeobj"), 0); String *baseclassname = SwigType_str(Getattr(base.item, "name"), 0); - Swig_warning(WARN_PHP4_MULTIPLE_INHERITANCE, input_file, line_number, + Swig_warning(WARN_PHP_MULTIPLE_INHERITANCE, input_file, line_number, "Warning for %s proxy: Base %s ignored. Multiple inheritance is not supported in PHP.\n", proxyclassname, baseclassname); base = Next(base); } @@ -2098,217 +1660,7 @@ public: Language::classHandler(n); classnode = 0; - if (shadow && php_version == 4) { - DOH *key; - String *s_propget = NewStringEmpty(); - String *s_propset = NewStringEmpty(); - List *baselist = Getattr(n, "bases"); - Iterator ki, base; - - // If no constructor was generated (abstract class) we had better - // generate a constructor that raises an error about instantiating - // abstract classes - if (Getattr(n, "abstract") && constructors == 0) { - // have to write out fake constructor which raises an error when called - abstractConstructorHandler(n); - } - - Printf(s_oinit, "/* Define class %s */\n", shadow_classname); - Printf(s_oinit, "INIT_OVERLOADED_CLASS_ENTRY(ce_swig_%s,\"%(lower)s\",%s_functions,", shadow_classname, shadow_classname, shadow_classname); - Printf(s_oinit, "NULL,_wrap_propget_%s,_wrap_propset_%s);\n", shadow_classname, shadow_classname); - - // ******** Write property SET handlers - Printf(s_header, "static int _wrap_propset_%s(zend_property_reference *property_reference, pval *value);\n", shadow_classname); - Printf(s_header, "static int _propset_%s(zend_property_reference *property_reference, pval *value);\n", shadow_classname); - - Printf(s_propset, "static int _wrap_propset_%s(zend_property_reference *property_reference, pval *value) { \n", shadow_classname); - Printf(s_propset, " zval * _value;\n"); - Printf(s_propset, " zend_llist_element *element = property_reference->elements_list->head;\n"); - Printf(s_propset, " zend_overloaded_element *property=(zend_overloaded_element *)element->data;\n"); - Printf(s_propset, " if (_propset_%s(property_reference, value)==SUCCESS) return SUCCESS;\n", shadow_classname); - Printf(s_propset, " /* set it ourselves as it is %s */\n", shadow_classname); - Printf(s_propset, " MAKE_STD_ZVAL(_value);\n"); - Printf(s_propset, " *_value=*value;\n"); - Printf(s_propset, " INIT_PZVAL(_value);\n"); - Printf(s_propset, " zval_copy_ctor(_value);\n"); - Printf(s_propset, - " return add_property_zval_ex(property_reference->object,Z_STRVAL_P(&(property->element)),1+Z_STRLEN_P(&(property->element)),_value);\n"); - Printf(s_propset, "}\n"); - Printf(s_propset, "static int _propset_%s(zend_property_reference *property_reference, pval *value) {\n", shadow_classname); - - - if (baselist) { - base = First(baselist); - } else { - base.item = NULL; - } - - while (base.item && GetFlag(base.item, "feature:ignore")) { - base = Next(base); - } - - ki = First(shadow_set_vars); - key = ki.key; - - // Print function header; we only need to find property name if there - // are properties for this class to look up... - if (key || !base.item) { // or if we are base class and set it ourselves - Printf(s_propset, " /* get the property name */\n"); - Printf(s_propset, " zend_llist_element *element = property_reference->elements_list->head;\n"); - Printf(s_propset, " zend_overloaded_element *property=(zend_overloaded_element *)element->data;\n"); - Printf(s_propset, " char *propname=Z_STRVAL_P(&(property->element));\n"); - } else { - if (base.item) { - Printf(s_propset, " /* No extra properties for subclass %s */\n", shadow_classname); - } else { - Printf(s_propset, " /* No properties for base class %s */\n", shadow_classname); - } - } - - while (ki.key) { - key = ki.key; - Printf(s_propset, " if (strcmp(propname,\"%s\")==0) return _wrap_%s(property_reference, value);\n", ki.item, key); - - ki = Next(ki); - } - - // If the property wasn't in this class, try the handlers of each base - // class (if any) in turn until we succeed in setting the property or - // have tried all base classes. - if (base.item) { - Printf(s_propset, " /* Try base class(es) */\n"); - while (base.item) { - Printf(s_propset, " if (_propset_%s(property_reference, value)==SUCCESS) return SUCCESS;\n", GetChar(base.item, "sym:name")); - - base = Next(base); - while (base.item && GetFlag(base.item, "feature:ignore")) { - base = Next(base); - } - } - } - Printf(s_propset, " return FAILURE;\n}\n\n"); - - // ******** Write property GET handlers - Printf(s_header, "static pval _wrap_propget_%s(zend_property_reference *property_reference);\n", shadow_classname); - Printf(s_header, "static int _propget_%s(zend_property_reference *property_reference, pval *value);\n", shadow_classname); - - Printf(s_propget, "static pval _wrap_propget_%s(zend_property_reference *property_reference) {\n", shadow_classname); - Printf(s_propget, " pval result;\n"); - Printf(s_propget, " pval **_result;\n"); - Printf(s_propget, " zend_llist_element *element = property_reference->elements_list->head;\n"); - Printf(s_propget, " zend_overloaded_element *property=(zend_overloaded_element *)element->data;\n"); - Printf(s_propget, " result.type = IS_NULL;\n"); - Printf(s_propget, " if (_propget_%s(property_reference, &result)==SUCCESS) return result;\n", shadow_classname); - Printf(s_propget, " /* return it ourselves */\n"); - Printf(s_propget, - " if (zend_hash_find(Z_OBJPROP_P(property_reference->object),Z_STRVAL_P(&(property->element)),1+Z_STRLEN_P(&(property->element)),(void**)&_result)==SUCCESS) {\n"); - Printf(s_propget, " zval *_value;\n"); - Printf(s_propget, " MAKE_STD_ZVAL(_value);"); - Printf(s_propget, " *_value=**_result;\n"); - Printf(s_propget, " INIT_PZVAL(_value);\n"); - Printf(s_propget, " zval_copy_ctor(_value);\n"); - Printf(s_propget, " return *_value;\n"); - Printf(s_propget, " }\n"); - Printf(s_propget, " result.type = IS_NULL;\n"); - Printf(s_propget, " return result;\n"); - Printf(s_propget, "}\n"); - Printf(s_propget, "static int _propget_%s(zend_property_reference *property_reference, pval *value) {\n", shadow_classname); - - if (baselist) { - base = First(baselist); - } else { - base.item = NULL; - } - while (base.item && GetFlag(base.item, "feature:ignore")) { - base = Next(base); - } - ki = First(shadow_get_vars); - - key = ki.key; - - // Print function header; we only need to find property name if there - // are properties for this class to look up... - if (key || !base.item) { // or if we are base class... - Printf(s_propget, " /* get the property name */\n"); - Printf(s_propget, " zend_llist_element *element = property_reference->elements_list->head;\n"); - Printf(s_propget, " zend_overloaded_element *property=(zend_overloaded_element *)element->data;\n"); - Printf(s_propget, " char *propname=Z_STRVAL_P(&(property->element));\n"); - } else { - if (base.item) { - Printf(s_propget, " /* No extra properties for subclass %s */\n", shadow_classname); - } else { - Printf(s_propget, " /* No properties for base class %s */\n", shadow_classname); - } - } - - while (ki.key) { - key = ki.key; - Printf(s_propget, " if (strcmp(propname,\"%s\")==0) {\n", ki.item); - Printf(s_propget, " *value=_wrap_%s(property_reference);\n", key); - Printf(s_propget, " return SUCCESS;\n"); - Printf(s_propget, " }\n"); - - ki = Next(ki); - } - - // If the property wasn't in this class, try the handlers of each base - // class (if any) in turn until we succeed in setting the property or - // have tried all base classes. - if (base.item) { - Printf(s_propget, " /* Try base class(es). */\n"); - while (base.item) { - Printf(s_propget, " if (_propget_%s(property_reference, value)==SUCCESS) return SUCCESS;\n", GetChar(base.item, "sym:name")); - - base = Next(base); - while (base.item && GetFlag(base.item, "feature:ignore")) { - base = Next(base); - } - } - } - Printf(s_propget, " return FAILURE;\n}\n\n"); - - // wrappers generated now... - - // add wrappers to output code - Printf(s_wrappers, "/* property handler for class %s */\n", shadow_classname); - Printv(s_wrappers, s_propget, s_propset, NIL); - - // Save class in class table - if (baselist) { - base = First(baselist); - } else { - base.item = NULL; - } - while (base.item && GetFlag(base.item, "feature:ignore")) { - base = Next(base); - } - - if (base.item) { - Printf(s_oinit, - "if (! (ptr_ce_swig_%s=zend_register_internal_class_ex(&ce_swig_%s,&ce_swig_%s,NULL TSRMLS_CC))) zend_error(E_ERROR,\"Error registering wrapper for class %s\");\n", - shadow_classname, shadow_classname, GetChar(base.item, "sym:name"), shadow_classname); - } else { - Printf(s_oinit, - "if (! (ptr_ce_swig_%s=zend_register_internal_class_ex(&ce_swig_%s,NULL,NULL TSRMLS_CC))) zend_error(E_ERROR,\"Error registering wrapper for class %s\");\n", - shadow_classname, shadow_classname, shadow_classname); - } - Printf(s_oinit, "\n"); - - // Write the enum initialisation code in a static block - // These are all the enums defined within the C++ class. - - Delete(shadow_classname); - shadow_classname = NULL; - - Delete(shadow_set_vars); - shadow_set_vars = NULL; - Delete(shadow_get_vars); - shadow_get_vars = NULL; - - Printv(all_cs_entry, cs_entry, " { NULL, NULL, NULL}\n};\n", NIL); - Delete(cs_entry); - cs_entry = NULL; - } else if (shadow && php_version == 5) { + if (shadow) { DOH *key; List *baselist = Getattr(n, "bases"); Iterator ki, base; @@ -2430,21 +1782,10 @@ public: * ------------------------------------------------------------ */ virtual int memberfunctionHandler(Node *n) { - char *name = GetChar(n, "name"); - char *iname = GetChar(n, "sym:name"); - wrapperType = memberfn; this->Language::memberfunctionHandler(n); wrapperType = standard; - // Only declare the member function if - // we are doing shadow classes, and the function - // is not overloaded, or if it is overloaded, it is the dispatch function. - if (shadow && php_version == 4 && (!Getattr(n, "sym:overloaded") || !Getattr(n, "sym:nextSibling"))) { - char *realname = iname ? iname : name; - String *php_function_name = Swig_name_member(shadow_classname, realname); - create_command(realname, Swig_name_wrapper(php_function_name)); - } return SWIG_OK; } @@ -2453,7 +1794,6 @@ public: * ------------------------------------------------------------ */ virtual int membervariableHandler(Node *n) { - wrapperType = membervar; Language::membervariableHandler(n); wrapperType = standard; @@ -2466,7 +1806,6 @@ public: * ------------------------------------------------------------ */ virtual int staticmembervariableHandler(Node *n) { - wrapperType = staticmembervar; Language::staticmembervariableHandler(n); wrapperType = standard; @@ -2488,12 +1827,13 @@ public: * would be available in php as Example::ncount() */ - // If the variable is const, then it's wrapped as a constant with set/get functions. + // If the variable is const, then it's wrapped as a constant with set/get + // functions. if (SwigType_isconst(type)) return SWIG_OK; - // This duplicates the logic from Language::variableWrapper() to test if the set wrapper - // is made. + // This duplicates the logic from Language::variableWrapper() to test if + // the set wrapper is made. int assignable = is_assignable(n); if (assignable) { String *tm = Swig_typemap_lookup("globalin", n, name, 0); @@ -2538,37 +1878,16 @@ public: * ------------------------------------------------------------ */ virtual int staticmemberfunctionHandler(Node *n) { - char *name = GetChar(n, "name"); - char *iname = GetChar(n, "sym:name"); - wrapperType = staticmemberfn; Language::staticmemberfunctionHandler(n); wrapperType = standard; - if (shadow && php_version == 4) { - String *symname = Getattr(n, "sym:name"); - char *realname = iname ? iname : name; - String *php_function_name = Swig_name_member(shadow_classname, realname); - create_command(symname, Swig_name_wrapper(php_function_name)); - } - return SWIG_OK; } - - String * SwigToPhpType(Node *n, int shadow_flag) { - String *ptype = 0; + String * GetShadowReturnType(Node *n) { SwigType *t = Getattr(n, "type"); - if (shadow_flag) { - ptype = PhpTypeFromTypemap((char *) "pstype", n, (char *) ""); - } - if (!ptype) { - ptype = PhpTypeFromTypemap((char *) "ptype", n, (char *) ""); - } - - if (ptype) return ptype; - /* Map type here */ switch (SwigType_type(t)) { case T_CHAR: @@ -2589,7 +1908,7 @@ public: case T_POINTER: case T_REFERENCE: case T_USER: - if (shadow_flag && is_shadow(t)) { + if (is_shadow(t)) { return NewString(Char(is_shadow(t))); } break; @@ -2597,7 +1916,7 @@ public: /* TODO */ break; default: - Printf(stderr, "SwigToPhpType: unhandled data type: %s\n", SwigType_str(t, 0)); + Printf(stderr, "GetShadowReturnType: unhandled data type: %s\n", SwigType_str(t, 0)); break; } @@ -2612,54 +1931,20 @@ public: return NewStringf("%s", tms); } - int abstractConstructorHandler(Node *n) { - String *iname = GetChar(n, "sym:name"); - if (shadow && php_version == 4) { - Wrapper *f = NewWrapper(); - - String *wname = NewStringf("_wrap_new_%s", iname); - create_command(iname, wname); - - Printf(f->def, "ZEND_NAMED_FUNCTION(_wrap_new_%s) {\n", iname); - Printf(f->def, " zend_error(E_ERROR,\"Cannot create swig object type: %s as the underlying class is abstract\");\n", iname); - Printf(f->def, "}\n\n"); - Wrapper_print(f, s_wrappers); - DelWrapper(f); - Delete(wname); - } + int abstractConstructorHandler(Node *) { return SWIG_OK; } + /* ------------------------------------------------------------ * constructorHandler() * ------------------------------------------------------------ */ virtual int constructorHandler(Node *n) { - char *name = GetChar(n, "name"); - char *iname = GetChar(n, "sym:name"); - - if (shadow && php_version == 4) { - if (iname && strcmp(iname, Char(shadow_classname)) == 0) { - native_constructor = NATIVE_CONSTRUCTOR; - } else { - native_constructor = ALTERNATIVE_CONSTRUCTOR; - } - } else { - native_constructor = 0; - } constructors++; wrapperType = constructor; Language::constructorHandler(n); wrapperType = standard; - if (shadow && php_version == 4) { - if (!Getattr(n, "sym:overloaded") || !Getattr(n, "sym:nextSibling")) { - char *realname = iname ? iname : name; - String *php_function_name = Swig_name_construct(realname); - create_command(realname, Swig_name_wrapper(php_function_name)); - } - } - - native_constructor = 0; return SWIG_OK; } @@ -2770,9 +2055,14 @@ static Language *new_swig_php(int php_version) { } return maininstance; } + extern "C" Language *swig_php4(void) { - return new_swig_php(4); + Printf(stderr, "*** -php4 is no longer supported.\n" + "*** Either upgrade to PHP5 or use SWIG 1.3.36 or earlier.\n"); + SWIG_exit(EXIT_FAILURE); + return NULL; // To avoid compiler warnings. } + extern "C" Language *swig_php5(void) { return new_swig_php(5); } diff --git a/Source/Modules/python.cxx b/Source/Modules/python.cxx index bfdec0d76..7a878b4f8 100644 --- a/Source/Modules/python.cxx +++ b/Source/Modules/python.cxx @@ -49,10 +49,11 @@ static String *shadow_indent = 0; static int in_class = 0; static int classic = 0; static int modern = 0; -static int apply = 0; static int new_repr = 1; static int no_header_file = 0; +static int py3 = 0; + /* C++ Support + Shadow Classes */ static int have_constructor; @@ -96,7 +97,6 @@ enum autodoc_t { static const char *usage1 = (char *) "\ Python Options (available with -python)\n\ -aliasobj0 - Alias obj0 when using fastunpack, needed for some old typemaps \n\ - -apply - Use apply() in proxy classes\n\ -buildnone - Use Py_BuildValue(" ") to obtain Py_None (default in Windows)\n\ -castmode - Enable the casting mode, which allows implicit cast between types in python\n\ -classic - Use classic classes only\n\ @@ -148,6 +148,8 @@ static const char *usage3 = (char *) "\ -O - Enable all the optimization options: \n\ -modern -fastdispatch -dirvtable -nosafecstrings -fvirtual -noproxydel \n\ -fastproxy -fastinit -fastunpack -fastquery -modernargs -nobuildnone \n\ + -py3 - Generate code with Python 3 specific features:\n\ + Function annotation \n\ \n"; class PYTHON:public Language { @@ -259,9 +261,6 @@ public: } else if ((strcmp(argv[i], "-shadow") == 0) || ((strcmp(argv[i], "-proxy") == 0))) { shadow = 1; Swig_mark_arg(i); - } else if (strcmp(argv[i], "-apply") == 0) { - apply = 1; - Swig_mark_arg(i); } else if ((strcmp(argv[i], "-new_repr") == 0) || (strcmp(argv[i], "-newrepr") == 0)) { new_repr = 1; Swig_mark_arg(i); @@ -284,7 +283,6 @@ public: } else if (strcmp(argv[i], "-classic") == 0) { classic = 1; modernargs = 0; - apply = 1; modern = 0; Swig_mark_arg(i); } else if (strcmp(argv[i], "-cppcast") == 0) { @@ -390,7 +388,6 @@ public: proxydel = 0; Swig_mark_arg(i); } else if (strcmp(argv[i], "-modern") == 0) { - apply = 0; classic = 0; modern = 1; modernargs = 1; @@ -408,7 +405,6 @@ public: no_header_file = 1; Swig_mark_arg(i); } else if (strcmp(argv[i], "-O") == 0) { - apply = 0; classic = 0; modern = 1; dirvtable = 1; @@ -429,8 +425,17 @@ public: fputs(usage1, stdout); fputs(usage2, stdout); fputs(usage3, stdout); - } + } else if (strcmp(argv[i], "-py3") == 0) { + py3 = 1; + Swig_mark_arg(i); + } + } + } /* for */ + + if (py3) { + /* force disable features that not compatible with Python 3.x */ + classic = 0; } if (cppcast) { @@ -689,13 +694,46 @@ public: mod_docstring = NULL; } - Printf(f_shadow, "\nimport %s\n", module); + Printv(f_shadow, "\nfrom sys import version_info\n", NULL); + + if(fastproxy) + { + Printv(f_shadow, "if version_info >= (3,0,0):\n", NULL); + Printf(f_shadow, tab4 "new_instancemethod = lambda func, inst, cls: %s.SWIG_PyInstanceMethod_New(func)\n", module); + Printv(f_shadow, "else:\n", NULL); + Printv(f_shadow, tab4, "from new import instancemethod as new_instancemethod\n", NULL); + } + /* Import the C-extension module. This should be a relative import, + * since the shadow module may also have been imported by a relative + * import, and there is thus no guarantee that the C-extension is on + * sys.path. Relative imports must be explicitly specified from 2.6.0 + * onwards (implicit relative imports will raise a DeprecationWarning + * in 2.6, and fail in 2.7 onwards), but the relative import syntax + * isn't available in python 2.4 or earlier, so we have to write some + * code conditional on the python version. + */ + Printv(f_shadow, "if version_info >= (2,6,0):\n", NULL); + Printv(f_shadow, tab4, "def swig_import_helper():\n", NULL); + Printv(f_shadow, tab8, "from os.path import dirname\n", NULL); + Printv(f_shadow, tab8, "import imp\n", NULL); + Printv(f_shadow, tab8, "try:\n", NULL); + Printf(f_shadow, tab4 tab8 "fp, pathname, description = imp.find_module('%s', [dirname(__file__)])\n", module); + Printf(f_shadow, tab4 tab8 "_mod = imp.load_module('%s', fp, pathname, description)\n", module); + Printv(f_shadow, tab8, "finally:\n", NULL); + Printv(f_shadow, tab4 tab8, "if fp is not None: fp.close()\n", NULL); + Printv(f_shadow, tab8, "return _mod\n", NULL); + Printf(f_shadow, tab4 "%s = swig_import_helper()\n", module); + Printv(f_shadow, tab4, "del swig_import_helper\n", NULL); + Printv(f_shadow, "else:\n", NULL); + Printf(f_shadow, tab4 "import %s\n", module); + + /* Delete the version_info symbol since we don't use it elsewhere in the + * module. */ + Printv(f_shadow, "del version_info\n", NULL); - Printv(f_shadow, "import new\n", NULL); - Printv(f_shadow, "new_instancemethod = new.instancemethod\n", NULL); if (modern || !classic) { Printv(f_shadow, "try:\n", tab4, "_swig_property = property\n", "except NameError:\n", tab4, "pass # Python < 2.2 doesn't have 'property'.\n", NULL); - } + } /* if (!modern) */ /* always needed, a class can be forced to be no-modern, such as an exception */ { @@ -722,7 +760,7 @@ public: "def _swig_getattr(self,class_type,name):\n", tab4, "if (name == \"thisown\"): return self.this.own()\n", tab4, "method = class_type.__swig_getmethods__.get(name,None)\n", - tab4, "if method: return method(self)\n", tab4, "raise AttributeError,name\n\n", NIL); + tab4, "if method: return method(self)\n", tab4, "raise AttributeError(name)\n\n", NIL); Printv(f_shadow, "def _swig_repr(self):\n", @@ -730,11 +768,17 @@ public: tab4, "except: strthis = \"\"\n", tab4, "return \"<%s.%s; %s >\" % (self.__class__.__module__, self.__class__.__name__, strthis,)\n\n", NIL); if (!classic) { + /* Usage of types.ObjectType is deprecated. + * But don't sure wether this would broken old Python? + */ Printv(f_shadow, - "import types\n", +// "import types\n", "try:\n", - " _object = types.ObjectType\n", - " _newclass = 1\n", "except AttributeError:\n", " class _object : pass\n", " _newclass = 0\n", "del types\n", "\n\n", NIL); +// " _object = types.ObjectType\n", + " _object = object\n", + " _newclass = 1\n", "except AttributeError:\n", " class _object : pass\n", " _newclass = 0\n", +// "del types\n", + "\n\n", NIL); } } if (modern) { @@ -760,7 +804,11 @@ public: } - Printf(f_header, "#define SWIG_init init%s\n\n", module); + Printf(f_header, "#if PY_VERSION_HEX >= 0x03000000\n"); + Printf(f_header, "# define SWIG_init PyInit_%s\n\n", module); + Printf(f_header, "#else\n"); + Printf(f_header, "# define SWIG_init init%s\n\n", module); + Printf(f_header, "#endif\n"); Printf(f_header, "#define SWIG_name \"%s\"\n", module); Printf(f_wrappers, "#ifdef __cplusplus\n"); @@ -769,6 +817,9 @@ public: Append(const_code, "static swig_const_info swig_const_table[] = {\n"); Append(methods, "static PyMethodDef SwigMethods[] = {\n"); + /* the method exported for replacement of new.instancemethod in Python 3 */ + add_pyinstancemethod_new(); + /* emit code */ Language::top(n); @@ -787,6 +838,12 @@ public: Append(const_code, "{0, 0, 0, 0.0, 0, 0}};\n"); Printf(f_wrappers, "%s\n", const_code); initialize_threads(f_init); + + Printf(f_init, "#if PY_VERSION_HEX >= 0x03000000\n"); + Printf(f_init, " return m;\n"); + Printf(f_init, "#else\n"); + Printf(f_init, " return;\n"); + Printf(f_init, "#endif\n"); Printf(f_init, "}\n"); Printf(f_wrappers, "#ifdef __cplusplus\n"); @@ -794,10 +851,6 @@ public: Printf(f_wrappers, "#endif\n"); if (shadow) { - /* - Printf(f_shadow_imports,"\nimport %s\n", module); - Printv(f_shadow_py, f_shadow_imports, "\n",NIL); - */ Printv(f_shadow_py, f_shadow, "\n", NIL); Printv(f_shadow_py, f_shadow_stubs, "\n", NIL); @@ -831,6 +884,19 @@ public: return SWIG_OK; } + + /* ------------------------------------------------------------ + * Emit the wrapper for PyInstanceMethod_New to MethodDef array. + * This wrapper is used to implement -fastproxy, + * as a replacement of new.instancemethod in Python 3. + * ------------------------------------------------------------ */ + int add_pyinstancemethod_new() + { + String* name = NewString("SWIG_PyInstanceMethod_New"); + Printf(methods, "\t { (char *)\"%s\", (PyCFunction)%s, METH_O, NULL},", name, name); + Delete(name); + return 0; + } /* ------------------------------------------------------------ * importDirective() @@ -874,25 +940,19 @@ public: return Language::importDirective(n); } - /* ------------------------------------------------------------ - * emitFuncCallHelper() - * Write the shadow code to call a function in the extension - * module. Takes into account the -apply flag and whether - * to use keyword args or not. + * funcCall() + * Emit shadow code to call a function in the extension + * module. Using proper argument and calling style for + * given node n. * ------------------------------------------------------------ */ + String *funcCall(String *name, String *parms) { + String *str = NewString(""); - String *funcCallHelper(String *name, int kw) { - String *str; - - str = NewString(""); - if (apply) { - Printv(str, "apply(", module, ".", name, ", args", (kw ? ", kwargs" : ""), ")", NIL); - } else { - Printv(str, module, ".", name, "(*args", (kw ? ", **kwargs" : ""), ")", NIL); - } + Printv(str, module, ".", name, "(", parms, ")", NIL); return str; - } + } + /* ------------------------------------------------------------ * pythoncode() - Output python code into the shadow file @@ -1060,29 +1120,84 @@ public: return doc; } + /* ----------------------------------------------------------------------------- + * makeParameterName() + * Note: the generated name should consist with that in kwnames[] + * + * Inputs: + * n - Node + * p - parameter node + * arg_num - parameter argument number + * Return: + * arg - a unique parameter name + * ----------------------------------------------------------------------------- */ + + String *makeParameterName(ParmList *plist, Parm *p, int arg_num) { + String *arg = 0; + String *pn = Swig_name_make(p, 0, Getattr(p, "name"), 0, 0); + // Use C parameter name unless it is a duplicate or an empty parameter name + int count = 0; + if ( SwigType_isvarargs(Getattr(p, "type")) ) { + return NewString("*args"); + } + while (plist) { + if ((Cmp(pn, Getattr(plist, "name")) == 0)) + count++; + plist = nextSibling(plist); + } + arg = (!pn || !Len(pn) || (count > 1)) ? NewStringf("arg%d", arg_num) : Copy(pn); + return arg; + } + + /* ------------------------------------------------------------ * make_autodocParmList() * Generate the documentation for the function parameters + * Parameters: + * func_annotation: Function annotation support * ------------------------------------------------------------ */ - String *make_autodocParmList(Node *n, bool showTypes) { + String *make_autodocParmList(Node *n, bool showTypes, bool calling=false, bool func_annotation=false) { + + String *doc = NewString(""); String *pdocs = Copy(Getattr(n, "feature:pdocs")); ParmList *plist = CopyParmList(Getattr(n, "parms")); Parm *p; Parm *pnext; - Node *lookup; + Node *lookup; + + int lines = 0; + int arg_num = 0; const int maxwidth = 50; + if(calling) + func_annotation = false; + if (pdocs) Append(pdocs, "\n"); - Swig_typemap_attach_parms("in", plist, 0); Swig_typemap_attach_parms("doc", plist, 0); - + + if (Strcmp(ParmList_protostr(plist), "void")==0) { + //No parameters actually + return doc; + } + for (p = plist; p; p = pnext) { + + String *tm = Getattr(p, "tmap:in"); + if (tm) { + pnext = Getattr(p, "tmap:in:next"); + if (checkAttribute(p, "tmap:in:numinputs", "0")) { + continue; + } + } else { + pnext = nextSibling(p); + } + String *name = 0; String *type = 0; String *value = 0; @@ -1099,12 +1214,14 @@ public: type = type ? type : Getattr(p, "type"); value = value ? value : Getattr(p, "value"); - String *tm = Getattr(p, "tmap:in"); - if (tm) { - pnext = Getattr(p, "tmap:in:next"); - } else { - pnext = nextSibling(p); - } + name = makeParameterName(plist, p, arg_num); + // Reset it for convinient in further use. (mainly for makeParameterName()) + // Since the plist is created by CopyParmList, + // we can hope that the set would have no side effect + Setattr(p, "name", name); + + arg_num++; + if (Len(doc)) { // add a comma to the previous one if any @@ -1116,39 +1233,40 @@ public: lines += 1; } } + + type = SwigType_base(type); + lookup = Swig_symbol_clookup(type, 0); + if (lookup) + type = Getattr(lookup, "sym:name"); + // Do the param type too? - if (showTypes) { - type = SwigType_base(type); - lookup = Swig_symbol_clookup(type, 0); - if (lookup) - type = Getattr(lookup, "sym:name"); - Printf(doc, "%s ", type); + if (showTypes) + Printf(doc, "%s ", type); + + + Append(doc, name); + if (pdoc) { + if (!pdocs) + pdocs = NewString("Parameters:\n"); + Printf(pdocs, " %s\n", pdoc); } - if (name) { - Append(doc, name); - if (pdoc) { - if (!pdocs) - pdocs = NewString("Parameters:\n"); - Printf(pdocs, " %s\n", pdoc); - } - } else { - Append(doc, "?"); - } + // Write the function annoation + if (func_annotation) + Printf(doc, " : '%s'", type); - if (value) { - if (Strcmp(value, "NULL") == 0) - value = NewString("None"); - else if (Strcmp(value, "true") == 0 || Strcmp(value, "TRUE") == 0) - value = NewString("True"); - else if (Strcmp(value, "false") == 0 || Strcmp(value, "FALSE") == 0) - value = NewString("False"); + // Write default value + if (value && !calling) { + String* pv = pyvalue(value, Getattr(p, "type")); + if (pv) + value = pv; else { lookup = Swig_symbol_clookup(value, 0); - if (lookup) + if (lookup) { value = Getattr(lookup, "sym:name"); + } } - Printf(doc, "=%s", value); + Printf(doc, " = %s", value); } } if (pdocs) @@ -1286,6 +1404,132 @@ public: return doc; } + + /* ------------------------------------------------------------ + * pyvalue() + * Check if string v can be a Python value literal, + * (eg. number or string), or translate it to a Python literal. + * ------------------------------------------------------------ */ + String* pyvalue(String *v, SwigType *t) + { + if (v && Len(v)>0) { + char fc = (Char(v))[0]; + if (('0'<=fc && fc<='9') || '\''==fc || '"'==fc) { + /* number or string (or maybe NULL pointer)*/ + if (SwigType_ispointer(t) && Strcmp(v, "0")==0) + return NewString("None"); + else + return v; + } + if (Strcmp(v, "true")==0 || Strcmp(v, "FALSE")==0) + return NewString("True"); + if (Strcmp(v, "false")==0 || Strcmp(v, "FALSE")==0) + return NewString("False"); + if (Strcmp(v, "NULL")==0) + return NewString("None"); + } + return 0; + } + /* ------------------------------------------------------------ + * is_primitive_defaultargs() + * Check if all the default args have primitive type. + * (So we can generate proper parameter list with default + * values..) + * ------------------------------------------------------------ */ + bool is_primitive_defaultargs(Node *n) + { + ParmList *plist = CopyParmList(Getattr(n, "parms")); + Parm *p; + Parm *pnext; + + Swig_typemap_attach_parms("in", plist, 0); + for (p = plist; p; p = pnext) { + String *tm = Getattr(p, "tmap:in"); + if (tm) { + pnext = Getattr(p, "tmap:in:next"); + if (checkAttribute(p, "tmap:in:numinputs", "0")) { + continue; + } + } else { + pnext = nextSibling(p); + } + String *type = Getattr(p, "type"); + String *value = Getattr(p, "value"); + if (!pyvalue(value, type)) + return false; + } + return true; + } + + + /* ------------------------------------------------------------ + * is_real_overloaded() + * Check if the function is overloaded, but not just have some + * siblings generated due to the original function have + * default arguments. + * ------------------------------------------------------------ */ + bool is_real_overloaded(Node *n) + { + Node *h = Getattr(n, "sym:overloaded"); + Node *i; + if (!h) + return false; + + i = Getattr(h, "sym:nextSibling"); + while (i) { + Node *nn = Getattr(i, "defaultargs"); + if (nn != h) { + /* Check if overloaded function has defaultargs and + * pointed to the first overloaded. */ + return true; + } + i = Getattr(i, "sym:nextSibling"); + } + + return false; + } + + /* ------------------------------------------------------------ + * make_pyParmList() + * Generate parameter list for Python functions or methods, + * reuse make_autodocParmList() to do so. + * ------------------------------------------------------------ */ + String* make_pyParmList(Node *n, bool in_class, bool is_calling, int kw) + { + /* Get the original function for a defaultargs copy, + * see default_arguments() in parser.y. */ + Node *nn = Getattr(n, "defaultargs"); + if (nn) n = nn; + + /* For overloaded function, just use *args */ + if (is_real_overloaded(n) || + GetFlag(n, "feature:compactdefaultargs") || + !is_primitive_defaultargs(n)) + { + String *parms = NewString(""); + if(in_class) + Printf(parms, "self, "); + Printf(parms, "*args"); + if (kw) + Printf(parms, ", **kwargs"); + return parms; + } + + bool funcanno = py3 ? true : false; + String *params = NewString(""); + String *_params = make_autodocParmList(n, false, is_calling, funcanno); + + if (in_class) + { + Printf(params, "self"); + if(Len(_params) > 0) + Printf(params, ", "); + } + + Printv(params, _params, NULL); + + return params; + } /* ------------------------------------------------------------ * have_pythonprepend() @@ -1351,6 +1595,40 @@ public: return have_pythonappend(n) || have_pythonprepend(n) || have_docstring(n); } + + /* ------------------------------------------------------------ + * returnTypeAnnotation() + * Helper function for constructing the function annotation + * of the returning type, return a empty string for Python 2.x + * ------------------------------------------------------------ */ + String* returnTypeAnnotation(Node *n) + { + String *ret=0; + Parm *p = Getattr(n, "parms"); + String *tm; + /* Try to guess the returning type by argout typemap, + * however the result may not accurate. */ + while (p) { + if ((tm=Getattr(p, "tmap:argout:match_type"))) { + tm = SwigType_str(tm, 0); + if (ret) + Printv(ret, ", ", tm, NULL); + else + ret = tm; + p = Getattr(p, "tmap:argout:next"); + } else { + p = nextSibling(p); + } + } + /* If no argout typemap, then get the returning type from + * the function prototype. */ + if (!ret) { + ret = Getattr(n, "type"); + if (ret) ret = SwigType_str(ret, 0); + } + return (ret && py3) ? NewStringf(" -> \"%s\" ", ret) + : NewString(""); + } /* ------------------------------------------------------------ * emitFunctionShadowHelper() @@ -1360,24 +1638,26 @@ public: * ------------------------------------------------------------ */ void emitFunctionShadowHelper(Node *n, File *f_dest, String *name, int kw) { - if (Getattr(n, "feature:python:callback") || !have_addtofunc(n)) { - /* If there is no addtofunc directive then just assign from the extension module */ - Printv(f_dest, name, " = ", module, ".", name, "\n", NIL); + String *parms = make_pyParmList(n, false, false, kw); + String *callParms = make_pyParmList(n, false, true, kw); + /* Make a wrapper function to insert the code into */ + Printv(f_dest, "\ndef ", name, "(", parms, ")", returnTypeAnnotation(n), ":\n", NIL); + if (have_docstring(n)) + Printv(f_dest, ctab4, docstring(n, AUTODOC_FUNC, tab4), "\n", NIL); + if (have_pythonprepend(n)) + Printv(f_dest, ctab4, pythonprepend(n), "\n", NIL); + if (have_pythonappend(n)) { + Printv(f_dest, ctab4, "val = ", funcCall(name, callParms), "\n", NIL); + Printv(f_dest, ctab4, pythonappend(n), "\n", NIL); + Printv(f_dest, ctab4, "return val\n", NIL); } else { - /* Otherwise make a wrapper function to insert the code into */ - Printv(f_dest, "\ndef ", name, "(*args", (kw ? ", **kwargs" : ""), "):\n", NIL); - if (have_docstring(n)) - Printv(f_dest, ctab4, docstring(n, AUTODOC_FUNC, tab4), "\n", NIL); - if (have_pythonprepend(n)) - Printv(f_dest, ctab4, pythonprepend(n), "\n", NIL); - if (have_pythonappend(n)) { - Printv(f_dest, ctab4, "val = ", funcCallHelper(name, kw), "\n", NIL); - Printv(f_dest, ctab4, pythonappend(n), "\n", NIL); - Printv(f_dest, ctab4, "return val\n", NIL); - } else { - Printv(f_dest, ctab4, "return ", funcCallHelper(name, kw), "\n", NIL); - } + Printv(f_dest, ctab4, "return ", funcCall(name, callParms), "\n", NIL); } + + if (Getattr(n, "feature:python:callback") || !have_addtofunc(n)) { + /* If there is no addtofunc directive then just assign from the extension module (for speed up) */ + Printv(f_dest, name, " = ", module, ".", name, "\n", NIL); + } } @@ -1773,7 +2053,6 @@ public: Swig_warning(WARN_TYPEMAP_IN_UNDEF, input_file, line_number, "Unable to use type %s as a function argument.\n", SwigType_str(pt, 0)); break; } - p = nextSibling(p); } /* finish argument marshalling */ @@ -2461,7 +2740,7 @@ public: Printf(f_directors_h, " PyObject *swig_get_method(size_t method_index, const char *method_name) const {\n"); Printf(f_directors_h, " PyObject *method = vtable[method_index];\n"); Printf(f_directors_h, " if (!method) {\n"); - Printf(f_directors_h, " swig::PyObject_var name = PyString_FromString(method_name);\n"); + Printf(f_directors_h, " swig::PyObject_var name = SWIG_Python_str_FromChar(method_name);\n"); Printf(f_directors_h, " method = PyObject_GetAttr(swig_get_self(), name);\n"); Printf(f_directors_h, " if (method == NULL) {\n"); Printf(f_directors_h, " std::string msg = \"Method in class %s doesn't exist, undefined \";\n", classname); @@ -2596,6 +2875,16 @@ public: } } } + + /* dealing with abstract base class */ + String *abcs = Getattr(n, "feature:python:abc"); + if (py3 && abcs) { + if (Len(base_class)) { + Putc(',', base_class); + } + Printv(base_class, abcs, NIL); + } + Printv(f_shadow, "class ", class_name, NIL); if (Len(base_class)) { @@ -2604,6 +2893,9 @@ public: if (!classic) { Printf(f_shadow, modern ? "(object)" : "(_object)"); } + if (GetFlag(n, "feature:exceptionclass") ) { + Printf(f_shadow, "(Exception)"); + } } Printf(f_shadow, ":\n"); if (have_docstring(n)) { @@ -2694,7 +2986,7 @@ public: Delete(realct); } if (!have_constructor) { - Printv(f_shadow_file, tab4, "def __init__(self, *args, **kwargs): raise AttributeError, \"No constructor defined\"\n", NIL); + Printv(f_shadow_file, tab4, "def __init__(self, *args, **kwargs): raise AttributeError(\"No constructor defined\")\n", NIL); } else if (fastinit) { Printv(f_wrappers, "SWIGINTERN PyObject *", class_name, "_swiginit(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {\n", NIL); @@ -2807,13 +3099,15 @@ public: Delete(pycode); fproxy = 0; } else { + String *parms = make_pyParmList(n, true, false, allow_kwargs); + String *callParms = make_pyParmList(n, true, true, allow_kwargs); if (!have_addtofunc(n)) { if (!fastproxy || olddefs) { - Printv(f_shadow, tab4, "def ", symname, "(*args", (allow_kwargs ? ", **kwargs" : ""), "):", NIL); - Printv(f_shadow, " return ", funcCallHelper(Swig_name_member(class_name, symname), allow_kwargs), "\n", NIL); + Printv(f_shadow, tab4, "def ", symname, "(", parms, ")", returnTypeAnnotation(n), ":", NIL); + Printv(f_shadow, " return ", funcCall(Swig_name_member(class_name, symname), callParms), "\n", NIL); } } else { - Printv(f_shadow, tab4, "def ", symname, "(*args", (allow_kwargs ? ", **kwargs" : ""), "):", NIL); + Printv(f_shadow, tab4, "def ", symname, "(",parms , ")", returnTypeAnnotation(n), ":", NIL); Printv(f_shadow, "\n", NIL); if (have_docstring(n)) Printv(f_shadow, tab8, docstring(n, AUTODOC_METHOD, tab8), "\n", NIL); @@ -2823,11 +3117,11 @@ public: } if (have_pythonappend(n)) { fproxy = 0; - Printv(f_shadow, tab8, "val = ", funcCallHelper(Swig_name_member(class_name, symname), allow_kwargs), "\n", NIL); + Printv(f_shadow, tab8, "val = ", funcCall(Swig_name_member(class_name, symname), callParms), "\n", NIL); Printv(f_shadow, tab8, pythonappend(n), "\n", NIL); Printv(f_shadow, tab8, "return val\n\n", NIL); } else { - Printv(f_shadow, tab8, "return ", funcCallHelper(Swig_name_member(class_name, symname), allow_kwargs), "\n\n", NIL); + Printv(f_shadow, tab8, "return ", funcCall(Swig_name_member(class_name, symname), callParms), "\n\n", NIL); } } } @@ -2860,17 +3154,19 @@ public: if (shadow) { if (!classic && !Getattr(n, "feature:python:callback") && have_addtofunc(n)) { int kw = (check_kwargs(n) && !Getattr(n, "sym:overloaded")) ? 1 : 0; - Printv(f_shadow, tab4, "def ", symname, "(*args", (kw ? ", **kwargs" : ""), "):\n", NIL); + String *parms = make_pyParmList(n, true, false, kw); + String *callParms = make_pyParmList(n, true, true, kw); + Printv(f_shadow, tab4, "def ", symname, "(", parms, ")", returnTypeAnnotation(n), ":\n", NIL); if (have_docstring(n)) Printv(f_shadow, tab8, docstring(n, AUTODOC_STATICFUNC, tab8), "\n", NIL); if (have_pythonprepend(n)) Printv(f_shadow, tab8, pythonprepend(n), "\n", NIL); if (have_pythonappend(n)) { - Printv(f_shadow, tab8, "val = ", funcCallHelper(Swig_name_member(class_name, symname), kw), "\n", NIL); + Printv(f_shadow, tab8, "val = ", funcCall(Swig_name_member(class_name, symname), callParms), "\n", NIL); Printv(f_shadow, tab8, pythonappend(n), "\n", NIL); Printv(f_shadow, tab8, "return val\n\n", NIL); } else { - Printv(f_shadow, tab8, "return ", funcCallHelper(Swig_name_member(class_name, symname), kw), "\n\n", NIL); + Printv(f_shadow, tab8, "return ", funcCall(Swig_name_member(class_name, symname), callParms), "\n\n", NIL); } Printv(f_shadow, tab4, modern ? "" : "if _newclass:", symname, " = staticmethod(", symname, ")\n", NIL); @@ -2942,8 +3238,8 @@ public: handled_as_init = (Strcmp(nname, sname) == 0) || (Strcmp(nname, cname) == 0); Delete(cname); } - - if (!have_constructor && handled_as_init) { + + if (!have_constructor && handled_as_init) { if (Getattr(n, "feature:shadow")) { String *pycode = pythoncode(Getattr(n, "feature:shadow"), tab4); String *pyaction = NewStringf("%s.%s", module, Swig_name_construct(symname)); @@ -2957,23 +3253,30 @@ public: String *classname = Swig_class_name(parent); String *rclassname = Swig_class_name(getCurrentClass()); assert(rclassname); - if (use_director) { + + String *parms = make_pyParmList(n, true, false, allow_kwargs); + /* Pass 'self' only if using director */ + String *callParms = make_pyParmList(n, false, true, allow_kwargs); + + if (use_director) { + Insert(callParms, 0, "_self, "); Printv(pass_self, tab8, NIL); Printf(pass_self, "if self.__class__ == %s:\n", classname); - Printv(pass_self, tab8, tab4, "args = (None,) + args\n", tab8, "else:\n", tab8, tab4, "args = (self,) + args\n", NIL); + //Printv(pass_self, tab8, tab4, "args = (None,) + args\n", tab8, "else:\n", tab8, tab4, "args = (self,) + args\n", NIL); + Printv(pass_self, tab8, tab4, "_self = None\n", tab8, "else:\n", tab8, tab4, "_self = self\n", NIL); } - Printv(f_shadow, tab4, "def __init__(self, *args", (allow_kwargs ? ", **kwargs" : ""), "): \n", NIL); + Printv(f_shadow, tab4, "def __init__(", parms, ")", returnTypeAnnotation(n), ": \n", NIL); if (have_docstring(n)) Printv(f_shadow, tab8, docstring(n, AUTODOC_CTOR, tab8), "\n", NIL); if (have_pythonprepend(n)) Printv(f_shadow, tab8, pythonprepend(n), "\n", NIL); Printv(f_shadow, pass_self, NIL); if (fastinit) { - Printv(f_shadow, tab8, module, ".", class_name, "_swiginit(self,", funcCallHelper(Swig_name_construct(symname), allow_kwargs), ")\n", NIL); + Printv(f_shadow, tab8, module, ".", class_name, "_swiginit(self,", funcCall(Swig_name_construct(symname), callParms), ")\n", NIL); } else { Printv(f_shadow, - tab8, "this = ", funcCallHelper(Swig_name_construct(symname), allow_kwargs), "\n", + tab8, "this = ", funcCall(Swig_name_construct(symname), callParms), "\n", tab8, "try: self.this.append(this)\n", tab8, "except: self.this = this\n", NIL); } if (have_pythonappend(n)) @@ -2993,13 +3296,15 @@ public: Printv(f_shadow_stubs, pycode, "\n", NIL); Delete(pycode); } else { + String *parms = make_pyParmList(n, true, false, allow_kwargs); + String *callParms = make_pyParmList(n, true, true, allow_kwargs); - Printv(f_shadow_stubs, "\ndef ", symname, "(*args", (allow_kwargs ? ", **kwargs" : ""), "):\n", NIL); + Printv(f_shadow_stubs, "\ndef ", symname, "(", parms, ")", returnTypeAnnotation(n), ":\n", NIL); if (have_docstring(n)) Printv(f_shadow_stubs, tab4, docstring(n, AUTODOC_CTOR, tab4), "\n", NIL); if (have_pythonprepend(n)) Printv(f_shadow_stubs, tab4, pythonprepend(n), "\n", NIL); - Printv(f_shadow_stubs, tab4, "val = ", funcCallHelper(Swig_name_construct(symname), allow_kwargs), "\n", NIL); + Printv(f_shadow_stubs, tab4, "val = ", funcCall(Swig_name_construct(symname), callParms), "\n", NIL); #ifdef USE_THISOWN Printv(f_shadow_stubs, tab4, "val.thisown = 1\n", NIL); #endif @@ -3578,15 +3883,15 @@ int PYTHON::classDirectorMethod(Node *n, Node *parent, String *super) { if (use_parse || !modernargs) { Printf(w->code, "swig::PyObject_var result = PyObject_CallMethod(swig_get_self(), (char *)\"%s\", (char *)\"(%s)\" %s);\n", pyname, parse_args, arglist); - } else { - Printf(w->code, "swig::PyObject_var swig_method_name = PyString_FromString((char *)\"%s\");\n", pyname); + } else { + Printf(w->code, "swig::PyObject_var swig_method_name = SWIG_Python_str_FromChar((char *)\"%s\");\n", pyname); Printf(w->code, "swig::PyObject_var result = PyObject_CallMethodObjArgs(swig_get_self(), (PyObject *) swig_method_name %s, NULL);\n", arglist); } } else { if (!modernargs) { Printf(w->code, "swig::PyObject_var result = PyObject_CallMethod(swig_get_self(), (char *) \"%s\", NULL);\n", pyname); } else { - Printf(w->code, "swig::PyObject_var swig_method_name = PyString_FromString((char *)\"%s\");\n", pyname); + Printf(w->code, "swig::PyObject_var swig_method_name = SWIG_Python_str_FromChar((char *)\"%s\");\n", pyname); Append(w->code, "swig::PyObject_var result = PyObject_CallMethodObjArgs(swig_get_self(), (PyObject *) swig_method_name, NULL);\n"); } } diff --git a/Source/Modules/r.cxx b/Source/Modules/r.cxx index 989136a9d..49d3ecc89 100644 --- a/Source/Modules/r.cxx +++ b/Source/Modules/r.cxx @@ -57,11 +57,13 @@ static String * getRTypeName(SwigType *t, int *outCount = NULL) { Insert(tmp, 0, retName); return tmp; + /* if(count) return(b); Delete(b); return(NewString("")); + */ } #if 0 @@ -104,7 +106,7 @@ static String * getRType(Node *n) { Now handles arrays, i.e. struct A[2] ****************/ -static String *getRClassName(String *retType, int addRef = 1, int upRef=0) { +static String *getRClassName(String *retType, int /*addRef*/ = 1, int upRef=0) { String *tmp = NewString(""); SwigType *resolved = SwigType_typedef_resolve_all(retType); char *retName = Char(SwigType_manglestr(resolved)); @@ -115,6 +117,7 @@ static String *getRClassName(String *retType, int addRef = 1, int upRef=0) { } return tmp; +/* #if 1 List *l = SwigType_split(retType); int n = Len(l); @@ -160,6 +163,7 @@ static String *getRClassName(String *retType, int addRef = 1, int upRef=0) { #endif return tmp; +*/ } /********************* @@ -1841,6 +1845,9 @@ int R::functionWrapper(Node *n) { String *name = Getattr(p,"name"); String *lname = Getattr(p,"lname"); + // R keyword renaming + if (name && Swig_name_warning(p, 0, name, 0)) + name = 0; /* If we have a :: in the parameter name because we are accessing a static member of a class, say, then we need to remove that prefix. */ @@ -2027,14 +2034,18 @@ int R::functionWrapper(Node *n) { Replaceall(tm,"$owner", "R_SWIG_EXTERNAL"); } - if(0 && addCopyParam) { +#if 0 + if(addCopyParam) { Printf(f->code, "if(LOGICAL(s_swig_copy)[0]) {\n"); Printf(f->code, "/* Deal with returning a reference. */\nr_ans = R_NilValue;\n"); Printf(f->code, "}\n else {\n"); } +#endif Printf(f->code, "%s\n", tm); - if(0 && addCopyParam) +#if 0 + if(addCopyParam) Printf(f->code, "}\n"); /* end of if(s_swig_copy) ... else { ... } */ +#endif } else { Swig_warning(WARN_TYPEMAP_OUT_UNDEF, input_file, line_number, diff --git a/Source/Modules/ruby.cxx b/Source/Modules/ruby.cxx index a57571bb8..ad448d34e 100644 --- a/Source/Modules/ruby.cxx +++ b/Source/Modules/ruby.cxx @@ -448,7 +448,7 @@ private: parent_name = Copy( Getattr(mod, "name") ); if ( parent_name ) { - (Char(parent_name))[0] = toupper((Char(parent_name))[0]); + (Char(parent_name))[0] = (char)toupper((Char(parent_name))[0]); } } if ( parent_name ) @@ -1194,7 +1194,7 @@ public: while (m.item) { if (Len(m.item) > 0) { String *cap = NewString(m.item); - (Char(cap))[0] = toupper((Char(cap))[0]); + (Char(cap))[0] = (char)toupper((Char(cap))[0]); if (last != 0) { Append(module, "::"); } @@ -1206,7 +1206,7 @@ public: if (feature == 0) { feature = Copy(last); } - (Char(last))[0] = toupper((Char(last))[0]); + (Char(last))[0] = (char)toupper((Char(last))[0]); modvar = NewStringf("m%s", last); Delete(modules); } @@ -2219,7 +2219,7 @@ public: return name; if (islower(name[0])) { - name[0] = toupper(name[0]); + name[0] = (char)toupper(name[0]); Swig_warning(WARN_RUBY_WRONG_NAME, input_file, line_number, "Wrong %s name (corrected to `%s')\n", reason, name); return name; } @@ -2545,7 +2545,7 @@ public: String *name = Copy(symname); char *cname = Char(name); if (cname) - cname[0] = toupper(cname[0]); + cname[0] = (char)toupper(cname[0]); Printv(director_prot_ctor_code, "if ( $comparison ) { /* subclassed */\n", " $director_new \n", diff --git a/Source/Modules/swigmain.cxx b/Source/Modules/swigmain.cxx index 3b60f2259..5b103e71e 100644 --- a/Source/Modules/swigmain.cxx +++ b/Source/Modules/swigmain.cxx @@ -74,8 +74,8 @@ static swig_module modules[] = { {"-octave", swig_octave, "Octave"}, {"-perl", swig_perl5, "Perl"}, {"-perl5", swig_perl5, 0}, - {"-php", swig_php4, 0}, - {"-php4", swig_php4, "PHP4"}, + {"-php", swig_php5, 0}, + {"-php4", swig_php4, 0}, {"-php5", swig_php5, "PHP5"}, {"-pike", swig_pike, "Pike"}, {"-python", swig_python, "Python"}, diff --git a/Source/Modules/uffi.cxx b/Source/Modules/uffi.cxx index 7a94b77bb..5d4affb8c 100644 --- a/Source/Modules/uffi.cxx +++ b/Source/Modules/uffi.cxx @@ -26,7 +26,6 @@ public: }; static File *f_cl = 0; -static File *f_null = 0; static struct { int count; @@ -225,15 +224,7 @@ void UFFI::main(int argc, char *argv[]) { int UFFI::top(Node *n) { String *module = Getattr(n, "name"); String *output_filename = NewString(""); - String *devnull = NewString("/dev/null"); - - f_null = NewFile(devnull, "w+"); - if (!f_null) { - FileErrorDisplay(devnull); - SWIG_exit(EXIT_FAILURE); - } - Delete(devnull); - + File *f_null = NewString(""); Printf(output_filename, "%s%s.cl", SWIG_output_directory(), module); diff --git a/Source/Preprocessor/cpp.c b/Source/Preprocessor/cpp.c index 560d12998..c04f95f00 100644 --- a/Source/Preprocessor/cpp.c +++ b/Source/Preprocessor/cpp.c @@ -36,6 +36,7 @@ static int error_as_warning = 0; /* Understand the cpp #error directive as a spe /* Test a character to see if it valid in an identifier (after the first letter) */ #define isidchar(c) ((isalnum(c)) || (c == '_') || (c == '$')) +DOH *Preprocessor_replace(DOH *); /* Skip whitespace */ static void skip_whitespace(String *s, String *out) { @@ -698,7 +699,6 @@ static String *get_options(String *str) { static String *expand_macro(String *name, List *args) { String *ns; DOH *symbols, *macro, *margs, *mvalue, *temp, *tempa, *e; - DOH *Preprocessor_replace(DOH *); int i, l; int isvarargs = 0; @@ -935,7 +935,6 @@ static String *expand_macro(String *name, List *args) { List *evaluate_args(List *x) { Iterator i; - String *Preprocessor_replace(String *); List *nl = NewList(); for (i = First(x); i.item; i = Next(i)) { @@ -1795,7 +1794,7 @@ String *Preprocessor_parse(String *s) { for (i = 0; i < 6;) { c = Getc(s); Putc(c, value); - statement[i++] = c; + statement[i++] = (char)c; if (strncmp(statement, ed, i) && strncmp(statement, df, i)) break; } diff --git a/Source/Swig/cwrap.c b/Source/Swig/cwrap.c index 2fc444290..18920ecc2 100644 --- a/Source/Swig/cwrap.c +++ b/Source/Swig/cwrap.c @@ -513,7 +513,8 @@ String *Swig_cppconstructor_base_call(String_or_char *name, ParmList *parms, int pname = Swig_cparm_name(p, i); i++; } else { - if ((pname = Getattr(p, "value"))) + pname = Getattr(p, "value"); + if (pname) pname = Copy(pname); else pname = Copy(Getattr(p, "name")); diff --git a/Source/Swig/include.c b/Source/Swig/include.c index 25ea0683f..3f47be15b 100644 --- a/Source/Swig/include.c +++ b/Source/Swig/include.c @@ -352,7 +352,8 @@ char *Swig_file_filename(const String_or_char *filename) { char *c; strcpy(tmp, Char(filename)); - if ((c = strrchr(tmp, *delim))) + c = strrchr(tmp, *delim); + if (c) return c + 1; else return tmp; diff --git a/Source/Swig/misc.c b/Source/Swig/misc.c index 04691b595..d29250517 100644 --- a/Source/Swig/misc.c +++ b/Source/Swig/misc.c @@ -614,7 +614,8 @@ void Swig_scopename_split(String *s, String **rprefix, String **rlast) { *rlast = Copy(s); } - if ((co = strstr(cc, "operator "))) { + co = strstr(cc, "operator "); + if (co) { if (co == cc) { *rprefix = 0; *rlast = Copy(s); @@ -664,7 +665,9 @@ String *Swig_scopename_prefix(String *s) { char *co = 0; if (!strstr(c, "::")) return 0; - if ((co = strstr(cc, "operator "))) { + co = strstr(cc, "operator "); + + if (co) { if (co == cc) { return 0; } else { @@ -715,7 +718,8 @@ String *Swig_scopename_last(String *s) { if (!strstr(c, "::")) return NewString(s); - if ((co = strstr(cc, "operator "))) { + co = strstr(cc, "operator "); + if (co) { return NewString(co); } @@ -756,7 +760,9 @@ String *Swig_scopename_first(String *s) { char *co = 0; if (!strstr(c, "::")) return 0; - if ((co = strstr(c, "operator "))) { + + co = strstr(c, "operator "); + if (co) { if (co == c) { return 0; } @@ -804,7 +810,9 @@ String *Swig_scopename_suffix(String *s) { char *co = 0; if (!strstr(c, "::")) return 0; - if ((co = strstr(c, "operator "))) { + + co = strstr(c, "operator "); + if (co) { if (co == c) return 0; } @@ -842,8 +850,9 @@ String *Swig_scopename_suffix(String *s) { int Swig_scopename_check(String *s) { char *c = Char(s); - char *co = 0; - if ((co = strstr(c, "operator "))) { + char *co = strstr(c, "operator "); + + if (co) { if (co == c) return 0; } diff --git a/Source/Swig/naming.c b/Source/Swig/naming.c index 519e5b59e..f34a24612 100644 --- a/Source/Swig/naming.c +++ b/Source/Swig/naming.c @@ -482,7 +482,8 @@ DOH *Swig_name_object_get(Hash *namehash, String *prefix, String *name, SwigType Delete(t_name); } /* A template-based class lookup */ - if (0 && !rn && SwigType_istemplate(prefix)) { + /* + if (!rn && SwigType_istemplate(prefix)) { String *t_prefix = SwigType_templateprefix(prefix); if (Strcmp(t_prefix, prefix) != 0) { String *t_name = SwigType_templateprefix(name); @@ -491,6 +492,7 @@ DOH *Swig_name_object_get(Hash *namehash, String *prefix, String *name, SwigType } Delete(t_prefix); } + */ } /* A wildcard-based class lookup */ if (!rn) { @@ -1477,7 +1479,7 @@ String *Swig_name_make(Node *n, String *prefix, String_or_char *cname, SwigType } - if (rename_hash || rename_list) { + if (rename_hash || rename_list || namewarn_hash || namewarn_list) { Hash *rn = Swig_name_object_get(Swig_name_rename_hash(), prefix, name, decl); if (!rn || !Swig_name_match_nameobj(rn, n)) { rn = Swig_name_nameobj_lget(Swig_name_rename_list(), n, prefix, name, decl); diff --git a/Source/Swig/scanner.c b/Source/Swig/scanner.c index e8b1b5f46..06e78db37 100644 --- a/Source/Swig/scanner.c +++ b/Source/Swig/scanner.c @@ -200,7 +200,7 @@ static char nextchar(Scanner * s) { if ((nc == '\n') && (!s->freeze_line)) s->line++; Putc(nc,s->text); - return nc; + return (char)nc; } /* ----------------------------------------------------------------------------- @@ -349,7 +349,7 @@ static void get_escape(Scanner *s) { } else { char tmp[3]; tmp[0] = '\\'; - tmp[1] = c; + tmp[1] = (char)c; tmp[2] = 0; Delitem(s->text, DOH_END); Append(s->text, tmp); diff --git a/Source/Swig/typeobj.c b/Source/Swig/typeobj.c index f234839fe..18d1b2304 100644 --- a/Source/Swig/typeobj.c +++ b/Source/Swig/typeobj.c @@ -937,7 +937,8 @@ String *SwigType_templateargs(const SwigType *t) { int SwigType_istemplate(const SwigType *t) { char *ct = Char(t); - if ((ct = strstr(ct, "<(")) && (strstr(ct + 2, ")>"))) + ct = strstr(ct, "<("); + if (ct && (strstr(ct + 2, ")>"))) return 1; return 0; } diff --git a/Source/Swig/typesys.c b/Source/Swig/typesys.c index fdf37ece1..a9e2898bd 100644 --- a/Source/Swig/typesys.c +++ b/Source/Swig/typesys.c @@ -108,6 +108,8 @@ static Hash *typedef_resolve_cache = 0; static Hash *typedef_all_cache = 0; static Hash *typedef_qualified_cache = 0; +static Typetab *SwigType_find_scope(Typetab *s, String *nameprefix); + /* common attribute keys, to avoid calling find_key all the times */ /* @@ -162,7 +164,6 @@ void SwigType_typesystem_init() { * ----------------------------------------------------------------------------- */ int SwigType_typedef(SwigType *type, String_or_char *name) { - Typetab *SwigType_find_scope(Typetab *, String *s); if (Getattr(current_typetab, name)) return -1; /* Already defined */ if (Strcmp(type, name) == 0) { /* Can't typedef a name to itself */ @@ -409,7 +410,7 @@ void SwigType_print_scope(Typetab *t) { } } -Typetab *SwigType_find_scope(Typetab *s, String *nameprefix) { +static Typetab *SwigType_find_scope(Typetab *s, String *nameprefix) { Typetab *ss; String *nnameprefix = 0; static int check_parent = 1; @@ -846,7 +847,7 @@ SwigType *SwigType_typedef_qualified(SwigType *t) { String *result; int i, len; - if (t && strncmp(Char(t), "::", 2) == 0) { + if (strncmp(Char(t), "::", 2) == 0) { return Copy(t); } @@ -1311,7 +1312,8 @@ SwigType *SwigType_alttype(SwigType *t, int local_tmap) { SwigType *ftd = SwigType_typedef_resolve_all(t); td = SwigType_strip_qualifiers(ftd); Delete(ftd); - if ((n = Swig_symbol_clookup(td, 0))) { + n = Swig_symbol_clookup(td, 0); + if (n) { if (GetFlag(n, "feature:valuewrapper")) { use_wrapper = 1; } else { @@ -1334,7 +1336,8 @@ SwigType *SwigType_alttype(SwigType *t, int local_tmap) { Delete(ftd); if (SwigType_type(td) == T_USER) { use_wrapper = 1; - if ((n = Swig_symbol_clookup(td, 0))) { + n = Swig_symbol_clookup(td, 0); + if (n) { if ((Checkattr(n, "nodeType", "class") && !Getattr(n, "allocate:noassign") && (Getattr(n, "allocate:default_constructor"))) @@ -1795,13 +1798,15 @@ void SwigType_inherit_equiv(File *out) { String *lprefix = SwigType_lstr(prefix, 0); Hash *subhash = Getattr(sub, bk.key); String *convcode = Getattr(subhash, "convcode"); - Printf(out, "static void *%s(void *x, int *newmemory) {", convname); if (convcode) { + char *newmemoryused = Strstr(convcode, "newmemory"); /* see if newmemory parameter is used in order to avoid unused parameter warnings */ String *fn = Copy(convcode); Replaceall(fn, "$from", "x"); + Printf(out, "static void *%s(void *x, int *%s) {", convname, newmemoryused ? "newmemory" : "SWIGUNUSEDPARM(newmemory)"); Printf(out, "%s", fn); } else { String *cast = Getattr(subhash, "cast"); + Printf(out, "static void *%s(void *x, int *SWIGUNUSEDPARM(newmemory)) {", convname); Printf(out, "\n return (void *)((%s) ", lkey); if (cast) Printf(out, "%s", cast); diff --git a/TODO b/TODO index d764d1d20..103185d23 100644 --- a/TODO +++ b/TODO @@ -1,6 +1,6 @@ SWIG TO-DO -Release: SWIG-1.3.35 +Release: SWIG-1.3.36 ----------------------------------------------------------------------------- diff --git a/Tools/WAD/Python/type.c b/Tools/WAD/Python/type.c index 5236c1c64..7d8248e0b 100644 --- a/Tools/WAD/Python/type.c +++ b/Tools/WAD/Python/type.c @@ -62,7 +62,7 @@ new_wadobject(WadFrame *f, int count) { /* release a wad object */ static void wadobject_dealloc(wadobject *self) { - PyMem_DEL(self); + PyObject_Del(self); } static char message[65536]; diff --git a/Tools/config/config.guess b/Tools/config/config.guess deleted file mode 100755 index 278f9e9e0..000000000 --- a/Tools/config/config.guess +++ /dev/null @@ -1,1516 +0,0 @@ -#! /bin/sh -# Attempt to guess a canonical system name. -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, -# Inc. - -timestamp='2007-07-22' - -# This file is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA -# 02110-1301, USA. -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - - -# Originally written by Per Bothner . -# Please send patches to . Submit a context -# diff and a properly formatted ChangeLog entry. -# -# This script attempts to guess a canonical system name similar to -# config.sub. If it succeeds, it prints the system name on stdout, and -# exits with 0. Otherwise, it exits with 1. -# -# The plan is that this can be called by configure scripts if you -# don't specify an explicit build system type. - -me=`echo "$0" | sed -e 's,.*/,,'` - -usage="\ -Usage: $0 [OPTION] - -Output the configuration name of the system \`$me' is run on. - -Operation modes: - -h, --help print this help, then exit - -t, --time-stamp print date of last modification, then exit - -v, --version print version number, then exit - -Report bugs and patches to ." - -version="\ -GNU config.guess ($timestamp) - -Originally written by Per Bothner. -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 -Free Software Foundation, Inc. - -This is free software; see the source for copying conditions. There is NO -warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." - -help=" -Try \`$me --help' for more information." - -# Parse command line -while test $# -gt 0 ; do - case $1 in - --time-stamp | --time* | -t ) - echo "$timestamp" ; exit ;; - --version | -v ) - echo "$version" ; exit ;; - --help | --h* | -h ) - echo "$usage"; exit ;; - -- ) # Stop option processing - shift; break ;; - - ) # Use stdin as input. - break ;; - -* ) - echo "$me: invalid option $1$help" >&2 - exit 1 ;; - * ) - break ;; - esac -done - -if test $# != 0; then - echo "$me: too many arguments$help" >&2 - exit 1 -fi - -trap 'exit 1' 1 2 15 - -# CC_FOR_BUILD -- compiler used by this script. Note that the use of a -# compiler to aid in system detection is discouraged as it requires -# temporary files to be created and, as you can see below, it is a -# headache to deal with in a portable fashion. - -# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still -# use `HOST_CC' if defined, but it is deprecated. - -# Portable tmp directory creation inspired by the Autoconf team. - -set_cc_for_build=' -trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; -trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; -: ${TMPDIR=/tmp} ; - { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || - { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || - { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || - { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; -dummy=$tmp/dummy ; -tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; -case $CC_FOR_BUILD,$HOST_CC,$CC in - ,,) echo "int x;" > $dummy.c ; - for c in cc gcc c89 c99 ; do - if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then - CC_FOR_BUILD="$c"; break ; - fi ; - done ; - if test x"$CC_FOR_BUILD" = x ; then - CC_FOR_BUILD=no_compiler_found ; - fi - ;; - ,,*) CC_FOR_BUILD=$CC ;; - ,*,*) CC_FOR_BUILD=$HOST_CC ;; -esac ; set_cc_for_build= ;' - -# This is needed to find uname on a Pyramid OSx when run in the BSD universe. -# (ghazi@noc.rutgers.edu 1994-08-24) -if (test -f /.attbin/uname) >/dev/null 2>&1 ; then - PATH=$PATH:/.attbin ; export PATH -fi - -UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown -UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown -UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown -UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown - -# Note: order is significant - the case branches are not exclusive. - -case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in - *:NetBSD:*:*) - # NetBSD (nbsd) targets should (where applicable) match one or - # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, - # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently - # switched to ELF, *-*-netbsd* would select the old - # object file format. This provides both forward - # compatibility and a consistent mechanism for selecting the - # object file format. - # - # Note: NetBSD doesn't particularly care about the vendor - # portion of the name. We always set it to "unknown". - sysctl="sysctl -n hw.machine_arch" - UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ - /usr/sbin/$sysctl 2>/dev/null || echo unknown)` - case "${UNAME_MACHINE_ARCH}" in - armeb) machine=armeb-unknown ;; - arm*) machine=arm-unknown ;; - sh3el) machine=shl-unknown ;; - sh3eb) machine=sh-unknown ;; - sh5el) machine=sh5le-unknown ;; - *) machine=${UNAME_MACHINE_ARCH}-unknown ;; - esac - # The Operating System including object format, if it has switched - # to ELF recently, or will in the future. - case "${UNAME_MACHINE_ARCH}" in - arm*|i386|m68k|ns32k|sh3*|sparc|vax) - eval $set_cc_for_build - if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ - | grep __ELF__ >/dev/null - then - # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). - # Return netbsd for either. FIX? - os=netbsd - else - os=netbsdelf - fi - ;; - *) - os=netbsd - ;; - esac - # The OS release - # Debian GNU/NetBSD machines have a different userland, and - # thus, need a distinct triplet. However, they do not need - # kernel version information, so it can be replaced with a - # suitable tag, in the style of linux-gnu. - case "${UNAME_VERSION}" in - Debian*) - release='-gnu' - ;; - *) - release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` - ;; - esac - # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: - # contains redundant information, the shorter form: - # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. - echo "${machine}-${os}${release}" - exit ;; - *:OpenBSD:*:*) - UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` - echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} - exit ;; - *:ekkoBSD:*:*) - echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} - exit ;; - *:SolidBSD:*:*) - echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} - exit ;; - macppc:MirBSD:*:*) - echo powerpc-unknown-mirbsd${UNAME_RELEASE} - exit ;; - *:MirBSD:*:*) - echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} - exit ;; - alpha:OSF1:*:*) - case $UNAME_RELEASE in - *4.0) - UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` - ;; - *5.*) - UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` - ;; - esac - # According to Compaq, /usr/sbin/psrinfo has been available on - # OSF/1 and Tru64 systems produced since 1995. I hope that - # covers most systems running today. This code pipes the CPU - # types through head -n 1, so we only detect the type of CPU 0. - ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` - case "$ALPHA_CPU_TYPE" in - "EV4 (21064)") - UNAME_MACHINE="alpha" ;; - "EV4.5 (21064)") - UNAME_MACHINE="alpha" ;; - "LCA4 (21066/21068)") - UNAME_MACHINE="alpha" ;; - "EV5 (21164)") - UNAME_MACHINE="alphaev5" ;; - "EV5.6 (21164A)") - UNAME_MACHINE="alphaev56" ;; - "EV5.6 (21164PC)") - UNAME_MACHINE="alphapca56" ;; - "EV5.7 (21164PC)") - UNAME_MACHINE="alphapca57" ;; - "EV6 (21264)") - UNAME_MACHINE="alphaev6" ;; - "EV6.7 (21264A)") - UNAME_MACHINE="alphaev67" ;; - "EV6.8CB (21264C)") - UNAME_MACHINE="alphaev68" ;; - "EV6.8AL (21264B)") - UNAME_MACHINE="alphaev68" ;; - "EV6.8CX (21264D)") - UNAME_MACHINE="alphaev68" ;; - "EV6.9A (21264/EV69A)") - UNAME_MACHINE="alphaev69" ;; - "EV7 (21364)") - UNAME_MACHINE="alphaev7" ;; - "EV7.9 (21364A)") - UNAME_MACHINE="alphaev79" ;; - esac - # A Pn.n version is a patched version. - # A Vn.n version is a released version. - # A Tn.n version is a released field test version. - # A Xn.n version is an unreleased experimental baselevel. - # 1.2 uses "1.2" for uname -r. - echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - exit ;; - Alpha\ *:Windows_NT*:*) - # How do we know it's Interix rather than the generic POSIX subsystem? - # Should we change UNAME_MACHINE based on the output of uname instead - # of the specific Alpha model? - echo alpha-pc-interix - exit ;; - 21064:Windows_NT:50:3) - echo alpha-dec-winnt3.5 - exit ;; - Amiga*:UNIX_System_V:4.0:*) - echo m68k-unknown-sysv4 - exit ;; - *:[Aa]miga[Oo][Ss]:*:*) - echo ${UNAME_MACHINE}-unknown-amigaos - exit ;; - *:[Mm]orph[Oo][Ss]:*:*) - echo ${UNAME_MACHINE}-unknown-morphos - exit ;; - *:OS/390:*:*) - echo i370-ibm-openedition - exit ;; - *:z/VM:*:*) - echo s390-ibm-zvmoe - exit ;; - *:OS400:*:*) - echo powerpc-ibm-os400 - exit ;; - arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) - echo arm-acorn-riscix${UNAME_RELEASE} - exit ;; - arm:riscos:*:*|arm:RISCOS:*:*) - echo arm-unknown-riscos - exit ;; - SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) - echo hppa1.1-hitachi-hiuxmpp - exit ;; - Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) - # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. - if test "`(/bin/universe) 2>/dev/null`" = att ; then - echo pyramid-pyramid-sysv3 - else - echo pyramid-pyramid-bsd - fi - exit ;; - NILE*:*:*:dcosx) - echo pyramid-pyramid-svr4 - exit ;; - DRS?6000:unix:4.0:6*) - echo sparc-icl-nx6 - exit ;; - DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) - case `/usr/bin/uname -p` in - sparc) echo sparc-icl-nx7; exit ;; - esac ;; - sun4H:SunOS:5.*:*) - echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) - echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) - echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - sun4*:SunOS:6*:*) - # According to config.sub, this is the proper way to canonicalize - # SunOS6. Hard to guess exactly what SunOS6 will be like, but - # it's likely to be more like Solaris than SunOS4. - echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - sun4*:SunOS:*:*) - case "`/usr/bin/arch -k`" in - Series*|S4*) - UNAME_RELEASE=`uname -v` - ;; - esac - # Japanese Language versions have a version number like `4.1.3-JL'. - echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` - exit ;; - sun3*:SunOS:*:*) - echo m68k-sun-sunos${UNAME_RELEASE} - exit ;; - sun*:*:4.2BSD:*) - UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` - test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 - case "`/bin/arch`" in - sun3) - echo m68k-sun-sunos${UNAME_RELEASE} - ;; - sun4) - echo sparc-sun-sunos${UNAME_RELEASE} - ;; - esac - exit ;; - aushp:SunOS:*:*) - echo sparc-auspex-sunos${UNAME_RELEASE} - exit ;; - # The situation for MiNT is a little confusing. The machine name - # can be virtually everything (everything which is not - # "atarist" or "atariste" at least should have a processor - # > m68000). The system name ranges from "MiNT" over "FreeMiNT" - # to the lowercase version "mint" (or "freemint"). Finally - # the system name "TOS" denotes a system which is actually not - # MiNT. But MiNT is downward compatible to TOS, so this should - # be no problem. - atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit ;; - atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit ;; - *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit ;; - milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) - echo m68k-milan-mint${UNAME_RELEASE} - exit ;; - hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) - echo m68k-hades-mint${UNAME_RELEASE} - exit ;; - *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) - echo m68k-unknown-mint${UNAME_RELEASE} - exit ;; - m68k:machten:*:*) - echo m68k-apple-machten${UNAME_RELEASE} - exit ;; - powerpc:machten:*:*) - echo powerpc-apple-machten${UNAME_RELEASE} - exit ;; - RISC*:Mach:*:*) - echo mips-dec-mach_bsd4.3 - exit ;; - RISC*:ULTRIX:*:*) - echo mips-dec-ultrix${UNAME_RELEASE} - exit ;; - VAX*:ULTRIX*:*:*) - echo vax-dec-ultrix${UNAME_RELEASE} - exit ;; - 2020:CLIX:*:* | 2430:CLIX:*:*) - echo clipper-intergraph-clix${UNAME_RELEASE} - exit ;; - mips:*:*:UMIPS | mips:*:*:RISCos) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c -#ifdef __cplusplus -#include /* for printf() prototype */ - int main (int argc, char *argv[]) { -#else - int main (argc, argv) int argc; char *argv[]; { -#endif - #if defined (host_mips) && defined (MIPSEB) - #if defined (SYSTYPE_SYSV) - printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); - #endif - #if defined (SYSTYPE_SVR4) - printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); - #endif - #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) - printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); - #endif - #endif - exit (-1); - } -EOF - $CC_FOR_BUILD -o $dummy $dummy.c && - dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && - SYSTEM_NAME=`$dummy $dummyarg` && - { echo "$SYSTEM_NAME"; exit; } - echo mips-mips-riscos${UNAME_RELEASE} - exit ;; - Motorola:PowerMAX_OS:*:*) - echo powerpc-motorola-powermax - exit ;; - Motorola:*:4.3:PL8-*) - echo powerpc-harris-powermax - exit ;; - Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) - echo powerpc-harris-powermax - exit ;; - Night_Hawk:Power_UNIX:*:*) - echo powerpc-harris-powerunix - exit ;; - m88k:CX/UX:7*:*) - echo m88k-harris-cxux7 - exit ;; - m88k:*:4*:R4*) - echo m88k-motorola-sysv4 - exit ;; - m88k:*:3*:R3*) - echo m88k-motorola-sysv3 - exit ;; - AViiON:dgux:*:*) - # DG/UX returns AViiON for all architectures - UNAME_PROCESSOR=`/usr/bin/uname -p` - if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] - then - if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ - [ ${TARGET_BINARY_INTERFACE}x = x ] - then - echo m88k-dg-dgux${UNAME_RELEASE} - else - echo m88k-dg-dguxbcs${UNAME_RELEASE} - fi - else - echo i586-dg-dgux${UNAME_RELEASE} - fi - exit ;; - M88*:DolphinOS:*:*) # DolphinOS (SVR3) - echo m88k-dolphin-sysv3 - exit ;; - M88*:*:R3*:*) - # Delta 88k system running SVR3 - echo m88k-motorola-sysv3 - exit ;; - XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) - echo m88k-tektronix-sysv3 - exit ;; - Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) - echo m68k-tektronix-bsd - exit ;; - *:IRIX*:*:*) - echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` - exit ;; - ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. - echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id - exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' - i*86:AIX:*:*) - echo i386-ibm-aix - exit ;; - ia64:AIX:*:*) - if [ -x /usr/bin/oslevel ] ; then - IBM_REV=`/usr/bin/oslevel` - else - IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} - fi - echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} - exit ;; - *:AIX:2:3) - if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include - - main() - { - if (!__power_pc()) - exit(1); - puts("powerpc-ibm-aix3.2.5"); - exit(0); - } -EOF - if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` - then - echo "$SYSTEM_NAME" - else - echo rs6000-ibm-aix3.2.5 - fi - elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then - echo rs6000-ibm-aix3.2.4 - else - echo rs6000-ibm-aix3.2 - fi - exit ;; - *:AIX:*:[45]) - IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` - if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then - IBM_ARCH=rs6000 - else - IBM_ARCH=powerpc - fi - if [ -x /usr/bin/oslevel ] ; then - IBM_REV=`/usr/bin/oslevel` - else - IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} - fi - echo ${IBM_ARCH}-ibm-aix${IBM_REV} - exit ;; - *:AIX:*:*) - echo rs6000-ibm-aix - exit ;; - ibmrt:4.4BSD:*|romp-ibm:BSD:*) - echo romp-ibm-bsd4.4 - exit ;; - ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and - echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to - exit ;; # report: romp-ibm BSD 4.3 - *:BOSX:*:*) - echo rs6000-bull-bosx - exit ;; - DPX/2?00:B.O.S.:*:*) - echo m68k-bull-sysv3 - exit ;; - 9000/[34]??:4.3bsd:1.*:*) - echo m68k-hp-bsd - exit ;; - hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) - echo m68k-hp-bsd4.4 - exit ;; - 9000/[34678]??:HP-UX:*:*) - HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` - case "${UNAME_MACHINE}" in - 9000/31? ) HP_ARCH=m68000 ;; - 9000/[34]?? ) HP_ARCH=m68k ;; - 9000/[678][0-9][0-9]) - if [ -x /usr/bin/getconf ]; then - sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` - sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` - case "${sc_cpu_version}" in - 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 - 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 - 532) # CPU_PA_RISC2_0 - case "${sc_kernel_bits}" in - 32) HP_ARCH="hppa2.0n" ;; - 64) HP_ARCH="hppa2.0w" ;; - '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 - esac ;; - esac - fi - if [ "${HP_ARCH}" = "" ]; then - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - - #define _HPUX_SOURCE - #include - #include - - int main () - { - #if defined(_SC_KERNEL_BITS) - long bits = sysconf(_SC_KERNEL_BITS); - #endif - long cpu = sysconf (_SC_CPU_VERSION); - - switch (cpu) - { - case CPU_PA_RISC1_0: puts ("hppa1.0"); break; - case CPU_PA_RISC1_1: puts ("hppa1.1"); break; - case CPU_PA_RISC2_0: - #if defined(_SC_KERNEL_BITS) - switch (bits) - { - case 64: puts ("hppa2.0w"); break; - case 32: puts ("hppa2.0n"); break; - default: puts ("hppa2.0"); break; - } break; - #else /* !defined(_SC_KERNEL_BITS) */ - puts ("hppa2.0"); break; - #endif - default: puts ("hppa1.0"); break; - } - exit (0); - } -EOF - (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` - test -z "$HP_ARCH" && HP_ARCH=hppa - fi ;; - esac - if [ ${HP_ARCH} = "hppa2.0w" ] - then - eval $set_cc_for_build - - # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating - # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler - # generating 64-bit code. GNU and HP use different nomenclature: - # - # $ CC_FOR_BUILD=cc ./config.guess - # => hppa2.0w-hp-hpux11.23 - # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess - # => hppa64-hp-hpux11.23 - - if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | - grep __LP64__ >/dev/null - then - HP_ARCH="hppa2.0w" - else - HP_ARCH="hppa64" - fi - fi - echo ${HP_ARCH}-hp-hpux${HPUX_REV} - exit ;; - ia64:HP-UX:*:*) - HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` - echo ia64-hp-hpux${HPUX_REV} - exit ;; - 3050*:HI-UX:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include - int - main () - { - long cpu = sysconf (_SC_CPU_VERSION); - /* The order matters, because CPU_IS_HP_MC68K erroneously returns - true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct - results, however. */ - if (CPU_IS_PA_RISC (cpu)) - { - switch (cpu) - { - case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; - case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; - case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; - default: puts ("hppa-hitachi-hiuxwe2"); break; - } - } - else if (CPU_IS_HP_MC68K (cpu)) - puts ("m68k-hitachi-hiuxwe2"); - else puts ("unknown-hitachi-hiuxwe2"); - exit (0); - } -EOF - $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && - { echo "$SYSTEM_NAME"; exit; } - echo unknown-hitachi-hiuxwe2 - exit ;; - 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) - echo hppa1.1-hp-bsd - exit ;; - 9000/8??:4.3bsd:*:*) - echo hppa1.0-hp-bsd - exit ;; - *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) - echo hppa1.0-hp-mpeix - exit ;; - hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) - echo hppa1.1-hp-osf - exit ;; - hp8??:OSF1:*:*) - echo hppa1.0-hp-osf - exit ;; - i*86:OSF1:*:*) - if [ -x /usr/sbin/sysversion ] ; then - echo ${UNAME_MACHINE}-unknown-osf1mk - else - echo ${UNAME_MACHINE}-unknown-osf1 - fi - exit ;; - parisc*:Lites*:*:*) - echo hppa1.1-hp-lites - exit ;; - C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) - echo c1-convex-bsd - exit ;; - C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) - if getsysinfo -f scalar_acc - then echo c32-convex-bsd - else echo c2-convex-bsd - fi - exit ;; - C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) - echo c34-convex-bsd - exit ;; - C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) - echo c38-convex-bsd - exit ;; - C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) - echo c4-convex-bsd - exit ;; - CRAY*Y-MP:*:*:*) - echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - CRAY*[A-Z]90:*:*:*) - echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ - | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ - -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ - -e 's/\.[^.]*$/.X/' - exit ;; - CRAY*TS:*:*:*) - echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - CRAY*T3E:*:*:*) - echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - CRAY*SV1:*:*:*) - echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - *:UNICOS/mp:*:*) - echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) - FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` - echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" - exit ;; - 5000:UNIX_System_V:4.*:*) - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` - echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" - exit ;; - i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) - echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} - exit ;; - sparc*:BSD/OS:*:*) - echo sparc-unknown-bsdi${UNAME_RELEASE} - exit ;; - *:BSD/OS:*:*) - echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} - exit ;; - *:FreeBSD:*:*) - case ${UNAME_MACHINE} in - pc98) - echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; - amd64) - echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; - *) - echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; - esac - exit ;; - i*:CYGWIN*:*) - echo ${UNAME_MACHINE}-pc-cygwin - exit ;; - *:MINGW*:*) - echo ${UNAME_MACHINE}-pc-mingw32 - exit ;; - i*:windows32*:*) - # uname -m includes "-pc" on this system. - echo ${UNAME_MACHINE}-mingw32 - exit ;; - i*:PW*:*) - echo ${UNAME_MACHINE}-pc-pw32 - exit ;; - *:Interix*:[3456]*) - case ${UNAME_MACHINE} in - x86) - echo i586-pc-interix${UNAME_RELEASE} - exit ;; - EM64T | authenticamd) - echo x86_64-unknown-interix${UNAME_RELEASE} - exit ;; - esac ;; - [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) - echo i${UNAME_MACHINE}-pc-mks - exit ;; - i*:Windows_NT*:* | Pentium*:Windows_NT*:*) - # How do we know it's Interix rather than the generic POSIX subsystem? - # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we - # UNAME_MACHINE based on the output of uname instead of i386? - echo i586-pc-interix - exit ;; - i*:UWIN*:*) - echo ${UNAME_MACHINE}-pc-uwin - exit ;; - amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) - echo x86_64-unknown-cygwin - exit ;; - p*:CYGWIN*:*) - echo powerpcle-unknown-cygwin - exit ;; - prep*:SunOS:5.*:*) - echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - *:GNU:*:*) - # the GNU system - echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` - exit ;; - *:GNU/*:*:*) - # other systems with GNU libc and userland - echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu - exit ;; - i*86:Minix:*:*) - echo ${UNAME_MACHINE}-pc-minix - exit ;; - arm*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - avr32*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - cris:Linux:*:*) - echo cris-axis-linux-gnu - exit ;; - crisv32:Linux:*:*) - echo crisv32-axis-linux-gnu - exit ;; - frv:Linux:*:*) - echo frv-unknown-linux-gnu - exit ;; - ia64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - m32r*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - m68*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - mips:Linux:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #undef CPU - #undef mips - #undef mipsel - #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) - CPU=mipsel - #else - #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) - CPU=mips - #else - CPU= - #endif - #endif -EOF - eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' - /^CPU/{ - s: ::g - p - }'`" - test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } - ;; - mips64:Linux:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #undef CPU - #undef mips64 - #undef mips64el - #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) - CPU=mips64el - #else - #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) - CPU=mips64 - #else - CPU= - #endif - #endif -EOF - eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' - /^CPU/{ - s: ::g - p - }'`" - test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } - ;; - or32:Linux:*:*) - echo or32-unknown-linux-gnu - exit ;; - ppc:Linux:*:*) - echo powerpc-unknown-linux-gnu - exit ;; - ppc64:Linux:*:*) - echo powerpc64-unknown-linux-gnu - exit ;; - alpha:Linux:*:*) - case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in - EV5) UNAME_MACHINE=alphaev5 ;; - EV56) UNAME_MACHINE=alphaev56 ;; - PCA56) UNAME_MACHINE=alphapca56 ;; - PCA57) UNAME_MACHINE=alphapca56 ;; - EV6) UNAME_MACHINE=alphaev6 ;; - EV67) UNAME_MACHINE=alphaev67 ;; - EV68*) UNAME_MACHINE=alphaev68 ;; - esac - objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null - if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi - echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} - exit ;; - parisc:Linux:*:* | hppa:Linux:*:*) - # Look for CPU level - case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in - PA7*) echo hppa1.1-unknown-linux-gnu ;; - PA8*) echo hppa2.0-unknown-linux-gnu ;; - *) echo hppa-unknown-linux-gnu ;; - esac - exit ;; - parisc64:Linux:*:* | hppa64:Linux:*:*) - echo hppa64-unknown-linux-gnu - exit ;; - s390:Linux:*:* | s390x:Linux:*:*) - echo ${UNAME_MACHINE}-ibm-linux - exit ;; - sh64*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - sh*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - sparc:Linux:*:* | sparc64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - vax:Linux:*:*) - echo ${UNAME_MACHINE}-dec-linux-gnu - exit ;; - x86_64:Linux:*:*) - echo x86_64-unknown-linux-gnu - exit ;; - xtensa:Linux:*:*) - echo xtensa-unknown-linux-gnu - exit ;; - i*86:Linux:*:*) - # The BFD linker knows what the default object file format is, so - # first see if it will tell us. cd to the root directory to prevent - # problems with other programs or directories called `ld' in the path. - # Set LC_ALL=C to ensure ld outputs messages in English. - ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ - | sed -ne '/supported targets:/!d - s/[ ][ ]*/ /g - s/.*supported targets: *// - s/ .*// - p'` - case "$ld_supported_targets" in - elf32-i386) - TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" - ;; - a.out-i386-linux) - echo "${UNAME_MACHINE}-pc-linux-gnuaout" - exit ;; - coff-i386) - echo "${UNAME_MACHINE}-pc-linux-gnucoff" - exit ;; - "") - # Either a pre-BFD a.out linker (linux-gnuoldld) or - # one that does not give us useful --help. - echo "${UNAME_MACHINE}-pc-linux-gnuoldld" - exit ;; - esac - # Determine whether the default compiler is a.out or elf - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include - #ifdef __ELF__ - # ifdef __GLIBC__ - # if __GLIBC__ >= 2 - LIBC=gnu - # else - LIBC=gnulibc1 - # endif - # else - LIBC=gnulibc1 - # endif - #else - #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC) - LIBC=gnu - #else - LIBC=gnuaout - #endif - #endif - #ifdef __dietlibc__ - LIBC=dietlibc - #endif -EOF - eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' - /^LIBC/{ - s: ::g - p - }'`" - test x"${LIBC}" != x && { - echo "${UNAME_MACHINE}-pc-linux-${LIBC}" - exit - } - test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; } - ;; - i*86:DYNIX/ptx:4*:*) - # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. - # earlier versions are messed up and put the nodename in both - # sysname and nodename. - echo i386-sequent-sysv4 - exit ;; - i*86:UNIX_SV:4.2MP:2.*) - # Unixware is an offshoot of SVR4, but it has its own version - # number series starting with 2... - # I am not positive that other SVR4 systems won't match this, - # I just have to hope. -- rms. - # Use sysv4.2uw... so that sysv4* matches it. - echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} - exit ;; - i*86:OS/2:*:*) - # If we were able to find `uname', then EMX Unix compatibility - # is probably installed. - echo ${UNAME_MACHINE}-pc-os2-emx - exit ;; - i*86:XTS-300:*:STOP) - echo ${UNAME_MACHINE}-unknown-stop - exit ;; - i*86:atheos:*:*) - echo ${UNAME_MACHINE}-unknown-atheos - exit ;; - i*86:syllable:*:*) - echo ${UNAME_MACHINE}-pc-syllable - exit ;; - i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) - echo i386-unknown-lynxos${UNAME_RELEASE} - exit ;; - i*86:*DOS:*:*) - echo ${UNAME_MACHINE}-pc-msdosdjgpp - exit ;; - i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) - UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` - if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then - echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} - else - echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} - fi - exit ;; - i*86:*:5:[678]*) - # UnixWare 7.x, OpenUNIX and OpenServer 6. - case `/bin/uname -X | grep "^Machine"` in - *486*) UNAME_MACHINE=i486 ;; - *Pentium) UNAME_MACHINE=i586 ;; - *Pent*|*Celeron) UNAME_MACHINE=i686 ;; - esac - echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} - exit ;; - i*86:*:3.2:*) - if test -f /usr/options/cb.name; then - UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then - UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` - (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 - (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ - && UNAME_MACHINE=i586 - (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ - && UNAME_MACHINE=i686 - (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ - && UNAME_MACHINE=i686 - echo ${UNAME_MACHINE}-pc-sco$UNAME_REL - else - echo ${UNAME_MACHINE}-pc-sysv32 - fi - exit ;; - pc:*:*:*) - # Left here for compatibility: - # uname -m prints for DJGPP always 'pc', but it prints nothing about - # the processor, so we play safe by assuming i386. - echo i386-pc-msdosdjgpp - exit ;; - Intel:Mach:3*:*) - echo i386-pc-mach3 - exit ;; - paragon:*:*:*) - echo i860-intel-osf1 - exit ;; - i860:*:4.*:*) # i860-SVR4 - if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then - echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 - else # Add other i860-SVR4 vendors below as they are discovered. - echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 - fi - exit ;; - mini*:CTIX:SYS*5:*) - # "miniframe" - echo m68010-convergent-sysv - exit ;; - mc68k:UNIX:SYSTEM5:3.51m) - echo m68k-convergent-sysv - exit ;; - M680?0:D-NIX:5.3:*) - echo m68k-diab-dnix - exit ;; - M68*:*:R3V[5678]*:*) - test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; - 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) - OS_REL='' - test -r /etc/.relid \ - && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && { echo i486-ncr-sysv4.3${OS_REL}; exit; } - /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ - && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; - 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && { echo i486-ncr-sysv4; exit; } ;; - m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) - echo m68k-unknown-lynxos${UNAME_RELEASE} - exit ;; - mc68030:UNIX_System_V:4.*:*) - echo m68k-atari-sysv4 - exit ;; - TSUNAMI:LynxOS:2.*:*) - echo sparc-unknown-lynxos${UNAME_RELEASE} - exit ;; - rs6000:LynxOS:2.*:*) - echo rs6000-unknown-lynxos${UNAME_RELEASE} - exit ;; - PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) - echo powerpc-unknown-lynxos${UNAME_RELEASE} - exit ;; - SM[BE]S:UNIX_SV:*:*) - echo mips-dde-sysv${UNAME_RELEASE} - exit ;; - RM*:ReliantUNIX-*:*:*) - echo mips-sni-sysv4 - exit ;; - RM*:SINIX-*:*:*) - echo mips-sni-sysv4 - exit ;; - *:SINIX-*:*:*) - if uname -p 2>/dev/null >/dev/null ; then - UNAME_MACHINE=`(uname -p) 2>/dev/null` - echo ${UNAME_MACHINE}-sni-sysv4 - else - echo ns32k-sni-sysv - fi - exit ;; - PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort - # says - echo i586-unisys-sysv4 - exit ;; - *:UNIX_System_V:4*:FTX*) - # From Gerald Hewes . - # How about differentiating between stratus architectures? -djm - echo hppa1.1-stratus-sysv4 - exit ;; - *:*:*:FTX*) - # From seanf@swdc.stratus.com. - echo i860-stratus-sysv4 - exit ;; - i*86:VOS:*:*) - # From Paul.Green@stratus.com. - echo ${UNAME_MACHINE}-stratus-vos - exit ;; - *:VOS:*:*) - # From Paul.Green@stratus.com. - echo hppa1.1-stratus-vos - exit ;; - mc68*:A/UX:*:*) - echo m68k-apple-aux${UNAME_RELEASE} - exit ;; - news*:NEWS-OS:6*:*) - echo mips-sony-newsos6 - exit ;; - R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) - if [ -d /usr/nec ]; then - echo mips-nec-sysv${UNAME_RELEASE} - else - echo mips-unknown-sysv${UNAME_RELEASE} - fi - exit ;; - BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. - echo powerpc-be-beos - exit ;; - BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. - echo powerpc-apple-beos - exit ;; - BePC:BeOS:*:*) # BeOS running on Intel PC compatible. - echo i586-pc-beos - exit ;; - SX-4:SUPER-UX:*:*) - echo sx4-nec-superux${UNAME_RELEASE} - exit ;; - SX-5:SUPER-UX:*:*) - echo sx5-nec-superux${UNAME_RELEASE} - exit ;; - SX-6:SUPER-UX:*:*) - echo sx6-nec-superux${UNAME_RELEASE} - exit ;; - SX-7:SUPER-UX:*:*) - echo sx7-nec-superux${UNAME_RELEASE} - exit ;; - SX-8:SUPER-UX:*:*) - echo sx8-nec-superux${UNAME_RELEASE} - exit ;; - SX-8R:SUPER-UX:*:*) - echo sx8r-nec-superux${UNAME_RELEASE} - exit ;; - Power*:Rhapsody:*:*) - echo powerpc-apple-rhapsody${UNAME_RELEASE} - exit ;; - *:Rhapsody:*:*) - echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} - exit ;; - *:Darwin:*:*) - UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown - case $UNAME_PROCESSOR in - unknown) UNAME_PROCESSOR=powerpc ;; - esac - echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} - exit ;; - *:procnto*:*:* | *:QNX:[0123456789]*:*) - UNAME_PROCESSOR=`uname -p` - if test "$UNAME_PROCESSOR" = "x86"; then - UNAME_PROCESSOR=i386 - UNAME_MACHINE=pc - fi - echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} - exit ;; - *:QNX:*:4*) - echo i386-pc-qnx - exit ;; - NSE-?:NONSTOP_KERNEL:*:*) - echo nse-tandem-nsk${UNAME_RELEASE} - exit ;; - NSR-?:NONSTOP_KERNEL:*:*) - echo nsr-tandem-nsk${UNAME_RELEASE} - exit ;; - *:NonStop-UX:*:*) - echo mips-compaq-nonstopux - exit ;; - BS2000:POSIX*:*:*) - echo bs2000-siemens-sysv - exit ;; - DS/*:UNIX_System_V:*:*) - echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} - exit ;; - *:Plan9:*:*) - # "uname -m" is not consistent, so use $cputype instead. 386 - # is converted to i386 for consistency with other x86 - # operating systems. - if test "$cputype" = "386"; then - UNAME_MACHINE=i386 - else - UNAME_MACHINE="$cputype" - fi - echo ${UNAME_MACHINE}-unknown-plan9 - exit ;; - *:TOPS-10:*:*) - echo pdp10-unknown-tops10 - exit ;; - *:TENEX:*:*) - echo pdp10-unknown-tenex - exit ;; - KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) - echo pdp10-dec-tops20 - exit ;; - XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) - echo pdp10-xkl-tops20 - exit ;; - *:TOPS-20:*:*) - echo pdp10-unknown-tops20 - exit ;; - *:ITS:*:*) - echo pdp10-unknown-its - exit ;; - SEI:*:*:SEIUX) - echo mips-sei-seiux${UNAME_RELEASE} - exit ;; - *:DragonFly:*:*) - echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` - exit ;; - *:*VMS:*:*) - UNAME_MACHINE=`(uname -p) 2>/dev/null` - case "${UNAME_MACHINE}" in - A*) echo alpha-dec-vms ; exit ;; - I*) echo ia64-dec-vms ; exit ;; - V*) echo vax-dec-vms ; exit ;; - esac ;; - *:XENIX:*:SysV) - echo i386-pc-xenix - exit ;; - i*86:skyos:*:*) - echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' - exit ;; - i*86:rdos:*:*) - echo ${UNAME_MACHINE}-pc-rdos - exit ;; -esac - -#echo '(No uname command or uname output not recognized.)' 1>&2 -#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 - -eval $set_cc_for_build -cat >$dummy.c < -# include -#endif -main () -{ -#if defined (sony) -#if defined (MIPSEB) - /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, - I don't know.... */ - printf ("mips-sony-bsd\n"); exit (0); -#else -#include - printf ("m68k-sony-newsos%s\n", -#ifdef NEWSOS4 - "4" -#else - "" -#endif - ); exit (0); -#endif -#endif - -#if defined (__arm) && defined (__acorn) && defined (__unix) - printf ("arm-acorn-riscix\n"); exit (0); -#endif - -#if defined (hp300) && !defined (hpux) - printf ("m68k-hp-bsd\n"); exit (0); -#endif - -#if defined (NeXT) -#if !defined (__ARCHITECTURE__) -#define __ARCHITECTURE__ "m68k" -#endif - int version; - version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; - if (version < 4) - printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); - else - printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); - exit (0); -#endif - -#if defined (MULTIMAX) || defined (n16) -#if defined (UMAXV) - printf ("ns32k-encore-sysv\n"); exit (0); -#else -#if defined (CMU) - printf ("ns32k-encore-mach\n"); exit (0); -#else - printf ("ns32k-encore-bsd\n"); exit (0); -#endif -#endif -#endif - -#if defined (__386BSD__) - printf ("i386-pc-bsd\n"); exit (0); -#endif - -#if defined (sequent) -#if defined (i386) - printf ("i386-sequent-dynix\n"); exit (0); -#endif -#if defined (ns32000) - printf ("ns32k-sequent-dynix\n"); exit (0); -#endif -#endif - -#if defined (_SEQUENT_) - struct utsname un; - - uname(&un); - - if (strncmp(un.version, "V2", 2) == 0) { - printf ("i386-sequent-ptx2\n"); exit (0); - } - if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ - printf ("i386-sequent-ptx1\n"); exit (0); - } - printf ("i386-sequent-ptx\n"); exit (0); - -#endif - -#if defined (vax) -# if !defined (ultrix) -# include -# if defined (BSD) -# if BSD == 43 - printf ("vax-dec-bsd4.3\n"); exit (0); -# else -# if BSD == 199006 - printf ("vax-dec-bsd4.3reno\n"); exit (0); -# else - printf ("vax-dec-bsd\n"); exit (0); -# endif -# endif -# else - printf ("vax-dec-bsd\n"); exit (0); -# endif -# else - printf ("vax-dec-ultrix\n"); exit (0); -# endif -#endif - -#if defined (alliant) && defined (i860) - printf ("i860-alliant-bsd\n"); exit (0); -#endif - - exit (1); -} -EOF - -$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && - { echo "$SYSTEM_NAME"; exit; } - -# Apollos put the system type in the environment. - -test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } - -# Convex versions that predate uname can use getsysinfo(1) - -if [ -x /usr/convex/getsysinfo ] -then - case `getsysinfo -f cpu_type` in - c1*) - echo c1-convex-bsd - exit ;; - c2*) - if getsysinfo -f scalar_acc - then echo c32-convex-bsd - else echo c2-convex-bsd - fi - exit ;; - c34*) - echo c34-convex-bsd - exit ;; - c38*) - echo c38-convex-bsd - exit ;; - c4*) - echo c4-convex-bsd - exit ;; - esac -fi - -cat >&2 < in order to provide the needed -information to handle your system. - -config.guess timestamp = $timestamp - -uname -m = `(uname -m) 2>/dev/null || echo unknown` -uname -r = `(uname -r) 2>/dev/null || echo unknown` -uname -s = `(uname -s) 2>/dev/null || echo unknown` -uname -v = `(uname -v) 2>/dev/null || echo unknown` - -/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` -/bin/uname -X = `(/bin/uname -X) 2>/dev/null` - -hostinfo = `(hostinfo) 2>/dev/null` -/bin/universe = `(/bin/universe) 2>/dev/null` -/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` -/bin/arch = `(/bin/arch) 2>/dev/null` -/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` -/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` - -UNAME_MACHINE = ${UNAME_MACHINE} -UNAME_RELEASE = ${UNAME_RELEASE} -UNAME_SYSTEM = ${UNAME_SYSTEM} -UNAME_VERSION = ${UNAME_VERSION} -EOF - -exit 1 - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "timestamp='" -# time-stamp-format: "%:y-%02m-%02d" -# time-stamp-end: "'" -# End: diff --git a/Tools/config/config.sub b/Tools/config/config.sub deleted file mode 100755 index 1761d8bdf..000000000 --- a/Tools/config/config.sub +++ /dev/null @@ -1,1626 +0,0 @@ -#! /bin/sh -# Configuration validation subroutine script. -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, -# Inc. - -timestamp='2007-06-28' - -# This file is (in principle) common to ALL GNU software. -# The presence of a machine in this file suggests that SOME GNU software -# can handle that machine. It does not imply ALL GNU software can. -# -# This file is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA -# 02110-1301, USA. -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - - -# Please send patches to . Submit a context -# diff and a properly formatted ChangeLog entry. -# -# Configuration subroutine to validate and canonicalize a configuration type. -# Supply the specified configuration type as an argument. -# If it is invalid, we print an error message on stderr and exit with code 1. -# Otherwise, we print the canonical config type on stdout and succeed. - -# This file is supposed to be the same for all GNU packages -# and recognize all the CPU types, system types and aliases -# that are meaningful with *any* GNU software. -# Each package is responsible for reporting which valid configurations -# it does not support. The user should be able to distinguish -# a failure to support a valid configuration from a meaningless -# configuration. - -# The goal of this file is to map all the various variations of a given -# machine specification into a single specification in the form: -# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM -# or in some cases, the newer four-part form: -# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM -# It is wrong to echo any other type of specification. - -me=`echo "$0" | sed -e 's,.*/,,'` - -usage="\ -Usage: $0 [OPTION] CPU-MFR-OPSYS - $0 [OPTION] ALIAS - -Canonicalize a configuration name. - -Operation modes: - -h, --help print this help, then exit - -t, --time-stamp print date of last modification, then exit - -v, --version print version number, then exit - -Report bugs and patches to ." - -version="\ -GNU config.sub ($timestamp) - -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 -Free Software Foundation, Inc. - -This is free software; see the source for copying conditions. There is NO -warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." - -help=" -Try \`$me --help' for more information." - -# Parse command line -while test $# -gt 0 ; do - case $1 in - --time-stamp | --time* | -t ) - echo "$timestamp" ; exit ;; - --version | -v ) - echo "$version" ; exit ;; - --help | --h* | -h ) - echo "$usage"; exit ;; - -- ) # Stop option processing - shift; break ;; - - ) # Use stdin as input. - break ;; - -* ) - echo "$me: invalid option $1$help" - exit 1 ;; - - *local*) - # First pass through any local machine types. - echo $1 - exit ;; - - * ) - break ;; - esac -done - -case $# in - 0) echo "$me: missing argument$help" >&2 - exit 1;; - 1) ;; - *) echo "$me: too many arguments$help" >&2 - exit 1;; -esac - -# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). -# Here we must recognize all the valid KERNEL-OS combinations. -maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` -case $maybe_os in - nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \ - uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \ - storm-chaos* | os2-emx* | rtmk-nova*) - os=-$maybe_os - basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` - ;; - *) - basic_machine=`echo $1 | sed 's/-[^-]*$//'` - if [ $basic_machine != $1 ] - then os=`echo $1 | sed 's/.*-/-/'` - else os=; fi - ;; -esac - -### Let's recognize common machines as not being operating systems so -### that things like config.sub decstation-3100 work. We also -### recognize some manufacturers as not being operating systems, so we -### can provide default operating systems below. -case $os in - -sun*os*) - # Prevent following clause from handling this invalid input. - ;; - -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ - -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ - -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ - -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ - -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ - -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ - -apple | -axis | -knuth | -cray) - os= - basic_machine=$1 - ;; - -sim | -cisco | -oki | -wec | -winbond) - os= - basic_machine=$1 - ;; - -scout) - ;; - -wrs) - os=-vxworks - basic_machine=$1 - ;; - -chorusos*) - os=-chorusos - basic_machine=$1 - ;; - -chorusrdb) - os=-chorusrdb - basic_machine=$1 - ;; - -hiux*) - os=-hiuxwe2 - ;; - -sco6) - os=-sco5v6 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco5) - os=-sco3.2v5 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco4) - os=-sco3.2v4 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco3.2.[4-9]*) - os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco3.2v[4-9]*) - # Don't forget version if it is 3.2v4 or newer. - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco5v6*) - # Don't forget version if it is 3.2v4 or newer. - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco*) - os=-sco3.2v2 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -udk*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -isc) - os=-isc2.2 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -clix*) - basic_machine=clipper-intergraph - ;; - -isc*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -lynx*) - os=-lynxos - ;; - -ptx*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` - ;; - -windowsnt*) - os=`echo $os | sed -e 's/windowsnt/winnt/'` - ;; - -psos*) - os=-psos - ;; - -mint | -mint[0-9]*) - basic_machine=m68k-atari - os=-mint - ;; -esac - -# Decode aliases for certain CPU-COMPANY combinations. -case $basic_machine in - # Recognize the basic CPU types without company name. - # Some are omitted here because they have special meanings below. - 1750a | 580 \ - | a29k \ - | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ - | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ - | am33_2.0 \ - | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ - | bfin \ - | c4x | clipper \ - | d10v | d30v | dlx | dsp16xx \ - | fido | fr30 | frv \ - | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ - | i370 | i860 | i960 | ia64 \ - | ip2k | iq2000 \ - | m32c | m32r | m32rle | m68000 | m68k | m88k \ - | maxq | mb | microblaze | mcore | mep \ - | mips | mipsbe | mipseb | mipsel | mipsle \ - | mips16 \ - | mips64 | mips64el \ - | mips64vr | mips64vrel \ - | mips64orion | mips64orionel \ - | mips64vr4100 | mips64vr4100el \ - | mips64vr4300 | mips64vr4300el \ - | mips64vr5000 | mips64vr5000el \ - | mips64vr5900 | mips64vr5900el \ - | mipsisa32 | mipsisa32el \ - | mipsisa32r2 | mipsisa32r2el \ - | mipsisa64 | mipsisa64el \ - | mipsisa64r2 | mipsisa64r2el \ - | mipsisa64sb1 | mipsisa64sb1el \ - | mipsisa64sr71k | mipsisa64sr71kel \ - | mipstx39 | mipstx39el \ - | mn10200 | mn10300 \ - | mt \ - | msp430 \ - | nios | nios2 \ - | ns16k | ns32k \ - | or32 \ - | pdp10 | pdp11 | pj | pjl \ - | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ - | pyramid \ - | score \ - | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ - | sh64 | sh64le \ - | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ - | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ - | spu | strongarm \ - | tahoe | thumb | tic4x | tic80 | tron \ - | v850 | v850e \ - | we32k \ - | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \ - | z8k) - basic_machine=$basic_machine-unknown - ;; - m6811 | m68hc11 | m6812 | m68hc12) - # Motorola 68HC11/12. - basic_machine=$basic_machine-unknown - os=-none - ;; - m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) - ;; - ms1) - basic_machine=mt-unknown - ;; - - # We use `pc' rather than `unknown' - # because (1) that's what they normally are, and - # (2) the word "unknown" tends to confuse beginning users. - i*86 | x86_64) - basic_machine=$basic_machine-pc - ;; - # Object if more than one company name word. - *-*-*) - echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 - exit 1 - ;; - # Recognize the basic CPU types with company name. - 580-* \ - | a29k-* \ - | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ - | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ - | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ - | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ - | avr-* | avr32-* \ - | bfin-* | bs2000-* \ - | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ - | clipper-* | craynv-* | cydra-* \ - | d10v-* | d30v-* | dlx-* \ - | elxsi-* \ - | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ - | h8300-* | h8500-* \ - | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ - | i*86-* | i860-* | i960-* | ia64-* \ - | ip2k-* | iq2000-* \ - | m32c-* | m32r-* | m32rle-* \ - | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ - | m88110-* | m88k-* | maxq-* | mcore-* \ - | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ - | mips16-* \ - | mips64-* | mips64el-* \ - | mips64vr-* | mips64vrel-* \ - | mips64orion-* | mips64orionel-* \ - | mips64vr4100-* | mips64vr4100el-* \ - | mips64vr4300-* | mips64vr4300el-* \ - | mips64vr5000-* | mips64vr5000el-* \ - | mips64vr5900-* | mips64vr5900el-* \ - | mipsisa32-* | mipsisa32el-* \ - | mipsisa32r2-* | mipsisa32r2el-* \ - | mipsisa64-* | mipsisa64el-* \ - | mipsisa64r2-* | mipsisa64r2el-* \ - | mipsisa64sb1-* | mipsisa64sb1el-* \ - | mipsisa64sr71k-* | mipsisa64sr71kel-* \ - | mipstx39-* | mipstx39el-* \ - | mmix-* \ - | mt-* \ - | msp430-* \ - | nios-* | nios2-* \ - | none-* | np1-* | ns16k-* | ns32k-* \ - | orion-* \ - | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ - | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ - | pyramid-* \ - | romp-* | rs6000-* \ - | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ - | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ - | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ - | sparclite-* \ - | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \ - | tahoe-* | thumb-* \ - | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ - | tron-* \ - | v850-* | v850e-* | vax-* \ - | we32k-* \ - | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \ - | xstormy16-* | xtensa-* \ - | ymp-* \ - | z8k-*) - ;; - # Recognize the various machine names and aliases which stand - # for a CPU type and a company and sometimes even an OS. - 386bsd) - basic_machine=i386-unknown - os=-bsd - ;; - 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) - basic_machine=m68000-att - ;; - 3b*) - basic_machine=we32k-att - ;; - a29khif) - basic_machine=a29k-amd - os=-udi - ;; - abacus) - basic_machine=abacus-unknown - ;; - adobe68k) - basic_machine=m68010-adobe - os=-scout - ;; - alliant | fx80) - basic_machine=fx80-alliant - ;; - altos | altos3068) - basic_machine=m68k-altos - ;; - am29k) - basic_machine=a29k-none - os=-bsd - ;; - amd64) - basic_machine=x86_64-pc - ;; - amd64-*) - basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - amdahl) - basic_machine=580-amdahl - os=-sysv - ;; - amiga | amiga-*) - basic_machine=m68k-unknown - ;; - amigaos | amigados) - basic_machine=m68k-unknown - os=-amigaos - ;; - amigaunix | amix) - basic_machine=m68k-unknown - os=-sysv4 - ;; - apollo68) - basic_machine=m68k-apollo - os=-sysv - ;; - apollo68bsd) - basic_machine=m68k-apollo - os=-bsd - ;; - aux) - basic_machine=m68k-apple - os=-aux - ;; - balance) - basic_machine=ns32k-sequent - os=-dynix - ;; - c90) - basic_machine=c90-cray - os=-unicos - ;; - convex-c1) - basic_machine=c1-convex - os=-bsd - ;; - convex-c2) - basic_machine=c2-convex - os=-bsd - ;; - convex-c32) - basic_machine=c32-convex - os=-bsd - ;; - convex-c34) - basic_machine=c34-convex - os=-bsd - ;; - convex-c38) - basic_machine=c38-convex - os=-bsd - ;; - cray | j90) - basic_machine=j90-cray - os=-unicos - ;; - craynv) - basic_machine=craynv-cray - os=-unicosmp - ;; - cr16) - basic_machine=cr16-unknown - os=-elf - ;; - crds | unos) - basic_machine=m68k-crds - ;; - crisv32 | crisv32-* | etraxfs*) - basic_machine=crisv32-axis - ;; - cris | cris-* | etrax*) - basic_machine=cris-axis - ;; - crx) - basic_machine=crx-unknown - os=-elf - ;; - da30 | da30-*) - basic_machine=m68k-da30 - ;; - decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) - basic_machine=mips-dec - ;; - decsystem10* | dec10*) - basic_machine=pdp10-dec - os=-tops10 - ;; - decsystem20* | dec20*) - basic_machine=pdp10-dec - os=-tops20 - ;; - delta | 3300 | motorola-3300 | motorola-delta \ - | 3300-motorola | delta-motorola) - basic_machine=m68k-motorola - ;; - delta88) - basic_machine=m88k-motorola - os=-sysv3 - ;; - djgpp) - basic_machine=i586-pc - os=-msdosdjgpp - ;; - dpx20 | dpx20-*) - basic_machine=rs6000-bull - os=-bosx - ;; - dpx2* | dpx2*-bull) - basic_machine=m68k-bull - os=-sysv3 - ;; - ebmon29k) - basic_machine=a29k-amd - os=-ebmon - ;; - elxsi) - basic_machine=elxsi-elxsi - os=-bsd - ;; - encore | umax | mmax) - basic_machine=ns32k-encore - ;; - es1800 | OSE68k | ose68k | ose | OSE) - basic_machine=m68k-ericsson - os=-ose - ;; - fx2800) - basic_machine=i860-alliant - ;; - genix) - basic_machine=ns32k-ns - ;; - gmicro) - basic_machine=tron-gmicro - os=-sysv - ;; - go32) - basic_machine=i386-pc - os=-go32 - ;; - h3050r* | hiux*) - basic_machine=hppa1.1-hitachi - os=-hiuxwe2 - ;; - h8300hms) - basic_machine=h8300-hitachi - os=-hms - ;; - h8300xray) - basic_machine=h8300-hitachi - os=-xray - ;; - h8500hms) - basic_machine=h8500-hitachi - os=-hms - ;; - harris) - basic_machine=m88k-harris - os=-sysv3 - ;; - hp300-*) - basic_machine=m68k-hp - ;; - hp300bsd) - basic_machine=m68k-hp - os=-bsd - ;; - hp300hpux) - basic_machine=m68k-hp - os=-hpux - ;; - hp3k9[0-9][0-9] | hp9[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hp9k2[0-9][0-9] | hp9k31[0-9]) - basic_machine=m68000-hp - ;; - hp9k3[2-9][0-9]) - basic_machine=m68k-hp - ;; - hp9k6[0-9][0-9] | hp6[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hp9k7[0-79][0-9] | hp7[0-79][0-9]) - basic_machine=hppa1.1-hp - ;; - hp9k78[0-9] | hp78[0-9]) - # FIXME: really hppa2.0-hp - basic_machine=hppa1.1-hp - ;; - hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) - # FIXME: really hppa2.0-hp - basic_machine=hppa1.1-hp - ;; - hp9k8[0-9][13679] | hp8[0-9][13679]) - basic_machine=hppa1.1-hp - ;; - hp9k8[0-9][0-9] | hp8[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hppa-next) - os=-nextstep3 - ;; - hppaosf) - basic_machine=hppa1.1-hp - os=-osf - ;; - hppro) - basic_machine=hppa1.1-hp - os=-proelf - ;; - i370-ibm* | ibm*) - basic_machine=i370-ibm - ;; -# I'm not sure what "Sysv32" means. Should this be sysv3.2? - i*86v32) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv32 - ;; - i*86v4*) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv4 - ;; - i*86v) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv - ;; - i*86sol2) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-solaris2 - ;; - i386mach) - basic_machine=i386-mach - os=-mach - ;; - i386-vsta | vsta) - basic_machine=i386-unknown - os=-vsta - ;; - iris | iris4d) - basic_machine=mips-sgi - case $os in - -irix*) - ;; - *) - os=-irix4 - ;; - esac - ;; - isi68 | isi) - basic_machine=m68k-isi - os=-sysv - ;; - m88k-omron*) - basic_machine=m88k-omron - ;; - magnum | m3230) - basic_machine=mips-mips - os=-sysv - ;; - merlin) - basic_machine=ns32k-utek - os=-sysv - ;; - mingw32) - basic_machine=i386-pc - os=-mingw32 - ;; - mingw32ce) - basic_machine=arm-unknown - os=-mingw32ce - ;; - miniframe) - basic_machine=m68000-convergent - ;; - *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) - basic_machine=m68k-atari - os=-mint - ;; - mips3*-*) - basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` - ;; - mips3*) - basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown - ;; - monitor) - basic_machine=m68k-rom68k - os=-coff - ;; - morphos) - basic_machine=powerpc-unknown - os=-morphos - ;; - msdos) - basic_machine=i386-pc - os=-msdos - ;; - ms1-*) - basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` - ;; - mvs) - basic_machine=i370-ibm - os=-mvs - ;; - ncr3000) - basic_machine=i486-ncr - os=-sysv4 - ;; - netbsd386) - basic_machine=i386-unknown - os=-netbsd - ;; - netwinder) - basic_machine=armv4l-rebel - os=-linux - ;; - news | news700 | news800 | news900) - basic_machine=m68k-sony - os=-newsos - ;; - news1000) - basic_machine=m68030-sony - os=-newsos - ;; - news-3600 | risc-news) - basic_machine=mips-sony - os=-newsos - ;; - necv70) - basic_machine=v70-nec - os=-sysv - ;; - next | m*-next ) - basic_machine=m68k-next - case $os in - -nextstep* ) - ;; - -ns2*) - os=-nextstep2 - ;; - *) - os=-nextstep3 - ;; - esac - ;; - nh3000) - basic_machine=m68k-harris - os=-cxux - ;; - nh[45]000) - basic_machine=m88k-harris - os=-cxux - ;; - nindy960) - basic_machine=i960-intel - os=-nindy - ;; - mon960) - basic_machine=i960-intel - os=-mon960 - ;; - nonstopux) - basic_machine=mips-compaq - os=-nonstopux - ;; - np1) - basic_machine=np1-gould - ;; - nsr-tandem) - basic_machine=nsr-tandem - ;; - op50n-* | op60c-*) - basic_machine=hppa1.1-oki - os=-proelf - ;; - openrisc | openrisc-*) - basic_machine=or32-unknown - ;; - os400) - basic_machine=powerpc-ibm - os=-os400 - ;; - OSE68000 | ose68000) - basic_machine=m68000-ericsson - os=-ose - ;; - os68k) - basic_machine=m68k-none - os=-os68k - ;; - pa-hitachi) - basic_machine=hppa1.1-hitachi - os=-hiuxwe2 - ;; - paragon) - basic_machine=i860-intel - os=-osf - ;; - pbd) - basic_machine=sparc-tti - ;; - pbb) - basic_machine=m68k-tti - ;; - pc532 | pc532-*) - basic_machine=ns32k-pc532 - ;; - pc98) - basic_machine=i386-pc - ;; - pc98-*) - basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentium | p5 | k5 | k6 | nexgen | viac3) - basic_machine=i586-pc - ;; - pentiumpro | p6 | 6x86 | athlon | athlon_*) - basic_machine=i686-pc - ;; - pentiumii | pentium2 | pentiumiii | pentium3) - basic_machine=i686-pc - ;; - pentium4) - basic_machine=i786-pc - ;; - pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) - basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentiumpro-* | p6-* | 6x86-* | athlon-*) - basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) - basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentium4-*) - basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pn) - basic_machine=pn-gould - ;; - power) basic_machine=power-ibm - ;; - ppc) basic_machine=powerpc-unknown - ;; - ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppcle | powerpclittle | ppc-le | powerpc-little) - basic_machine=powerpcle-unknown - ;; - ppcle-* | powerpclittle-*) - basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppc64) basic_machine=powerpc64-unknown - ;; - ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppc64le | powerpc64little | ppc64-le | powerpc64-little) - basic_machine=powerpc64le-unknown - ;; - ppc64le-* | powerpc64little-*) - basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ps2) - basic_machine=i386-ibm - ;; - pw32) - basic_machine=i586-unknown - os=-pw32 - ;; - rdos) - basic_machine=i386-pc - os=-rdos - ;; - rom68k) - basic_machine=m68k-rom68k - os=-coff - ;; - rm[46]00) - basic_machine=mips-siemens - ;; - rtpc | rtpc-*) - basic_machine=romp-ibm - ;; - s390 | s390-*) - basic_machine=s390-ibm - ;; - s390x | s390x-*) - basic_machine=s390x-ibm - ;; - sa29200) - basic_machine=a29k-amd - os=-udi - ;; - sb1) - basic_machine=mipsisa64sb1-unknown - ;; - sb1el) - basic_machine=mipsisa64sb1el-unknown - ;; - sde) - basic_machine=mipsisa32-sde - os=-elf - ;; - sei) - basic_machine=mips-sei - os=-seiux - ;; - sequent) - basic_machine=i386-sequent - ;; - sh) - basic_machine=sh-hitachi - os=-hms - ;; - sh5el) - basic_machine=sh5le-unknown - ;; - sh64) - basic_machine=sh64-unknown - ;; - sparclite-wrs | simso-wrs) - basic_machine=sparclite-wrs - os=-vxworks - ;; - sps7) - basic_machine=m68k-bull - os=-sysv2 - ;; - spur) - basic_machine=spur-unknown - ;; - st2000) - basic_machine=m68k-tandem - ;; - stratus) - basic_machine=i860-stratus - os=-sysv4 - ;; - sun2) - basic_machine=m68000-sun - ;; - sun2os3) - basic_machine=m68000-sun - os=-sunos3 - ;; - sun2os4) - basic_machine=m68000-sun - os=-sunos4 - ;; - sun3os3) - basic_machine=m68k-sun - os=-sunos3 - ;; - sun3os4) - basic_machine=m68k-sun - os=-sunos4 - ;; - sun4os3) - basic_machine=sparc-sun - os=-sunos3 - ;; - sun4os4) - basic_machine=sparc-sun - os=-sunos4 - ;; - sun4sol2) - basic_machine=sparc-sun - os=-solaris2 - ;; - sun3 | sun3-*) - basic_machine=m68k-sun - ;; - sun4) - basic_machine=sparc-sun - ;; - sun386 | sun386i | roadrunner) - basic_machine=i386-sun - ;; - sv1) - basic_machine=sv1-cray - os=-unicos - ;; - symmetry) - basic_machine=i386-sequent - os=-dynix - ;; - t3e) - basic_machine=alphaev5-cray - os=-unicos - ;; - t90) - basic_machine=t90-cray - os=-unicos - ;; - tic54x | c54x*) - basic_machine=tic54x-unknown - os=-coff - ;; - tic55x | c55x*) - basic_machine=tic55x-unknown - os=-coff - ;; - tic6x | c6x*) - basic_machine=tic6x-unknown - os=-coff - ;; - tx39) - basic_machine=mipstx39-unknown - ;; - tx39el) - basic_machine=mipstx39el-unknown - ;; - toad1) - basic_machine=pdp10-xkl - os=-tops20 - ;; - tower | tower-32) - basic_machine=m68k-ncr - ;; - tpf) - basic_machine=s390x-ibm - os=-tpf - ;; - udi29k) - basic_machine=a29k-amd - os=-udi - ;; - ultra3) - basic_machine=a29k-nyu - os=-sym1 - ;; - v810 | necv810) - basic_machine=v810-nec - os=-none - ;; - vaxv) - basic_machine=vax-dec - os=-sysv - ;; - vms) - basic_machine=vax-dec - os=-vms - ;; - vpp*|vx|vx-*) - basic_machine=f301-fujitsu - ;; - vxworks960) - basic_machine=i960-wrs - os=-vxworks - ;; - vxworks68) - basic_machine=m68k-wrs - os=-vxworks - ;; - vxworks29k) - basic_machine=a29k-wrs - os=-vxworks - ;; - w65*) - basic_machine=w65-wdc - os=-none - ;; - w89k-*) - basic_machine=hppa1.1-winbond - os=-proelf - ;; - xbox) - basic_machine=i686-pc - os=-mingw32 - ;; - xps | xps100) - basic_machine=xps100-honeywell - ;; - ymp) - basic_machine=ymp-cray - os=-unicos - ;; - z8k-*-coff) - basic_machine=z8k-unknown - os=-sim - ;; - none) - basic_machine=none-none - os=-none - ;; - -# Here we handle the default manufacturer of certain CPU types. It is in -# some cases the only manufacturer, in others, it is the most popular. - w89k) - basic_machine=hppa1.1-winbond - ;; - op50n) - basic_machine=hppa1.1-oki - ;; - op60c) - basic_machine=hppa1.1-oki - ;; - romp) - basic_machine=romp-ibm - ;; - mmix) - basic_machine=mmix-knuth - ;; - rs6000) - basic_machine=rs6000-ibm - ;; - vax) - basic_machine=vax-dec - ;; - pdp10) - # there are many clones, so DEC is not a safe bet - basic_machine=pdp10-unknown - ;; - pdp11) - basic_machine=pdp11-dec - ;; - we32k) - basic_machine=we32k-att - ;; - sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele) - basic_machine=sh-unknown - ;; - sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) - basic_machine=sparc-sun - ;; - cydra) - basic_machine=cydra-cydrome - ;; - orion) - basic_machine=orion-highlevel - ;; - orion105) - basic_machine=clipper-highlevel - ;; - mac | mpw | mac-mpw) - basic_machine=m68k-apple - ;; - pmac | pmac-mpw) - basic_machine=powerpc-apple - ;; - *-unknown) - # Make sure to match an already-canonicalized machine name. - ;; - *) - echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 - exit 1 - ;; -esac - -# Here we canonicalize certain aliases for manufacturers. -case $basic_machine in - *-digital*) - basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` - ;; - *-commodore*) - basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` - ;; - *) - ;; -esac - -# Decode manufacturer-specific aliases for certain operating systems. - -if [ x"$os" != x"" ] -then -case $os in - # First match some system type aliases - # that might get confused with valid system types. - # -solaris* is a basic system type, with this one exception. - -solaris1 | -solaris1.*) - os=`echo $os | sed -e 's|solaris1|sunos4|'` - ;; - -solaris) - os=-solaris2 - ;; - -svr4*) - os=-sysv4 - ;; - -unixware*) - os=-sysv4.2uw - ;; - -gnu/linux*) - os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` - ;; - # First accept the basic system types. - # The portable systems comes first. - # Each alternative MUST END IN A *, to match a version number. - # -sysv* is not here because it comes later, after sysvr4. - -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ - | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ - | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ - | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ - | -aos* \ - | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ - | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ - | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ - | -openbsd* | -solidbsd* \ - | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ - | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ - | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ - | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ - | -chorusos* | -chorusrdb* \ - | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \ - | -uxpv* | -beos* | -mpeix* | -udk* \ - | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ - | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ - | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ - | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ - | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ - | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ - | -skyos* | -haiku* | -rdos* | -toppers* | -drops*) - # Remember, each alternative MUST END IN *, to match a version number. - ;; - -qnx*) - case $basic_machine in - x86-* | i*86-*) - ;; - *) - os=-nto$os - ;; - esac - ;; - -nto-qnx*) - ;; - -nto*) - os=`echo $os | sed -e 's|nto|nto-qnx|'` - ;; - -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ - | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ - | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) - ;; - -mac*) - os=`echo $os | sed -e 's|mac|macos|'` - ;; - -linux-dietlibc) - os=-linux-dietlibc - ;; - -linux*) - os=`echo $os | sed -e 's|linux|linux-gnu|'` - ;; - -sunos5*) - os=`echo $os | sed -e 's|sunos5|solaris2|'` - ;; - -sunos6*) - os=`echo $os | sed -e 's|sunos6|solaris3|'` - ;; - -opened*) - os=-openedition - ;; - -os400*) - os=-os400 - ;; - -wince*) - os=-wince - ;; - -osfrose*) - os=-osfrose - ;; - -osf*) - os=-osf - ;; - -utek*) - os=-bsd - ;; - -dynix*) - os=-bsd - ;; - -acis*) - os=-aos - ;; - -atheos*) - os=-atheos - ;; - -syllable*) - os=-syllable - ;; - -386bsd) - os=-bsd - ;; - -ctix* | -uts*) - os=-sysv - ;; - -nova*) - os=-rtmk-nova - ;; - -ns2 ) - os=-nextstep2 - ;; - -nsk*) - os=-nsk - ;; - # Preserve the version number of sinix5. - -sinix5.*) - os=`echo $os | sed -e 's|sinix|sysv|'` - ;; - -sinix*) - os=-sysv4 - ;; - -tpf*) - os=-tpf - ;; - -triton*) - os=-sysv3 - ;; - -oss*) - os=-sysv3 - ;; - -svr4) - os=-sysv4 - ;; - -svr3) - os=-sysv3 - ;; - -sysvr4) - os=-sysv4 - ;; - # This must come after -sysvr4. - -sysv*) - ;; - -ose*) - os=-ose - ;; - -es1800*) - os=-ose - ;; - -xenix) - os=-xenix - ;; - -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) - os=-mint - ;; - -aros*) - os=-aros - ;; - -kaos*) - os=-kaos - ;; - -zvmoe) - os=-zvmoe - ;; - -none) - ;; - *) - # Get rid of the `-' at the beginning of $os. - os=`echo $os | sed 's/[^-]*-//'` - echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 - exit 1 - ;; -esac -else - -# Here we handle the default operating systems that come with various machines. -# The value should be what the vendor currently ships out the door with their -# machine or put another way, the most popular os provided with the machine. - -# Note that if you're going to try to match "-MANUFACTURER" here (say, -# "-sun"), then you have to tell the case statement up towards the top -# that MANUFACTURER isn't an operating system. Otherwise, code above -# will signal an error saying that MANUFACTURER isn't an operating -# system, and we'll never get to this point. - -case $basic_machine in - score-*) - os=-elf - ;; - spu-*) - os=-elf - ;; - *-acorn) - os=-riscix1.2 - ;; - arm*-rebel) - os=-linux - ;; - arm*-semi) - os=-aout - ;; - c4x-* | tic4x-*) - os=-coff - ;; - # This must come before the *-dec entry. - pdp10-*) - os=-tops20 - ;; - pdp11-*) - os=-none - ;; - *-dec | vax-*) - os=-ultrix4.2 - ;; - m68*-apollo) - os=-domain - ;; - i386-sun) - os=-sunos4.0.2 - ;; - m68000-sun) - os=-sunos3 - # This also exists in the configure program, but was not the - # default. - # os=-sunos4 - ;; - m68*-cisco) - os=-aout - ;; - mep-*) - os=-elf - ;; - mips*-cisco) - os=-elf - ;; - mips*-*) - os=-elf - ;; - or32-*) - os=-coff - ;; - *-tti) # must be before sparc entry or we get the wrong os. - os=-sysv3 - ;; - sparc-* | *-sun) - os=-sunos4.1.1 - ;; - *-be) - os=-beos - ;; - *-haiku) - os=-haiku - ;; - *-ibm) - os=-aix - ;; - *-knuth) - os=-mmixware - ;; - *-wec) - os=-proelf - ;; - *-winbond) - os=-proelf - ;; - *-oki) - os=-proelf - ;; - *-hp) - os=-hpux - ;; - *-hitachi) - os=-hiux - ;; - i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) - os=-sysv - ;; - *-cbm) - os=-amigaos - ;; - *-dg) - os=-dgux - ;; - *-dolphin) - os=-sysv3 - ;; - m68k-ccur) - os=-rtu - ;; - m88k-omron*) - os=-luna - ;; - *-next ) - os=-nextstep - ;; - *-sequent) - os=-ptx - ;; - *-crds) - os=-unos - ;; - *-ns) - os=-genix - ;; - i370-*) - os=-mvs - ;; - *-next) - os=-nextstep3 - ;; - *-gould) - os=-sysv - ;; - *-highlevel) - os=-bsd - ;; - *-encore) - os=-bsd - ;; - *-sgi) - os=-irix - ;; - *-siemens) - os=-sysv4 - ;; - *-masscomp) - os=-rtu - ;; - f30[01]-fujitsu | f700-fujitsu) - os=-uxpv - ;; - *-rom68k) - os=-coff - ;; - *-*bug) - os=-coff - ;; - *-apple) - os=-macos - ;; - *-atari*) - os=-mint - ;; - *) - os=-none - ;; -esac -fi - -# Here we handle the case where we know the os, and the CPU type, but not the -# manufacturer. We pick the logical manufacturer. -vendor=unknown -case $basic_machine in - *-unknown) - case $os in - -riscix*) - vendor=acorn - ;; - -sunos*) - vendor=sun - ;; - -aix*) - vendor=ibm - ;; - -beos*) - vendor=be - ;; - -hpux*) - vendor=hp - ;; - -mpeix*) - vendor=hp - ;; - -hiux*) - vendor=hitachi - ;; - -unos*) - vendor=crds - ;; - -dgux*) - vendor=dg - ;; - -luna*) - vendor=omron - ;; - -genix*) - vendor=ns - ;; - -mvs* | -opened*) - vendor=ibm - ;; - -os400*) - vendor=ibm - ;; - -ptx*) - vendor=sequent - ;; - -tpf*) - vendor=ibm - ;; - -vxsim* | -vxworks* | -windiss*) - vendor=wrs - ;; - -aux*) - vendor=apple - ;; - -hms*) - vendor=hitachi - ;; - -mpw* | -macos*) - vendor=apple - ;; - -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) - vendor=atari - ;; - -vos*) - vendor=stratus - ;; - esac - basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` - ;; -esac - -echo $basic_machine$os -exit - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "timestamp='" -# time-stamp-format: "%:y-%02m-%02d" -# time-stamp-end: "'" -# End: diff --git a/Tools/mkrelease.py b/Tools/mkrelease.py index 574720dab..d7927f8e6 100755 --- a/Tools/mkrelease.py +++ b/Tools/mkrelease.py @@ -21,8 +21,8 @@ except: print "where version should be 1.3.x and username is your SF username" sys.exit(1) -print "Looking for wput" -os.system("which wput") and failed("wput not installed/found. Please install.") +print "Looking for rsync" +os.system("which rsync") and failed("rsync not installed/found. Please install.") print "Making source tarball" os.system("python ./mkdist.py " + version) and failed("") @@ -31,8 +31,8 @@ print "Build Windows package" os.system("./mkwindows.sh " + version) and failed("") print "Uploading to Sourceforge" -os.system("wput --verbose --binary swig-" + version + ".tar.gz ftp://anonymous:" + username + "@users.sourceforge.net@upload.sourceforge.net/incoming/") and failed("") -os.system("wput --verbose --binary swigwin-" + version + ".zip ftp://anonymous:" + username + "@users.sourceforge.net@upload.sourceforge.net/incoming/") and failed("") +os.system("rsync --archive --verbose -P --times -e ssh swig-" + version + ".tar.gz " + username + "@frs.sourceforge.net:uploads/") and failed("") +os.system("rsync --archive --verbose -P --times -e ssh swigwin-" + version + ".zip " + username + "@frs.sourceforge.net:uploads/") and failed("") os.system("svn copy -m \"rel-" + version + "\" https://swig.svn.sourceforge.net/svnroot/swig/trunk https://swig.svn.sourceforge.net/svnroot/swig/tags/rel-" + version + "/") diff --git a/configure.in b/configure.in index 82d83a4f0..8a09cd6f7 100644 --- a/configure.in +++ b/configure.in @@ -2,7 +2,7 @@ dnl Process this file with autoconf to produce a configure script. dnl The macros which aren't shipped with the autotools are stored in the dnl Tools/config directory in .m4 files. -AC_INIT([swig],[1.3.36],[http://www.swig.org]) +AC_INIT([swig],[1.3.37],[http://www.swig.org]) AC_PREREQ(2.58) AC_CONFIG_SRCDIR([Source/Swig/swig.h]) AC_CONFIG_AUX_DIR([Tools/config]) @@ -254,18 +254,6 @@ case $host in *) MZSCHEME_SO=.so;; esac -AC_SUBST(TCL_LDSHARED) -case $host in - *-*-darwin*) TCL_LDSHARED="gcc -dynamiclib -flat_namespace -undefined suppress";; - *) TCL_LDSHARED=$LDSHARED;; -esac - -AC_SUBST(TCL_CXXSHARED) -case $host in - *-*-darwin*) TCL_CXXSHARED="g++ -dynamiclib -flat_namespace -undefined suppress";; - *) TCL_CXXSHARED=$TRYLINKINGWITHCXX;; -esac - AC_SUBST(LUA_SO) case $host in *-*-darwin*) LUA_SO=.so;; @@ -388,12 +376,12 @@ if test "$no_x" = "yes" -o "$not_really_there" = "yes"; then dirs="/usr/unsupported/include /usr/local/include /usr/X386/include /usr/include/X11R4 /usr/X11R5/include /usr/include/X11R5 /usr/openwin/include /usr/X11/include /usr/sww/include /usr/X11R6/include /usr/include/X11R6" for i in $dirs ; do if test -r $i/X11/Intrinsic.h; then - AC_MSG_RESULT($i) XINCLUDES=" -I$i" break fi done fi + AC_MSG_RESULT($XINCLUDES) else if test "$x_includes" != ""; then XINCLUDES=-I$x_includes @@ -547,11 +535,25 @@ case $host in *-*-cygwin* | *-*-mingw*) TCLDYNAMICLINKING="$TCLLIB";; *)TCLDYNAMICLINKING="";; esac + +case $host in +*-*-darwin*) + TCLLDSHARED='$(CC) -dynamiclib -undefined suppress -flat_namespace' + TCLCXXSHARED='$(CXX) -dynamiclib -undefined suppress -flat_namespace' + ;; +*) + TCLLDSHARED='$(LDSHARED)' + TCLCXXSHARED='$(CXXSHARED)' + ;; +esac + fi AC_SUBST(TCLINCLUDE) AC_SUBST(TCLLIB) AC_SUBST(TCLDYNAMICLINKING) +AC_SUBST(TCLLDSHARED) +AC_SUBST(TCLCXXSHARED) #---------------------------------------------------------------- # Look for Python @@ -571,7 +573,7 @@ else # First figure out the name of the Python executable if test "x$PYBIN" = xyes; then -AC_CHECK_PROGS(PYTHON, python python2.8 python2.7 python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0 python1.6 python1.5 python1.4 python) +AC_CHECK_PROGS(PYTHON, [python python2.8 python2.7 python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0 python1.6 python1.5 python1.4 python]) else PYTHON="$PYBIN" fi @@ -655,6 +657,103 @@ AC_SUBST(PYLIB) AC_SUBST(PYLINK) AC_SUBST(PYTHONDYNAMICLINKING) + +#---------------------------------------------------------------- +# Look for Python 3.x +#---------------------------------------------------------------- + +# mostly copy & pasted from "Look for Python" section, +# did some trim, fix and rename + +PY3INCLUDE= +PY3LIB= +PY3PACKAGE= + +AC_ARG_WITH(python3, AS_HELP_STRING([--without-python3], [Disable Python 3.x support]) +AS_HELP_STRING([--with-python3=path], [Set location of Python 3.x executable]),[ PY3BIN="$withval"], [PY3BIN=yes]) + +# First, check for "--without-python3" or "--with-python3=no". +if test x"${PY3BIN}" = xno -o x"${with_alllang}" = xno ; then +AC_MSG_NOTICE([Disabling Python 3.x support]) +else +# First figure out the name of the Python3 executable + +if test "x$PY3BIN" = xyes; then +AC_CHECK_PROGS(PYTHON3, [python3 python3.0]) +else +PYTHON3="$PY3BIN" +fi + +# Check for Python 3.x development tools (header files, static library and python3-config) +AC_CHECK_PROGS(PY3CONFIG, [$PYTHON3-config python3-config python3.0-config]) + +if test -n "$PYTHON3" -a -n "$PY3CONFIG"; then + AC_MSG_CHECKING([for Python 3.x prefix]) + PY3PREFIX=`($PY3CONFIG --prefix) 2>/dev/null` + AC_MSG_RESULT($PY3PREFIX) + AC_MSG_CHECKING(for Python 3.x exec-prefix) + PY3EPREFIX=`($PY3CONFIG --exec-prefix) 2>/dev/null` + AC_MSG_RESULT($PY3EPREFIX) + + # Note: I could not think of a standard way to get the version string from different versions. + # This trick pulls it out of the file location for a standard library file. + + AC_MSG_CHECKING([for Python 3.x version]) + + # Need to do this hack since autoconf replaces __file__ with the name of the configure file + filehack="file__" + PY3VERSION=`($PYTHON3 -c "import string,operator,os.path; print(operator.getitem(os.path.split(operator.getitem(os.path.split(string.__$filehack),0)),1))")` + AC_MSG_RESULT($PY3VERSION) + + # Find the directory for libraries this is necessary to deal with + # platforms that can have apps built for multiple archs: e.g. x86_64 + AC_MSG_CHECKING([for Python 3.x lib dir]) + PY3LIBDIR=`($PYTHON3 -c "import sys; print(sys.lib)") 2>/dev/null` + if test -z "$PY3LIBDIR"; then + # some dists don't have sys.lib so the best we can do is assume lib + PY3LIBDIR="lib" + fi + AC_MSG_RESULT($PY3LIBDIR) + + # Set the include directory + + AC_MSG_CHECKING([for Python 3.x header files]) + PY3INCLUDE=`($PY3CONFIG --includes) 2>/dev/null` + AC_MSG_RESULT($PY3INCLUDE) + + # Set the library directory blindly. This probably won't work with older versions + AC_MSG_CHECKING([for Python 3.x library]) + dirs="$PY3VERSION/config $PY3VERSION/$PY3LIBDIR python/$PY3LIBDIR" + for i in $dirs; do + if test -d $PY3EPREFIX/$PY3LIBDIR/$i; then + PY3LIB="$PY3EPREFIX/$PY3LIBDIR/$i" + break + fi + done + if test -z "$PY3LIB"; then + AC_MSG_RESULT([Not found]) + else + AC_MSG_RESULT($PY3LIB) + fi + + PY3LINK="-l$PY3VERSION" +fi + +# Cygwin (Windows) needs the library for dynamic linking +case $host in +*-*-cygwin* | *-*-mingw*) PYTHON3DYNAMICLINKING="-L$PYLIB $PY3LINK" + DEFS="-DUSE_DL_IMPORT $DEFS" PY3INCLUDE="$PY3INCLUDE" + ;; +*)PYTHON3DYNAMICLINKING="";; +esac +fi + +AC_SUBST(PY3INCLUDE) +AC_SUBST(PY3LIB) +AC_SUBST(PY3LINK) +AC_SUBST(PYTHON3DYNAMICLINKING) + + #---------------------------------------------------------------- # Look for Perl5 #---------------------------------------------------------------- @@ -743,13 +842,13 @@ OCTAVEDYNAMICLINKING= OCTAVE_SO=.oct AC_ARG_WITH(octave, AS_HELP_STRING([--without-octave], [Disable Octave]) -AS_HELP_STRING([--with-octave=path], [Set location of Octave executable]),[ OCTAVEBIN="$withval"], [OCTAVEBIN=yes]) +AS_HELP_STRING([--with-octave=path], [Set location of Octave executable]),[OCTAVEBIN="$withval"], [OCTAVEBIN=yes]) # First, check for "--without-octave" or "--with-octave=no". if test x"${OCTAVEBIN}" = xno -o x"${with_alllang}" = xno ; then AC_MSG_NOTICE([Disabling Octave]) OCTAVE= -fi +else # First figure out what the name of Octave is @@ -790,6 +889,8 @@ else AC_MSG_RESULT(could not figure out how to run octave) fi +fi + AC_SUBST(OCTAVE) AC_SUBST(OCTAVEEXT) AC_SUBST(OCTAVE_SO) @@ -1125,7 +1226,7 @@ fi AC_MSG_CHECKING(for Ruby header files) if test -n "$RUBY"; then RUBYDIR=`($RUBY -rmkmf -e 'print Config::CONFIG[["archdir"]] || $archdir') 2>/dev/null` - if test "$RUBYDIR" != ""; then + if test x"$RUBYDIR" != x""; then dirs="$RUBYDIR" RUBYINCLUDE=none for i in $dirs; do @@ -1852,11 +1953,17 @@ AC_SUBST(SKIP_OCTAVE) SKIP_PYTHON= -if test -z "$PYINCLUDE" || test -z "$PYLIB" ; then +if (test -z "$PYINCLUDE" || test -z "$PYLIB") && + (test -z "$PY3INCLUDE" || test -z "PY3LIB") ; then SKIP_PYTHON="1" fi AC_SUBST(SKIP_PYTHON) +SKIP_PYTHON3= +if test -z "$PY3INCLUDE" || test -z "$PY3LIB" ; then + SKIP_PYTHON3="1" +fi +AC_SUBST(SKIP_PYTHON3) SKIP_JAVA= if test -z "$JAVA" || test -z "$JAVAC" || test -z "$JAVAINC" ; then From 0db7edfa6341841c9802bce8deb2b2f21af60688 Mon Sep 17 00:00:00 2001 From: Jamie Kirkpatrick Date: Fri, 12 Sep 2008 11:17:39 +0000 Subject: [PATCH 029/314] Progress towards a working pydoc implementation. - Nodes are now passed to the documentation translator so that type information can be looked up and used in parameter comments. - Class comments are now inserted as well as some method information, git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2008-cherylfoil@10838 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Source/CParse/parser.y | 9 +- Source/DoxygenTranslator/src/DoxygenEntity.h | 12 + .../src/DoxygenTranslator.cpp | 12 +- .../DoxygenTranslator/src/DoxygenTranslator.h | 5 +- .../src/JavaDocConverter.cpp | 2 +- .../DoxygenTranslator/src/JavaDocConverter.h | 10 +- .../DoxygenTranslator/src/PyDocConverter.cpp | 205 ++++++++++++++++++ Source/DoxygenTranslator/src/PyDocConverter.h | 29 +++ Source/Makefile.am | 2 + Source/Modules/java.cxx | 18 +- Source/Modules/python.cxx | 33 ++- 11 files changed, 314 insertions(+), 23 deletions(-) create mode 100644 Source/DoxygenTranslator/src/PyDocConverter.cpp create mode 100644 Source/DoxygenTranslator/src/PyDocConverter.h diff --git a/Source/CParse/parser.y b/Source/CParse/parser.y index d16a743e4..95bd8701d 100644 --- a/Source/CParse/parser.y +++ b/Source/CParse/parser.y @@ -13,7 +13,7 @@ #define yylex yylex -char cvsroot_parser_y[] = "$Id$"; +char cvsroot_parser_y[] = "$Id: parser.y 10767 2008-08-16 07:31:05Z cherylfoil $"; #include "swig.h" #include "cparse.h" @@ -3209,15 +3209,18 @@ c_constructor_decl : storage_class type LPAREN parms RPAREN ctor_end { doxygen_comment : DOXYGENSTRING { + while(Strchr($1,'/') == Char($1)) + Replace($1,"/","",DOH_REPLACE_FIRST); if(isStructuralDoxygen($1)){ $$ = new_node("doxycomm"); Setattr($$,"DoxygenComment",$1); } else { if(currentComment != 0){ - Append(currentComment, $1); + Append(currentComment,$1); } - else currentComment = $1; + else + currentComment = $1; $$ = 0; } } diff --git a/Source/DoxygenTranslator/src/DoxygenEntity.h b/Source/DoxygenTranslator/src/DoxygenEntity.h index 4313bfb2a..779065bdf 100644 --- a/Source/DoxygenTranslator/src/DoxygenEntity.h +++ b/Source/DoxygenTranslator/src/DoxygenEntity.h @@ -21,5 +21,17 @@ public: int isLeaf; }; +struct find_entity { + find_entity(string typeString) { + typeOfEntity = typeString; + } + + bool operator()(DoxygenEntity& entity) { + return entity.typeOfEntity == typeOfEntity; + } + + string typeOfEntity; +}; + #endif /*TOKENLIST_H_*/ diff --git a/Source/DoxygenTranslator/src/DoxygenTranslator.cpp b/Source/DoxygenTranslator/src/DoxygenTranslator.cpp index d6f0ae152..7fe2897c5 100644 --- a/Source/DoxygenTranslator/src/DoxygenTranslator.cpp +++ b/Source/DoxygenTranslator/src/DoxygenTranslator.cpp @@ -5,13 +5,16 @@ #include #include "DoxygenEntity.h" #include "JavaDocConverter.h" +#include "PyDocConverter.h" DoxygenParser doxyParse; JavaDocConverter jDC; +PyDocConverter pyDC; DoxygenTranslator::DoxygenTranslator(){ doxyParse = DoxygenParser(); JavaDocConverter jDC = JavaDocConverter(); + PyDocConverter pyDC = PyDocConverter(); } DoxygenTranslator::~DoxygenTranslator(){ @@ -19,13 +22,16 @@ DoxygenTranslator::~DoxygenTranslator(){ } -char *DoxygenTranslator::convert(char* doxygenBlob, char* option){ +char *DoxygenTranslator::convert(Node *n, char* doxygenBlob, char* option){ list rootList = doxyParse.createTree(string(doxygenBlob)); string returnedString; if(strcmp(option, "JAVADOC") == 0){ - returnedString = jDC.convertToJavaDoc(rootList); + returnedString = jDC.convertToJavaDoc(n, rootList); + } + else if(strcmp(option, "PYDOC") == 0){ + returnedString = pyDC.convertToPyDoc(n, rootList); } else cout << "Option not current supported.\n"; char *nonConstString; @@ -59,7 +65,7 @@ int testCommands(){ //cout << "---ORIGINAL DOXYGEN--- " << endl << exampleArray[i] << endl; char *nonConstString = (char *)malloc(exampleArray[i].length()+1); strcpy(nonConstString, exampleArray[i].c_str()); - char * result = dT.convert(nonConstString, "JAVADOC"); + char * result = dT.convert(NULL, nonConstString, "JAVADOC"); free(nonConstString); free(result); } diff --git a/Source/DoxygenTranslator/src/DoxygenTranslator.h b/Source/DoxygenTranslator/src/DoxygenTranslator.h index e5fe7bcbb..3c26e3a25 100644 --- a/Source/DoxygenTranslator/src/DoxygenTranslator.h +++ b/Source/DoxygenTranslator/src/DoxygenTranslator.h @@ -1,10 +1,13 @@ #ifndef DOXYGENTRANSLATOR_H_ #define DOXYGENTRANSLATOR_H_ + +#include "swig.h" + class DoxygenTranslator { public: DoxygenTranslator(); virtual ~DoxygenTranslator(); - char* convert(char* doxygenBlob, char* option); + char* convert(Node *n, char* doxygenBlob, char* option); }; #endif /*DOXYGENTRANSLATOR_H_*/ diff --git a/Source/DoxygenTranslator/src/JavaDocConverter.cpp b/Source/DoxygenTranslator/src/JavaDocConverter.cpp index 70c3bb731..b611cddf9 100644 --- a/Source/DoxygenTranslator/src/JavaDocConverter.cpp +++ b/Source/DoxygenTranslator/src/JavaDocConverter.cpp @@ -213,7 +213,7 @@ string translateEntity(DoxygenEntity &doxyEntity){ return ""; } -string JavaDocConverter:: convertToJavaDoc(list entityList){ +string JavaDocConverter:: convertToJavaDoc(Node *n, list entityList){ entityList.sort(compare_DoxygenEntities); diff --git a/Source/DoxygenTranslator/src/JavaDocConverter.h b/Source/DoxygenTranslator/src/JavaDocConverter.h index 53a270ce4..39de3dd15 100644 --- a/Source/DoxygenTranslator/src/JavaDocConverter.h +++ b/Source/DoxygenTranslator/src/JavaDocConverter.h @@ -1,15 +1,17 @@ - #include - #include - #include "DoxygenEntity.h" #ifndef JAVADOCCONVERTER_H_ #define JAVADOCCONVERTER_H_ +#include +#include +#include "swig.h" +#include "DoxygenEntity.h" + class JavaDocConverter { public: JavaDocConverter(); - string convertToJavaDoc(list entityList); + string convertToJavaDoc(Node *n, list entityList); ~JavaDocConverter(); void printSortedTree(list &entityList); }; diff --git a/Source/DoxygenTranslator/src/PyDocConverter.cpp b/Source/DoxygenTranslator/src/PyDocConverter.cpp new file mode 100644 index 000000000..ad675e273 --- /dev/null +++ b/Source/DoxygenTranslator/src/PyDocConverter.cpp @@ -0,0 +1,205 @@ +#include "PyDocConverter.h" +#include +#include + +#define APPROX_LINE_LENGTH 64//characters per line allowed +#define TAB_SIZE 8//characters per line allowed + +//TODO {@link} {@linkplain} {@docRoot}, and other useful doxy commands that are not a pydoc tag +PyDocConverter::PyDocConverter() +{ + debug = 1; +} + +PyDocConverter::~PyDocConverter() +{ +} + +/* Sorts entities by pyDoc standard order for commands + * NOTE: will not behave entirely properly until "First level" comments + * such as brief descriptions are TAGGED as such + */ +bool compare_DoxygenEntities(DoxygenEntity first, DoxygenEntity second); + +void PyDocConverter::printSortedTree(list &entityList){ + list::iterator p = entityList.begin(); + while (p != entityList.end()){ + (*p).printEntity(0); + p++; + } +} + +string PyDocConverter::formatParam(Node *n, DoxygenEntity &doxygenEntity) { + string result; + ParmList *plist = CopyParmList(Getattr(n, "parms")); + Parm *p = NULL; + + DoxygenEntity& paramNameEntity = *doxygenEntity.entityList.begin(); + DoxygenEntity& paramDescriptionEntity = *(++doxygenEntity.entityList.begin()); + + for (p = plist; p;) { + if(Char(Getattr(p, "name")) == paramNameEntity.data) { + std::string name = Char(Swig_name_make(n, 0, Getattr(p, "name"), 0, 0)); + std::string type = Char(Swig_name_make(n, 0, Getattr(p, "type"), 0, 0)); + + std::ostringstream parameterDocString; + + parameterDocString << std::endl << name << " (" << type << "): "; + parameterDocString << paramDescriptionEntity.data; + + result = parameterDocString.str(); + break; + } + p = Getattr(p, "tmap:in") ? Getattr(p, "tmap:in:next") : nextSibling(p); + } + + Delete(plist); + return result; +} + +string PyDocConverter::formatCommand(string unformattedLine, int indent){ + string formattedLines = "\n"; + int lastPosition = 0; + int i = 0; + int isFirstLine = 1; + while (i != -1 && i < unformattedLine.length()){ + lastPosition = i; + if (isFirstLine){ + i+=APPROX_LINE_LENGTH; + } + else i+=APPROX_LINE_LENGTH - indent*TAB_SIZE; + i = unformattedLine.find(" ", i); + + if (i > 0 && i + 1 < unformattedLine.length()){ + if (!isFirstLine) for (int j = 0; j < indent; j++) { + formattedLines.append("\t"); + } + else { + isFirstLine = 0; + } + formattedLines.append(unformattedLine.substr(lastPosition, i - lastPosition + 1)); + formattedLines.append("\n"); + + } + } + if (lastPosition < unformattedLine.length()){ + if (!isFirstLine) {for (int j = 0; j < indent; j++) {formattedLines.append("\t");}} + formattedLines.append(unformattedLine.substr(lastPosition, unformattedLine.length() - lastPosition)); + } + + return formattedLines; +} + +/* Contains the conversions for tags + * could probably be much more efficient... + */ +string PyDocConverter::pyDocFormat(DoxygenEntity &doxygenEntity){ + if(doxygenEntity.typeOfEntity.compare("partofdescription") == 0){ + return doxygenEntity.data; + } + if (doxygenEntity.typeOfEntity.compare("plainstring") == 0){ + return doxygenEntity.data; + } + else if (doxygenEntity.typeOfEntity.compare("b") == 0){ + return "" + doxygenEntity.data + ""; + } + else if (doxygenEntity.typeOfEntity.compare("c") == 0){ + return "" + doxygenEntity.data + ""; + } + else if (doxygenEntity.typeOfEntity.compare("@") == 0){ + return "@"; + } + else if (doxygenEntity.typeOfEntity.compare("\\") == 0){ + return "\\"; + } + else if (doxygenEntity.typeOfEntity.compare("<") == 0){ + return "<"; + } + else if (doxygenEntity.typeOfEntity.compare(">") == 0){ + return ">"; + } + else if (doxygenEntity.typeOfEntity.compare("&") == 0){ + return "&"; + } + else if (doxygenEntity.typeOfEntity.compare("#") == 0){ + return "#"; + } + else if (doxygenEntity.typeOfEntity.compare("%") == 0){ + return "%"; + } + else if (doxygenEntity.typeOfEntity.compare("~") == 0){ + return "~"; + } + return ""; +} + + +string PyDocConverter::translateSubtree( DoxygenEntity &doxygenEntity){ + string returnedString; + if (doxygenEntity.isLeaf){ return pyDocFormat(doxygenEntity) + " ";} + else { + returnedString += pyDocFormat(doxygenEntity); + list::iterator p = doxygenEntity.entityList.begin(); + while (p != doxygenEntity.entityList.end()){ + returnedString+= translateSubtree(*p); + p++; + } + } + return returnedString; +} + +string PyDocConverter::translateEntity(Node *n, DoxygenEntity &doxyEntity){ + if(doxyEntity.typeOfEntity.compare("partofdescription")== 0) return formatCommand(string(translateSubtree(doxyEntity)), 0); + if ((doxyEntity.typeOfEntity.compare("brief") == 0)||(doxyEntity.typeOfEntity.compare("details") == 0)){ + return formatCommand(string(translateSubtree(doxyEntity)), 0) + "\n * ";} + else if(doxyEntity.typeOfEntity.compare("plainstring")== 0 + || doxyEntity.typeOfEntity.compare("deprecated")== 0 + || doxyEntity.typeOfEntity.compare("brief")== 0) + return formatCommand(doxyEntity.data, 0) + "\n * "; + else if(doxyEntity.typeOfEntity.compare("see") == 0){ + return formatCommand(string("@" + doxyEntity.typeOfEntity + "\t\t" + translateSubtree(doxyEntity)), 2); + } + else if(doxyEntity.typeOfEntity.compare("param") == 0) { + return formatParam(n, doxyEntity); + } + else if(doxyEntity.typeOfEntity.compare("return")== 0 + || doxyEntity.typeOfEntity.compare("author")== 0 + || doxyEntity.typeOfEntity.compare("param")== 0 + || doxyEntity.typeOfEntity.compare("since")== 0 + || doxyEntity.typeOfEntity.compare("version")== 0 + || doxyEntity.typeOfEntity.compare("exception") == 0 + || doxyEntity.typeOfEntity.compare("deprecated") == 0){ + return formatCommand(string("@" + doxyEntity.typeOfEntity + "\t" + translateSubtree(doxyEntity)), 2); + } + else if(doxyEntity.typeOfEntity.compare("sa")== 0){ + return formatCommand(string("@see\t\t" + translateSubtree(doxyEntity)), 2); + } + else return formatCommand(pyDocFormat(doxyEntity), 0 ); + return ""; +} + +string PyDocConverter::convertToPyDoc(Node *n, list entityList){ + entityList.sort(compare_DoxygenEntities); + + if(debug){ + cout << "---RESORTED LIST---" << endl; + printSortedTree(entityList); + } + + string pyDocString = "\"\"\""; + + list::iterator entityIterator = entityList.begin(); + while (entityIterator != entityList.end()){ + pyDocString += translateEntity(n, *entityIterator); + entityIterator++; + } + + pyDocString += "\n\"\"\"\n"; + + if(debug){ + cout << "\n---RESULT IN PYDOC---" << endl; + cout << pyDocString; + } + + return pyDocString; +} \ No newline at end of file diff --git a/Source/DoxygenTranslator/src/PyDocConverter.h b/Source/DoxygenTranslator/src/PyDocConverter.h new file mode 100644 index 000000000..b9d813476 --- /dev/null +++ b/Source/DoxygenTranslator/src/PyDocConverter.h @@ -0,0 +1,29 @@ +#ifndef PYDOCCONVERTER_H_ +#define PYDOCCONVERTER_H_ + +#include +#include +#include "swig.h" +#include "DoxygenEntity.h" + +class PyDocConverter +{ +public: + + PyDocConverter(); + string convertToPyDoc(Node *n, list entityList); + ~PyDocConverter(); + void printSortedTree(list &entityList); + +protected: + std::string formatParam(Node *n, DoxygenEntity &doxygenEntity); + std::string formatCommand(string unformattedLine, int indent); + std::string pyDocFormat(DoxygenEntity &doxygenEntity); + std::string translateSubtree( DoxygenEntity &doxygenEntity); + std::string translateEntity(Node *n, DoxygenEntity &doxyEntity); + +private: + bool debug; +}; + +#endif /*PYDOCCONVERTER_H_*/ diff --git a/Source/Makefile.am b/Source/Makefile.am index 65b5c6f6f..bfa6b3413 100644 --- a/Source/Makefile.am +++ b/Source/Makefile.am @@ -97,6 +97,8 @@ eswig_SOURCES = CParse/cscanner.c \ DoxygenTranslator/src/DoxygenTranslator.cpp\ DoxygenTranslator/src/JavaDocConverter.h\ DoxygenTranslator/src/JavaDocConverter.cpp\ + DoxygenTranslator/src/PyDocConverter.h\ + DoxygenTranslator/src/PyDocConverter.cpp\ DoxygenTranslator/src/Token.h\ DoxygenTranslator/src/Token.cpp\ DoxygenTranslator/src/TokenList.h\ diff --git a/Source/Modules/java.cxx b/Source/Modules/java.cxx index 961f9098c..edb88ebbb 100644 --- a/Source/Modules/java.cxx +++ b/Source/Modules/java.cxx @@ -510,7 +510,7 @@ public: if (doxygen_javadoc_flag){ if (Getattr(n,"DoxygenComment")){ if(comment_creation_chatter) Printf(f_module, "/* This was generated from top() */"); - char *convertedString = doxyTranslator.convert(Char(Getattr(n,"DoxygenComment")),"JAVADOC"); + char *convertedString = doxyTranslator.convert(n, Char(Getattr(n,"DoxygenComment")),"JAVADOC"); Printf(f_module, convertedString); free(convertedString); } @@ -1238,7 +1238,7 @@ public: if (doxygen_javadoc_flag){ if (Getattr(n,"DoxygenComment")){ if(comment_creation_chatter) Printv(proxy_class_constants_code, "/* This was generated from enumvalueDeclaration */", NIL ); - char *convertedString = doxyTranslator.convert(Char(Getattr(n,"DoxygenComment")),"JAVADOC"); + char *convertedString = doxyTranslator.convert(n, Char(Getattr(n,"DoxygenComment")),"JAVADOC"); Printv(proxy_class_constants_code, convertedString, NIL); free(convertedString); } @@ -1310,7 +1310,7 @@ public: if (doxygen_javadoc_flag){ if (Getattr(n,"DoxygenComment")){ if(comment_creation_chatter) Printf(enum_code, "/* This was generated from enumvalueDeclaration() */" ); - char *convertedString = doxyTranslator.convert(Char(Getattr(n,"DoxygenComment")),"JAVADOC"); + char *convertedString = doxyTranslator.convert(n, Char(Getattr(n,"DoxygenComment")),"JAVADOC"); Printf(enum_code, convertedString); free(convertedString); } @@ -1382,7 +1382,7 @@ public: if (doxygen_javadoc_flag){ if (Getattr(n,"DoxygenComment")){ if(comment_creation_chatter) Printv(structuralComments, "/* This was generated from doxygenComment() */\n", NIL); - char *convertedString = doxyTranslator.convert(Char(Getattr(n,"DoxygenComment")),"JAVADOC"); + char *convertedString = doxyTranslator.convert(n, Char(Getattr(n,"DoxygenComment")),"JAVADOC"); Printv(structuralComments, convertedString, NIL); free(convertedString); } @@ -1412,7 +1412,7 @@ public: if (doxygen_javadoc_flag){ if (Getattr(n,"DoxygenComment")){ if(comment_creation_chatter) Printf(constants_code, "/* This was generated from enumvalueDeclaration */\n"); - char *convertedString = doxyTranslator.convert(Char(Getattr(n,"DoxygenComment")),"JAVADOC"); + char *convertedString = doxyTranslator.convert(n, Char(Getattr(n,"DoxygenComment")),"JAVADOC"); Printf(constants_code, convertedString); free(convertedString); } @@ -1683,7 +1683,7 @@ public: if (doxygen_javadoc_flag){ if (Getattr(n,"DoxygenComment")){ if(comment_creation_chatter) Printv(proxy_class_def, "/* This was generated from emitProxyClassDefAndCPPCasts() */\n", NIL ); - char *convertedString = doxyTranslator.convert(Char(Getattr(n,"DoxygenComment")),"JAVADOC"); + char *convertedString = doxyTranslator.convert(n, Char(Getattr(n,"DoxygenComment")),"JAVADOC"); Printv(proxy_class_def, convertedString, NIL); free(convertedString); } @@ -2026,7 +2026,7 @@ public: if (doxygen_javadoc_flag){ if (Getattr(n,"DoxygenComment")){ if(comment_creation_chatter) Printf(function_code, "/* This was generated from proxyclassfunctionhandler */"); - char *convertedString = doxyTranslator.convert(Char(Getattr(n,"DoxygenComment")),"JAVADOC"); + char *convertedString = doxyTranslator.convert(n, Char(Getattr(n,"DoxygenComment")),"JAVADOC"); Printf(function_code, convertedString); free(convertedString); } @@ -2258,7 +2258,7 @@ public: if (doxygen_javadoc_flag){ if (Getattr(n,"DoxygenComment")){ if(comment_creation_chatter) Printf(function_code, "/* This was generated from constructionhandler */\n" ); - char *convertedString = doxyTranslator.convert(Char(Getattr(n,"DoxygenComment")),"JAVADOC"); + char *convertedString = doxyTranslator.convert(n, Char(Getattr(n,"DoxygenComment")),"JAVADOC"); Printf(function_code, convertedString); free(convertedString); } @@ -2529,7 +2529,7 @@ public: if (doxygen_javadoc_flag){ if (Getattr(n,"DoxygenComment")){ if(comment_creation_chatter) Printf(function_code, "/* This was generated from moduleClassFunctionHandler() */\n" ); - char *convertedString = doxyTranslator.convert(Char(Getattr(n,"DoxygenComment")),"JAVADOC"); + char *convertedString = doxyTranslator.convert(n, Char(Getattr(n,"DoxygenComment")),"JAVADOC"); Printf(function_code, convertedString); free(convertedString); } diff --git a/Source/Modules/python.cxx b/Source/Modules/python.cxx index 7a878b4f8..ba02eae2e 100644 --- a/Source/Modules/python.cxx +++ b/Source/Modules/python.cxx @@ -7,7 +7,7 @@ * Python language module for SWIG. * ----------------------------------------------------------------------------- */ -char cvsroot_python_cxx[] = "$Id$"; +char cvsroot_python_cxx[] = "$Id: python.cxx 10453 2008-05-15 21:18:44Z wsfulton $"; #include "swigmod.h" #define ctab2 " " @@ -18,6 +18,7 @@ char cvsroot_python_cxx[] = "$Id$"; static int treduce = SWIG_cparse_template_reduce(0); #include +#include "../DoxygenTranslator/src/DoxygenTranslator.h" #define PYSHADOW_MEMBER 0x2 @@ -70,6 +71,7 @@ static int buildnone = 0; static int nobuildnone = 0; static int safecstrings = 0; static int dirvtable = 0; +static int doxygen = 1; static int proxydel = 1; static int fastunpack = 0; static int fastproxy = 0; @@ -83,6 +85,8 @@ static int extranative = 0; static int outputtuple = 0; static int nortti = 0; +static DoxygenTranslator doxyTranslator; + /* flags for the make_autodoc function */ enum autodoc_t { AUTODOC_CLASS, @@ -103,6 +107,7 @@ Python Options (available with -python)\n\ -classptr - Generate shadow 'ClassPtr' as in older swig versions\n\ -cppcast - Enable C++ casting operators (default) \n\ -dirvtable - Generate a pseudo virtual table for directors for faster dispatch \n\ + -doxygen - Convert C++ doxygen comments to pydoc comments in proxy classes \n\ -extranative - Return extra native C++ wraps for std containers when possible \n\ -fastinit - Use fast init mechanism for classes (default)\n\ -fastunpack - Use fast unpack mechanism to parse the argument functions \n\ @@ -324,6 +329,9 @@ public: } else if (strcmp(argv[i], "-dirvtable") == 0) { dirvtable = 1; Swig_mark_arg(i); + } else if (strcmp(argv[i], "-doxygen") == 0) { + doxygen = 1; + Swig_mark_arg(i); } else if (strcmp(argv[i], "-nodirvtable") == 0) { dirvtable = 0; Swig_mark_arg(i); @@ -2898,11 +2906,24 @@ public: } } Printf(f_shadow, ":\n"); - if (have_docstring(n)) { + + //translate and write pydoc comment if flagged + if (doxygen){ + if (Getattr(n,"DoxygenComment")){ + //if(comment_creation_chatter) Printf(function_code, "/* This was generated from classHandler */"); + char *convertedString = doxyTranslator.convert(n, Char(Getattr(n,"DoxygenComment")), "PYDOC"); + Printf(f_shadow, Char(pythoncode(convertedString, shadow_indent))); + free(convertedString); + } + } + + // otherwise use default docstrings if requested + else if (have_docstring(n)) { String *str = docstring(n, AUTODOC_CLASS, tab4); if (str != NULL && Len(str)) Printv(f_shadow, tab4, str, "\n", NIL); } + if (!modern) { Printv(f_shadow, tab4, "__swig_setmethods__ = {}\n", NIL); if (Len(base_class)) { @@ -3109,6 +3130,14 @@ public: } else { Printv(f_shadow, tab4, "def ", symname, "(",parms , ")", returnTypeAnnotation(n), ":", NIL); Printv(f_shadow, "\n", NIL); + if (doxygen) { + if (Getattr(n,"DoxygenComment")){ + //if(comment_creation_chatter) Printf(function_code, "/* This was generated from classHandler */"); + char *convertedString = doxyTranslator.convert(n, Char(Getattr(n,"DoxygenComment")), "PYDOC"); + Printf(f_shadow, Char(pythoncode(convertedString, tab8))); + free(convertedString); + } + } if (have_docstring(n)) Printv(f_shadow, tab8, docstring(n, AUTODOC_METHOD, tab8), "\n", NIL); if (have_pythonprepend(n)) { From d12b8bc06ecf87f07a1961b976b077747501b423 Mon Sep 17 00:00:00 2001 From: Jamie Kirkpatrick Date: Fri, 12 Sep 2008 11:18:35 +0000 Subject: [PATCH 030/314] Remove "using std" clause and use namespaces properly. Minor refactoring as well. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2008-cherylfoil@10839 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- .../DoxygenTranslator/src/DoxygenEntity.cpp | 176 +++++++-- Source/DoxygenTranslator/src/DoxygenEntity.h | 55 +-- .../DoxygenTranslator/src/DoxygenParser.cpp | 272 +++++++------- Source/DoxygenTranslator/src/DoxygenParser.h | 6 +- .../src/DoxygenTranslator.cpp | 77 +--- .../src/JavaDocConverter.cpp | 343 +++++++----------- .../DoxygenTranslator/src/JavaDocConverter.h | 9 +- .../DoxygenTranslator/src/PyDocConverter.cpp | 336 +++++++++-------- Source/DoxygenTranslator/src/PyDocConverter.h | 21 +- 9 files changed, 638 insertions(+), 657 deletions(-) diff --git a/Source/DoxygenTranslator/src/DoxygenEntity.cpp b/Source/DoxygenTranslator/src/DoxygenEntity.cpp index a2faf67db..dcca1d032 100644 --- a/Source/DoxygenTranslator/src/DoxygenEntity.cpp +++ b/Source/DoxygenTranslator/src/DoxygenEntity.cpp @@ -1,19 +1,24 @@ +/* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * + * python.cxx + * + * Part of the Doxygen comment translation module of SWIG. + * ----------------------------------------------------------------------------- */ + #include "DoxygenEntity.h" -#include #include -/* Little data class for Doxygen Commands */ - -/* Basic node for commands that have - * nothing after them - * example: \n +/* + * Basic node for commands that have nothing after them (eg: \n) */ -string commandArray2[] = {"a", "addindex", "addtogroup", "anchor", "arg", "attention", +std::string DoxygenEntity::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", + "std::endlatexonly", "std::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", @@ -24,19 +29,9 @@ string commandArray2[] = {"a", "addindex", "addtogroup", "anchor", "arg", "atten "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), "&", "~", "<", ">", "#", "%"}; + "$", "@", std::string(1, 92), "&", "~", "<", ">", "#", "%"}; -string findCommand(int commandNum){ - - int arraySize = sizeof(commandArray2)/sizeof(*commandArray2); - if (commandNum - 101 >= 0 && commandNum - 101 < arraySize){ - return commandArray2[commandNum - 101]; - } - - return "" ; -} - -DoxygenEntity::DoxygenEntity(string typeEnt){ +DoxygenEntity::DoxygenEntity(std::string typeEnt){ typeOfEntity = typeEnt; data = ""; isLeaf = 1; @@ -45,9 +40,9 @@ DoxygenEntity::DoxygenEntity(string typeEnt){ /* Basic node for commands that have * only 1 thing after them * example: \b word - * OR holding a string + * OR holding a std::string */ -DoxygenEntity::DoxygenEntity(string typeEnt, string param1){ +DoxygenEntity::DoxygenEntity(std::string typeEnt, std::string param1){ typeOfEntity = typeEnt; data = param1; isLeaf = 1; @@ -56,26 +51,25 @@ DoxygenEntity::DoxygenEntity(string typeEnt, string param1){ /* Nonterminal node * contains */ -DoxygenEntity::DoxygenEntity(string typeEnt, list &entList ){ +DoxygenEntity::DoxygenEntity(std::string typeEnt, std::list &entList ){ typeOfEntity = typeEnt; data = ""; isLeaf = 0; entityList = entList; } - void DoxygenEntity::printEntity(int level){ int thisLevel = level; if (isLeaf) { - for (int i = 0; i < thisLevel; i++) {cout << "\t";} - cout << "Node Command: " << typeOfEntity << " "; - if (data.compare("") != 0) cout << "Node Data: " << data; - cout << endl; + for (int i = 0; i < thisLevel; i++) {std::cout << "\t";} + std::cout << "Node Command: " << typeOfEntity << " "; + if (data.compare("") != 0) std::cout << "Node Data: " << data; + std::cout << std::endl; } else{ - for (int i = 0; i < thisLevel; i++) {cout << "\t";} - cout << "Node Command : " << typeOfEntity << endl; - list::iterator p = entityList.begin(); + for (int i = 0; i < thisLevel; i++) {std::cout << "\t";} + std::cout << "Node Command : " << typeOfEntity << std::endl; + std::list::iterator p = entityList.begin(); thisLevel++; while (p != entityList.end()){ (*p).printEntity(thisLevel); @@ -84,6 +78,122 @@ void DoxygenEntity::printEntity(int level){ } } -DoxygenEntity::~DoxygenEntity() -{ +bool CompareDoxygenEntities::operator()(DoxygenEntity& first, DoxygenEntity& second){ + if(first.typeOfEntity.compare("brief") == 0) + return true; + if(second.typeOfEntity.compare("brief") == 0) + return false; + if(first.typeOfEntity.compare("details") == 0) + return true; + if(second.typeOfEntity.compare("details") == 0) + return false; + if(first.typeOfEntity.compare("partofdescription") == 0) + return true; + if(first.typeOfEntity.compare("partofdescription") == 0) + return false; + if(first.typeOfEntity.compare("plainstd::string") == 0) + return true; + if(second.typeOfEntity.compare("plainstd::string") == 0) + return false; + if(first.typeOfEntity.compare("param") == 0){ + if(second.typeOfEntity.compare("param")== 0) + return true; + if(second.typeOfEntity.compare("return")== 0) + return true; + if(second.typeOfEntity.compare("exception")== 0) + return true; + if(second.typeOfEntity.compare("author")== 0) + return true; + if(second.typeOfEntity.compare("version")== 0) + return true; + if(second.typeOfEntity.compare("see")== 0) + return true; + if(second.typeOfEntity.compare("since")== 0) + return true; + if(second.typeOfEntity.compare("deprecated")== 0) + return true; + return false; + } + if(first.typeOfEntity.compare("return")== 0){ + if(second.typeOfEntity.compare("return")== 0) + return true; + if(second.typeOfEntity.compare("exception")== 0) + return true; + if(second.typeOfEntity.compare("author")== 0) + return true; + if(second.typeOfEntity.compare("version")== 0) + return true; + if(second.typeOfEntity.compare("see")== 0) + return true; + if(second.typeOfEntity.compare("since")== 0) + return true; + if(second.typeOfEntity.compare("deprecated")== 0 + )return true; + return false; + } + if(first.typeOfEntity.compare("exception")== 0){ + if(second.typeOfEntity.compare("exception")== 0) + return true; + if(second.typeOfEntity.compare("author")== 0) + return true; + if(second.typeOfEntity.compare("version")== 0) + return true; + if(second.typeOfEntity.compare("see")== 0) + return true; + if(second.typeOfEntity.compare("since")== 0) + return true; + if(second.typeOfEntity.compare("deprecated")== 0) + return true; + return false; + } + if(first.typeOfEntity.compare("author")== 0){ + if(second.typeOfEntity.compare("author")== 0) + return true; + if(second.typeOfEntity.compare("version")== 0) + return true; + if(second.typeOfEntity.compare("see")== 0) + return true; + if(second.typeOfEntity.compare("since")== 0) + return true; + if(second.typeOfEntity.compare("deprecated")== 0) + return true; + return false; + } + if(first.typeOfEntity.compare("version")== 0){ + if(second.typeOfEntity.compare("version")== 0) + return true; + if(second.typeOfEntity.compare("see")== 0) + return true; + if(second.typeOfEntity.compare("since")== 0) + return true; + if(second.typeOfEntity.compare("deprecated")== 0) + return true; + return false; + } + if(first.typeOfEntity.compare("see")== 0 || first.typeOfEntity.compare("sa")== 0){ + if(second.typeOfEntity.compare("see")== 0) + return true; + if(second.typeOfEntity.compare("sa")== 0) + return true; + if(second.typeOfEntity.compare("since")== 0) + return true; + if(second.typeOfEntity.compare("deprecated")== 0) + return true; + return false; + } + if(first.typeOfEntity.compare("since")== 0){ + if(second.typeOfEntity.compare("since")== 0) + return true; + if(second.typeOfEntity.compare("deprecated")== 0) + return true; + return false; + } + if(first.typeOfEntity.compare("deprecated")== 0){ + if(second.typeOfEntity.compare("deprecated")== 0) + return true; + return false; + } + return true; } + + diff --git a/Source/DoxygenTranslator/src/DoxygenEntity.h b/Source/DoxygenTranslator/src/DoxygenEntity.h index 779065bdf..3bec0bb0c 100644 --- a/Source/DoxygenTranslator/src/DoxygenEntity.h +++ b/Source/DoxygenTranslator/src/DoxygenEntity.h @@ -1,37 +1,40 @@ +/* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * + * python.cxx + * + * Part of the Doxygen comment translation module of SWIG. + * ----------------------------------------------------------------------------- */ + #ifndef DOXYGENENTITY_H_ #define DOXYGENENTITY_H_ - #include #include -using namespace std; - -class DoxygenEntity{ - -public: - DoxygenEntity(string typeEnt); - DoxygenEntity(string typeEnt, string param1); - DoxygenEntity(string typeEnt, list &entList ); - ~DoxygenEntity(); - void printEntity(int level); - string typeOfEntity; - list entityList; - string data; - int isLeaf; +/* + * Structure to represent a doxygen comment entry + */ +struct DoxygenEntity{ + DoxygenEntity(std::string typeEnt); + DoxygenEntity(std::string typeEnt, std::string param1); + DoxygenEntity(std::string typeEnt, std::list &entList ); + void printEntity(int level); + std::string typeOfEntity; + std::list entityList; + std::string data; + int isLeaf; + static std::string commandArray[]; }; -struct find_entity { - find_entity(string typeString) { - typeOfEntity = typeString; - } - - bool operator()(DoxygenEntity& entity) { - return entity.typeOfEntity == typeOfEntity; - } - - string typeOfEntity; +/* + * Functor that sorts entities by javaDoc standard order for commands. + * NOTE: will not behave entirely properly until "First level" comments + * such as brief descriptions are TAGGED as such + */ +struct CompareDoxygenEntities { + bool operator()(DoxygenEntity& first, DoxygenEntity& second); }; - #endif /*TOKENLIST_H_*/ diff --git a/Source/DoxygenTranslator/src/DoxygenParser.cpp b/Source/DoxygenTranslator/src/DoxygenParser.cpp index d953bc6d4..ba624239a 100644 --- a/Source/DoxygenTranslator/src/DoxygenParser.cpp +++ b/Source/DoxygenTranslator/src/DoxygenParser.cpp @@ -19,8 +19,6 @@ #define PARAGRAPH_END 102 #define PLAINSTRING 103 #define COMMAND 104 -using namespace std; - DoxygenParser::DoxygenParser() { @@ -32,13 +30,13 @@ DoxygenParser::~DoxygenParser() ////////////////////////////////////////// int noisy = 0; // set this to 1 for extra chatter from the parsing stage. -int addCommand(string currCommand, TokenList &tokList, list &aNewList); -list parse(list::iterator endParsingIndex, TokenList &tokList); +int addCommand(std::string currCommand, TokenList &tokList, std::list &aNewList); +std::list parse(std::list::iterator endParsingIndex, TokenList &tokList); ////////////////////////////////////////// -string commandArray[] = {"a", "addindex", "addtogroup", "anchor", "arg", "attention", +std::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", @@ -57,49 +55,49 @@ string commandArray[] = {"a", "addindex", "addtogroup", "anchor", "arg", "attent "$", "@", "\\","&", "~", "<", ">", "#", "%"}; -string sectionIndicators[] = { "attention", "author", "brief", "bug", "cond", "date", "deprecated", "details", +std::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" }; /* All of the doxygen commands divided up by how they are parsed */ -string simpleCommands[] = {"n", "$", "@", "\\", "&", "~", "<", ">", "#", "%"}; -string ignoredSimpleCommands[] = {"nothing at the moment"}; -string commandWords[] = {"a", "b", "c", "e", "em", "p", "def", "enum", "example", "package", +std::string simpleCommands[] = {"n", "$", "@", "\\", "&", "~", "<", ">", "#", "%"}; +std::string ignoredSimpleCommands[] = {"nothing at the moment"}; +std::string commandWords[] = {"a", "b", "c", "e", "em", "p", "def", "enum", "example", "package", "relates", "namespace", "relatesalso","anchor", "dontinclude", "include", "includelineno"}; -string ignoredCommandWords[] = {"copydoc", "copybrief", "copydetails", "verbinclude", "htmlinclude"}; -string commandLines[] = {"addindex", "fn", "name", "line", "var", "skipline", "typedef", "skip", "until", "property"}; -string ignoreCommandLines[] = {"nothing at the moment"}; -string commandParagraph[] = {"partofdescription", "return", "remarks", "since", "test", "sa", "see", "pre", "post", "details", "invariant", +std::string ignoredCommandWords[] = {"copydoc", "copybrief", "copydetails", "verbinclude", "htmlinclude"}; +std::string commandLines[] = {"addindex", "fn", "name", "line", "var", "skipline", "typedef", "skip", "until", "property"}; +std::string ignoreCommandLines[] = {"nothing at the moment"}; +std::string commandParagraph[] = {"partofdescription", "return", "remarks", "since", "test", "sa", "see", "pre", "post", "details", "invariant", "deprecated", "date", "note", "warning", "version", "todo", "bug", "attention", "brief", "author"}; -string ignoreCommandParagraphs[] = {"nothing at the moment"}; -string commandEndCommands[] = {"code", "dot", "msc", "f$", "f[", "f{environment}{", "htmlonly", "latexonly", "manonly", +std::string ignoreCommandParagraphs[] = {"nothing at the moment"}; +std::string commandEndCommands[] = {"code", "dot", "msc", "f$", "f[", "f{environment}{", "htmlonly", "latexonly", "manonly", "verbatim", "xmlonly", "cond", "if", "ifnot", "link"}; -string commandWordParagraphs[] = {"param", "tparam", "throw", "retval", "exception"}; -string commandWordLines[] = {"page", "subsection", "subsubsection", "section", "paragraph", "defgroup"}; -string commandWordOWordOWords [] = {"category", "class", "protocol", "interface", "struct", "union"}; -string commandOWords[] = {"dir", "file", "cond"}; -string commandErrorThrowings[] = {"annotatedclasslist", "classhierarchy", "define", "functionindex", "header", - "headerfilelist", "inherit", "l", "postheader", "private", "privatesection", "protected", +std::string commandWordParagraphs[] = {"param", "tparam", "throw", "retval", "exception"}; +std::string commandWordLines[] = {"page", "subsection", "subsubsection", "section", "paragraph", "defgroup"}; +std::string commandWordOWordOWords [] = {"category", "class", "protocol", "interface", "struct", "union"}; +std::string commandOWords[] = {"dir", "file", "cond"}; +std::string commandErrorThrowings[] = {"annotatedclassstd::list", "classhierarchy", "define", "functionindex", "header", + "headerfilestd::list", "inherit", "l", "postheader", "private", "privatesection", "protected", "protectedsection", "public", "publicsection", "endcode", "enddot", "endmsc", "endhtmlonly", "endlatexonly", "endmanonly", "endlink", "endverbatim", "endxmlonly", "f]", "f}", "endcond", "endif"}; -string commandUniques[] = {"xrefitem", "arg", "ingroup", "par", "headerfile", "overload", "weakgroup", "ref", +std::string commandUniques[] = {"xrefitem", "arg", "ingroup", "par", "headerfile", "overload", "weakgroup", "ref", "subpage", "dotfile", "image", "addtogroup", "li"}; -/* Changes a string to all lower case */ -string StringToLower(string stringToConvert){ +/* Changes a std::string to all lower case */ +std::string StringToLower(std::string stringToConvert){ for(unsigned int i=0;i &rootList){ - list::iterator p = rootList.begin(); +void printTree( std::list &rootList){ + std::list::iterator p = rootList.begin(); while (p != rootList.end()){ (*p).printEntity(0); p++; @@ -136,8 +134,8 @@ void printTree( list &rootList){ /* Determines how a command should be handled (what group it belongs to * for parsing rules */ -int commandBelongs(string theCommand){ - string smallString = StringToLower(theCommand); +int commandBelongs(std::string theCommand){ + std::string smallString = StringToLower(theCommand); //cout << " Looking for command " << theCommand << endl; int i = 0; for ( i = 0; i < sizeof(simpleCommands)/sizeof(*simpleCommands); i++){ @@ -189,10 +187,10 @@ int commandBelongs(string theCommand){ } /* Returns the next word ON THE CURRENT LINE ONLY - * if a new line is encountered, returns a blank string. + * if a new line is encountered, returns a blank std::string. * Updates the index it is given if success. */ -string getNextWord(TokenList &tokList){ +std::string getNextWord(TokenList &tokList){ Token nextToken = tokList.peek(); if (nextToken.tokenType == PLAINSTRING ){ nextToken = tokList.next(); @@ -204,8 +202,8 @@ string getNextWord(TokenList &tokList){ /* Returns the location of the end of the line as * an iterator. */ -list::iterator getOneLine(TokenList &tokList){ - list::iterator endOfLine = tokList.iteratorCopy(); +std::list::iterator getOneLine(TokenList &tokList){ + std::list::iterator endOfLine = tokList.iteratorCopy(); while(endOfLine!= tokList.end()){ if ((* endOfLine).tokenType == END_LINE){ //cout << "REACHED END" << endl; @@ -219,11 +217,11 @@ list::iterator getOneLine(TokenList &tokList){ return tokList.end(); } -/* Returns a properly formatted string +/* Returns a properly formatted std::string * up til ANY command or end of line is encountered. */ -string getStringTilCommand(TokenList &tokList){ - string description; +std::string getStringTilCommand(TokenList &tokList){ + std::string description; if (tokList.peek().tokenType == 0) return ""; while(tokList.peek().tokenType == PLAINSTRING){ Token currentToken = tokList.next(); @@ -234,13 +232,13 @@ string getStringTilCommand(TokenList &tokList){ return description; } -/* Returns a properly formatted string +/* Returns a properly formatted std::string * up til the command specified is encountered */ //TODO check that this behaves properly for formulas -string getStringTilEndCommand(string theCommand, TokenList &tokList){ - string description; +std::string getStringTilEndCommand(std::string theCommand, TokenList &tokList){ + std::string description; if (tokList.peek().tokenType == 0) return ""; while(tokList.peek().tokenString.compare(theCommand) != 0 ){ Token currentToken = tokList.next(); @@ -253,8 +251,8 @@ string getStringTilEndCommand(string theCommand, TokenList &tokList){ * Paragraph is defined in Doxygen to be a paragraph of text * seperate by either a structural command or a blank line */ -list::iterator getEndOfParagraph(TokenList &tokList){ - list::iterator endOfParagraph = tokList.iteratorCopy(); +std::list::iterator getEndOfParagraph(TokenList &tokList){ + std::list::iterator endOfParagraph = tokList.iteratorCopy(); while(endOfParagraph != tokList.end()){ if ((* endOfParagraph).tokenType == END_LINE){ endOfParagraph++; @@ -278,10 +276,10 @@ list::iterator getEndOfParagraph(TokenList &tokList){ /* Returns the end of a section, defined as the first blank line OR first encounter of the same * command. Example of this behaviour is \arg -* if no end is encountered, returns the last token of the list. +* if no end is encountered, returns the last token of the std::list. */ -list::iterator getEndOfSection(string theCommand, TokenList &tokList){ - list::iterator endOfParagraph = tokList.iteratorCopy(); +std::list::iterator getEndOfSection(std::string theCommand, TokenList &tokList){ + std::list::iterator endOfParagraph = tokList.iteratorCopy(); while(endOfParagraph != tokList.end()){ if ((* endOfParagraph).tokenType == COMMAND){ if(theCommand.compare((*endOfParagraph).tokenString) == 0) return endOfParagraph; @@ -305,10 +303,10 @@ list::iterator getEndOfSection(string theCommand, TokenList &tokList){ * that begins with a \command and ends in \endcommand * such as \code and \endcode. The proper usage is * progressTilEndCommand("endcode", tokenList); - * If the end is never encountered, it returns the end of the list. + * If the end is never encountered, it returns the end of the std::list. */ -list::iterator getEndCommand(string theCommand, TokenList &tokList){ - list::iterator endOfCommand = tokList.iteratorCopy(); +std::list::iterator getEndCommand(std::string theCommand, TokenList &tokList){ + std::list::iterator endOfCommand = tokList.iteratorCopy(); while (endOfCommand!= tokList.end()){ if ((*endOfCommand).tokenType == COMMAND){ if (theCommand.compare((* endOfCommand).tokenString) == 0){ @@ -324,8 +322,8 @@ list::iterator getEndCommand(string theCommand, TokenList &tokList){ /* A specialty method for commands such as \arg that end at the end of a paragraph OR when another \arg is encountered */ //TODO getTilAnyCommand -list::iterator getTilAnyCommand(string theCommand, TokenList &tokList){ - list::iterator anIterator; +std::list::iterator getTilAnyCommand(std::string theCommand, TokenList &tokList){ + std::list::iterator anIterator; return anIterator; } @@ -337,7 +335,7 @@ list::iterator getTilAnyCommand(string theCommand, TokenList &tokList){ * Plain commands, such as newline etc, they contain no other data * \n \\ \@ \& \$ \# \< \> \% */ - int addSimpleCommand(string theCommand, list &doxyList){ + int addSimpleCommand(std::string theCommand, std::list &doxyList){ if (noisy) cout << "Parsing " << theCommand << endl; doxyList.push_back(DoxygenEntity(theCommand)); return 1; @@ -347,7 +345,7 @@ list::iterator getTilAnyCommand(string theCommand, TokenList &tokList){ * Format: @command * Plain commands, such as newline etc, they contain no other data */ - int ignoreSimpleCommand(string theCommand, list &doxyList){ + int ignoreSimpleCommand(std::string theCommand, std::list &doxyList){ if (noisy) cout << "Not Adding " << theCommand << endl; return 1; } @@ -358,9 +356,9 @@ list::iterator getTilAnyCommand(string theCommand, TokenList &tokList){ * "a", "b", "c", "e", "em", "p", "def", "enum", "example", "package", * "relates", "namespace", "relatesalso","anchor", "dontinclude", "include", "includelineno" */ - int addCommandWord(string theCommand, TokenList &tokList, list &doxyList){ + int addCommandWord(std::string theCommand, TokenList &tokList, std::list &doxyList){ if (noisy) cout << "Parsing " << theCommand << endl; - string name = getNextWord(tokList); + std::string name = getNextWord(tokList); if (!name.empty()){ doxyList.push_back(DoxygenEntity(theCommand, name)); return 1; @@ -374,9 +372,9 @@ list::iterator getTilAnyCommand(string theCommand, TokenList &tokList){ * Commands with a single WORD after then such as @b * "copydoc", "copybrief", "copydetails", "verbinclude", "htmlinclude" */ - int ignoreCommandWord(string theCommand, TokenList &tokList, list &doxyList){ + int ignoreCommandWord(std::string theCommand, TokenList &tokList, std::list &doxyList){ if (noisy) cout << "Not Adding " << theCommand << endl; - string name = getNextWord(tokList); + std::string name = getNextWord(tokList); if (!name.empty()){ return 1; } @@ -389,10 +387,10 @@ list::iterator getTilAnyCommand(string theCommand, TokenList &tokList){ * Commands with a single LINE after then such as @var * "addindex", "fn", "name", "line", "var", "skipline", "typedef", "skip", "until", "property" */ - int addCommandLine(string theCommand, TokenList &tokList, list &doxyList){ + int addCommandLine(std::string theCommand, TokenList &tokList, std::list &doxyList){ if (noisy) cout << "Parsing " << theCommand << endl; - list::iterator endOfLine = getOneLine(tokList); - list aNewList; + std::list::iterator endOfLine = getOneLine(tokList); + std::list aNewList; aNewList = parse(endOfLine, tokList); doxyList.push_back( DoxygenEntity(theCommand, aNewList)); return 1; @@ -403,9 +401,9 @@ list::iterator getTilAnyCommand(string theCommand, TokenList &tokList){ * Commands with a single LINE after then such as @var * */ - int ignoreCommandLine(string theCommand, TokenList &tokList, list &doxyList){ + int ignoreCommandLine(std::string theCommand, TokenList &tokList, std::list &doxyList){ if (noisy) cout << "Not Adding " << theCommand << endl; - list::iterator endOfLine = getOneLine(tokList); + std::list::iterator endOfLine = getOneLine(tokList); tokList.setIterator(endOfLine); return 1; } @@ -416,10 +414,10 @@ list::iterator getTilAnyCommand(string theCommand, TokenList &tokList){ * "return", "remarks", "since", "test", "sa", "see", "pre", "post", "details", "invariant", * "deprecated", "date", "note", "warning", "version", "todo", "bug", "attention", "brief", "arg", "author" */ - int addCommandParagraph(string theCommand, TokenList &tokList, list &doxyList){ + int addCommandParagraph(std::string theCommand, TokenList &tokList, std::list &doxyList){ if (noisy) cout << "Parsing " << theCommand << endl; - list::iterator endOfParagraph = getEndOfParagraph(tokList); - list aNewList; + std::list::iterator endOfParagraph = getEndOfParagraph(tokList); + std::list aNewList; aNewList = parse(endOfParagraph, tokList); doxyList.push_back( DoxygenEntity(theCommand, aNewList)); return 1; @@ -430,9 +428,9 @@ list::iterator getTilAnyCommand(string theCommand, TokenList &tokList){ * Commands with a single LINE after then such as @var * */ - int ignoreCommandParagraph(string theCommand, TokenList &tokList, list &doxyList){ + int ignoreCommandParagraph(std::string theCommand, TokenList &tokList, std::list &doxyList){ if (noisy) cout << "Not Adding " << theCommand << endl; - list::iterator endOfParagraph = getEndOfParagraph(tokList); + std::list::iterator endOfParagraph = getEndOfParagraph(tokList); tokList.setIterator(endOfParagraph); return 1; } @@ -444,9 +442,9 @@ list::iterator getTilAnyCommand(string theCommand, TokenList &tokList){ * "verbatim", "xmlonly", "cond", "if", "ifnot", "link" * Returns 1 if success, 0 if the endcommand is never encountered. */ - int addCommandEndCommand(string theCommand, TokenList &tokList, list &doxyList){ + int addCommandEndCommand(std::string theCommand, TokenList &tokList, std::list &doxyList){ if (noisy) cout << "Not Adding " << theCommand << endl; - string description = getStringTilEndCommand( "end" + theCommand, tokList); + std::string description = getStringTilEndCommand( "end" + theCommand, tokList); doxyList.push_back(DoxygenEntity(theCommand, description)); return 1; } @@ -456,17 +454,17 @@ list::iterator getTilAnyCommand(string theCommand, TokenList &tokList){ * Commands such as param * "param", "tparam", "throw", "retval", "exception" */ - int addCommandWordParagraph(string theCommand, TokenList &tokList, list &doxyList){ + int addCommandWordParagraph(std::string theCommand, TokenList &tokList, std::list &doxyList){ if (noisy) cout << "Parsing " << theCommand << endl; - string name = getNextWord(tokList); + std::string name = getNextWord(tokList); if (name.empty()){ cout << "No word followed " << theCommand << " command. Not added" << endl; return 0; } - list::iterator endOfParagraph = getEndOfParagraph(tokList); - list aNewList; + std::list::iterator endOfParagraph = getEndOfParagraph(tokList); + std::list aNewList; aNewList = parse(endOfParagraph, tokList); - aNewList.push_front(DoxygenEntity("plainstring", name)); + aNewList.push_front(DoxygenEntity("plainstd::string", name)); doxyList.push_back(DoxygenEntity(theCommand, aNewList)); return 1; } @@ -476,17 +474,17 @@ list::iterator getTilAnyCommand(string theCommand, TokenList &tokList){ * Commands such as param * "page", "subsection", "subsubsection", "section", "paragraph", "defgroup" */ - int addCommandWordLine(string theCommand, TokenList &tokList, list &doxyList){ + int addCommandWordLine(std::string theCommand, TokenList &tokList, std::list &doxyList){ if (noisy) cout << "Parsing " << theCommand << endl; - string name = getNextWord(tokList); + std::string name = getNextWord(tokList); if (name.empty()){ cout << "No word followed " << theCommand << " command. Not added" << endl; return 0; } - list::iterator endOfLine = getOneLine(tokList); - list aNewList; + std::list::iterator endOfLine = getOneLine(tokList); + std::list aNewList; aNewList = parse(endOfLine, tokList); - aNewList.push_front(DoxygenEntity("plainstring", name)); + aNewList.push_front(DoxygenEntity("plainstd::string", name)); doxyList.push_back(DoxygenEntity(theCommand, aNewList)); return 1; @@ -498,19 +496,19 @@ list::iterator getTilAnyCommand(string theCommand, TokenList &tokList){ * Commands such as class * "category", "class", "protocol", "interface", "struct", "union" */ - int addCommandWordOWordOWord(string theCommand, TokenList &tokList, list &doxyList){ + int addCommandWordOWordOWord(std::string theCommand, TokenList &tokList, std::list &doxyList){ if (noisy) cout << "Parsing " << theCommand << endl; - string name = getNextWord(tokList); + std::string name = getNextWord(tokList); if (name.empty()){ cout << "No word followed " << theCommand << " command. Not added" << endl; return 0; } - string headerfile = getNextWord(tokList); - string headername = getNextWord(tokList); - list aNewList; - aNewList.push_back(DoxygenEntity("plainstring", name)); - if (!headerfile.empty()) aNewList.push_back(DoxygenEntity("plainstring", headerfile)); - if (!headername.empty()) aNewList.push_back(DoxygenEntity("plainstring", headername)); + std::string headerfile = getNextWord(tokList); + std::string headername = getNextWord(tokList); + std::list aNewList; + aNewList.push_back(DoxygenEntity("plainstd::string", name)); + if (!headerfile.empty()) aNewList.push_back(DoxygenEntity("plainstd::string", headerfile)); + if (!headername.empty()) aNewList.push_back(DoxygenEntity("plainstd::string", headername)); doxyList.push_back(DoxygenEntity(theCommand, aNewList)); return 1; } @@ -520,9 +518,9 @@ list::iterator getTilAnyCommand(string theCommand, TokenList &tokList){ * Commands such as dir * "dir", "file", "cond" */ - int addCommandOWord(string theCommand, TokenList &tokList, list &doxyList){ + int addCommandOWord(std::string theCommand, TokenList &tokList, std::list &doxyList){ if (noisy) cout << "Parsing " << theCommand << endl; - string name = getNextWord(tokList); + std::string name = getNextWord(tokList); doxyList.push_back(DoxygenEntity(theCommand, name)); return 1; } @@ -530,47 +528,47 @@ list::iterator getTilAnyCommand(string theCommand, TokenList &tokList){ /* Commands that should not be encountered (such as PHP only) * goes til the end of line then returns */ - int addCommandErrorThrow(string theCommand, TokenList &tokList, list &doxyList){ + int addCommandErrorThrow(std::string theCommand, TokenList &tokList, std::list &doxyList){ cout << "Encountered :" << theCommand << endl; cout << "This command should not have been encountered. Behaviour past this may be unpredictable " << endl; - list::iterator endOfLine = getOneLine(tokList); + std::list::iterator endOfLine = getOneLine(tokList); tokList.setIterator(endOfLine); return 0; } /* Adds the unique commands- different process for each unique command */ - int addCommandUnique(string theCommand, TokenList &tokList, list &doxyList){ - list aNewList; + int addCommandUnique(std::string theCommand, TokenList &tokList, std::list &doxyList){ + std::list aNewList; if (theCommand.compare("arg") == 0 || theCommand.compare("li") == 0){ - list::iterator endOfSection = getEndOfSection(theCommand, tokList); - list aNewList; + std::list::iterator endOfSection = getEndOfSection(theCommand, tokList); + std::list aNewList; aNewList = parse(endOfSection, tokList); doxyList.push_back( DoxygenEntity(theCommand, aNewList)); } - // \xrefitem "(heading)" "(list title)" {text} + // \xrefitem "(heading)" "(std::list title)" {text} else if (theCommand.compare("xrefitem") == 0){ //TODO Implement xrefitem if (noisy) cout << "Not Adding " << theCommand << endl; - list::iterator endOfParagraph = getEndOfParagraph(tokList); + std::list::iterator endOfParagraph = getEndOfParagraph(tokList); tokList.setIterator(endOfParagraph); return 1; } // \ingroup ( [ ]) else if (theCommand.compare("ingroup") == 0){ - string name = getNextWord(tokList); - aNewList.push_back(DoxygenEntity("plainstring", name)); + std::string name = getNextWord(tokList); + aNewList.push_back(DoxygenEntity("plainstd::string", name)); name = getNextWord(tokList); - if(!name.empty()) aNewList.push_back(DoxygenEntity("plainstring", name)); + if(!name.empty()) aNewList.push_back(DoxygenEntity("plainstd::string", name)); name = getNextWord(tokList); - if(!name.empty()) aNewList.push_back(DoxygenEntity("plainstring", name)); + if(!name.empty()) aNewList.push_back(DoxygenEntity("plainstd::string", name)); doxyList.push_back(DoxygenEntity(theCommand, aNewList)); return 1; } // \par [(paragraph title)] { paragraph } else if (theCommand.compare("par") == 0){ - list::iterator endOfLine = getOneLine(tokList); + std::list::iterator endOfLine = getOneLine(tokList); aNewList = parse(endOfLine, tokList); - list aNewList2; + std::list aNewList2; aNewList2 = parse(endOfLine, tokList); aNewList.splice(aNewList.end(), aNewList2); doxyList.push_back(DoxygenEntity(theCommand, aNewList)); @@ -578,19 +576,19 @@ list::iterator getTilAnyCommand(string theCommand, TokenList &tokList){ } // \headerfile [] else if (theCommand.compare("headerfile") == 0){ - list aNewList; - string name = getNextWord(tokList); - aNewList.push_back(DoxygenEntity("plainstring", name)); + std::list aNewList; + std::string name = getNextWord(tokList); + aNewList.push_back(DoxygenEntity("plainstd::string", name)); name = getNextWord(tokList); - if(!name.empty()) aNewList.push_back(DoxygenEntity("plainstring", name)); + if(!name.empty()) aNewList.push_back(DoxygenEntity("plainstd::string", name)); doxyList.push_back(DoxygenEntity(theCommand, aNewList)); return 1; } // \overload [(function declaration)] else if (theCommand.compare("overload") == 0){ - list::iterator endOfLine = getOneLine(tokList); + std::list::iterator endOfLine = getOneLine(tokList); if (endOfLine != tokList.current()){ - list aNewList; + std::list aNewList; aNewList = parse(endOfLine, tokList); doxyList.push_back(DoxygenEntity(theCommand, aNewList)); } @@ -600,38 +598,38 @@ list::iterator getTilAnyCommand(string theCommand, TokenList &tokList){ // \weakgroup [(title)] else if (theCommand.compare("weakgroup") == 0){ if (noisy) cout << "Parsing " << theCommand << endl; - string name = getNextWord(tokList); + std::string name = getNextWord(tokList); if (name.empty()){ cout << "No word followed " << theCommand << " command. Not added" << endl; return 0; } - list aNewList; - list::iterator endOfLine = getOneLine(tokList); + std::list aNewList; + std::list::iterator endOfLine = getOneLine(tokList); if (endOfLine != tokList.current()) { aNewList = parse(endOfLine, tokList); } - aNewList.push_front(DoxygenEntity("plainstring", name)); + aNewList.push_front(DoxygenEntity("plainstd::string", name)); doxyList.push_back(DoxygenEntity(theCommand, aNewList)); } // \ref ["(text)"] else if (theCommand.compare("ref") == 0){ //TODO Implement ref if (noisy) cout << "Not Adding " << theCommand << endl; - list::iterator endOfParagraph = getEndOfParagraph(tokList); + std::list::iterator endOfParagraph = getEndOfParagraph(tokList); tokList.setIterator(endOfParagraph); } // \subpage ["(text)"] else if (theCommand.compare("subpage") == 0){ //TODO implement subpage if (noisy) cout << "Not Adding " << theCommand << endl; - list::iterator endOfParagraph = getEndOfParagraph(tokList); + std::list::iterator endOfParagraph = getEndOfParagraph(tokList); tokList.setIterator(endOfParagraph); } // \dotfile ["caption"] else if (theCommand.compare("dotfile") == 0){ //TODO implement dotfile if (noisy) cout << "Not Adding " << theCommand << endl; - list::iterator endOfParagraph = getEndOfParagraph(tokList); + std::list::iterator endOfParagraph = getEndOfParagraph(tokList); tokList.setIterator(endOfParagraph); } // \image ["caption"] [=] @@ -641,17 +639,17 @@ list::iterator getTilAnyCommand(string theCommand, TokenList &tokList){ // \addtogroup [(title)] else if (theCommand.compare("addtogroup") == 0){ if (noisy) cout << "Parsing " << theCommand << endl; - string name = getNextWord(tokList); + std::string name = getNextWord(tokList); if (name.empty()){ cout << "No word followed " << theCommand << " command. Not added" << endl; return 0; } - list aNewList; - list::iterator endOfLine = getOneLine(tokList); + std::list aNewList; + std::list::iterator endOfLine = getOneLine(tokList); if (endOfLine != tokList.current()) { aNewList = parse(endOfLine, tokList); } - aNewList.push_front(DoxygenEntity("plainstring", name)); + aNewList.push_front(DoxygenEntity("plainstd::string", name)); doxyList.push_back(DoxygenEntity(theCommand, aNewList)); } return 0; @@ -663,12 +661,12 @@ list::iterator getTilAnyCommand(string theCommand, TokenList &tokList){ */ -int addCommand(string commandString, TokenList &tokList,list &doxyList){ - string theCommand = StringToLower(commandString); - if (theCommand.compare("plainstring") == 0){ - string nextPhrase = getStringTilCommand( tokList); - if (noisy) cout << "Parsing plain string :" << nextPhrase << endl; - doxyList.push_back(DoxygenEntity("plainstring", nextPhrase )); +int addCommand(std::string commandString, TokenList &tokList,std::list &doxyList){ + std::string theCommand = StringToLower(commandString); + if (theCommand.compare("plainstd::string") == 0){ + std::string nextPhrase = getStringTilCommand( tokList); + if (noisy) cout << "Parsing plain std::string :" << nextPhrase << endl; + doxyList.push_back(DoxygenEntity("plainstd::string", nextPhrase )); return 1; } int commandNumber = commandBelongs(theCommand); @@ -721,8 +719,8 @@ int addCommand(string commandString, TokenList &tokList,list &do return 0; } -list parse(list::iterator endParsingIndex, TokenList &tokList){ - list aNewList; +std::list parse(std::list::iterator endParsingIndex, TokenList &tokList){ + std::list aNewList; int currCommand; while (tokList.current() != endParsingIndex){ Token currToken = tokList.peek(); @@ -735,22 +733,22 @@ list parse(list::iterator endParsingIndex, TokenList &tokL if (currCommand < 0 ){ if(noisy) cout << "Unidentified Command " << currToken.tokenString << endl; tokList.next(); - addCommand(string("plainstring"), tokList, aNewList);} + addCommand(std::string("plainstd::string"), tokList, aNewList);} //cout << "Command: " << currWord << " " << currCommand << endl; else { tokList.next(); addCommand(currToken.tokenString, tokList, aNewList); } } else if (currToken.tokenType == PLAINSTRING){ - addCommand(string("plainstring"), tokList, aNewList); + addCommand(std::string("plainstd::string"), tokList, aNewList); } else break; } return aNewList; } -list parseRoot(list::iterator endParsingIndex, TokenList &tokList){ - list aNewList; +std::list parseRoot(std::list::iterator endParsingIndex, TokenList &tokList){ + std::list aNewList; int currCommand; while (tokList.current() != endParsingIndex){ Token currToken = tokList.peek(); @@ -763,26 +761,26 @@ list parseRoot(list::iterator endParsingIndex, TokenList & if (currCommand < 0 ){ if(noisy) cout << "Unidentified Command " << currToken.tokenString << endl; tokList.next(); - addCommand(string("partofdescription"), tokList, aNewList);} + addCommand(std::string("partofdescription"), tokList, aNewList);} //cout << "Command: " << currWord << " " << currCommand << endl; else { tokList.next(); addCommand(currToken.tokenString, tokList, aNewList); } } else if (currToken.tokenType == PLAINSTRING){ - addCommand(string("partofdescription"), tokList, aNewList); + addCommand(std::string("partofdescription"), tokList, aNewList); } } return aNewList; } -list DoxygenParser::createTree(string doxygenBlob){ +std::list DoxygenParser::createTree(std::string doxygenBlob){ TokenList tokList = TokenList(doxygenBlob); if(noisy) { cout << "---TOKEN LIST---" << endl; tokList.printList(); } - list rootList; + std::list rootList; rootList = parseRoot( tokList.end(), tokList); if(noisy) { cout << "PARSED LIST" << endl; diff --git a/Source/DoxygenTranslator/src/DoxygenParser.h b/Source/DoxygenTranslator/src/DoxygenParser.h index 638fdab72..2269e6788 100644 --- a/Source/DoxygenTranslator/src/DoxygenParser.h +++ b/Source/DoxygenTranslator/src/DoxygenParser.h @@ -6,9 +6,9 @@ class DoxygenParser { public: - DoxygenParser(); - virtual ~DoxygenParser(); - list createTree(string doxygen); + DoxygenParser(); + virtual ~DoxygenParser(); + std::list createTree(std::string doxygen); }; #endif /*DOXYGENPARSER_H_*/ diff --git a/Source/DoxygenTranslator/src/DoxygenTranslator.cpp b/Source/DoxygenTranslator/src/DoxygenTranslator.cpp index 7fe2897c5..fc74c5c20 100644 --- a/Source/DoxygenTranslator/src/DoxygenTranslator.cpp +++ b/Source/DoxygenTranslator/src/DoxygenTranslator.cpp @@ -24,69 +24,20 @@ DoxygenTranslator::~DoxygenTranslator(){ char *DoxygenTranslator::convert(Node *n, char* doxygenBlob, char* option){ - list rootList = doxyParse.createTree(string(doxygenBlob)); + std::list rootList = doxyParse.createTree(std::string(doxygenBlob)); + std::string returnedString; + + if(strcmp(option, "JAVADOC") == 0) + returnedString = jDC.convertToJavaDoc(n, rootList); + else if(strcmp(option, "PYDOC") == 0) + returnedString = pyDC.convertToPyDoc(n, rootList); + else + std::cout << "Option not current supported." << std::endl; - string returnedString; - if(strcmp(option, "JAVADOC") == 0){ - returnedString = jDC.convertToJavaDoc(n, rootList); - } - else if(strcmp(option, "PYDOC") == 0){ - returnedString = pyDC.convertToPyDoc(n, rootList); - } - else cout << "Option not current supported.\n"; - char *nonConstString; - nonConstString = (char *)malloc(returnedString.length() + 1); - strcpy(nonConstString, returnedString.c_str()); - return nonConstString; + char *nonConstString; + nonConstString = (char *)malloc(returnedString.length() + 1); + strcpy(nonConstString, returnedString.c_str()); + + return nonConstString; } -int testCommands(){ - string exampleArray[] = { - "/**\n * Random Line \n * \\@ \n * Random Line After */", - "/**\n * Random Line Before \n * \n * \\b bold \n * Random Line After */", - "/**\n * Random Line \n * \n *\\copydoc bold \n * Random Line After */", - "/**\n * Random Line \n * \n * \\addindex An Entire Line\n * \\addindex An Entire Line\n * Random Line After */", - "/**\n * Random Line \n * \n * \\return An Entire Paragraph \n * Including This Line \n * \n * Random Line After */", - "/**\n * Random Line \n * \n * \\return An Entire Paragraph \n * Including This Line \n * \\author Shouldn't be part of return */", - "/**\n * Random Line \n * \n * \\code this should continue \n * until here \\endcode \n * Random Line After */", - "/**\n * Random Line \n * \n * \\param singleword then the rest of \n * the description \n * \n * Random Line After */", - "/**\n * Random Line \n * \n * \\page singleword this should go til here \n * but not this */", - "/**\n * Random Line \n * \n * \\page singleword this should go til here \n * but not this */", - "/**\n * Random Line \n * \n * \\category singleword \n * but not this */", - "/**\n * Random Line \n * \n * \\category singleword oneword \n * but not this */", - "/**\n * Random Line \n * \n * \\category singleword oneword twoword \n * but not this */", - "/**\n * Random Line \n * \n * \\dir singleword \n * but not this */", - "/**\n * Random Line \n * \n * \\dir \n * but not this */", - "/**\n * Random Line \n * \n * \\fakecommand details \n * but not this */" - }; - //string exampleArrayUniques = {}; - DoxygenTranslator dT = DoxygenTranslator(); - for (int i = 0; i < 16; i ++ ){ - //cout << "---ORIGINAL DOXYGEN--- " << endl << exampleArray[i] << endl; - char *nonConstString = (char *)malloc(exampleArray[i].length()+1); - strcpy(nonConstString, exampleArray[i].c_str()); - char * result = dT.convert(NULL, nonConstString, "JAVADOC"); - free(nonConstString); - free(result); - } - return 1; -} - -//int main(int argc, char *argv[]){ - //string doxygenString1 = "//! \\brief a brief description \n\n A normal member taking two arguments and returning an \\b integer value. This is a very long description for the simple purpose of showing off formatting. Let's make it a bit longer just to be sure. \n/*!\n \\param a an \\b integer argument.\n \\return The test results\n \\param s a constant character pointer. Let's also make this a very long description! \n \\bug this command should, for now, be totally ignored\n \\author cheryl foil\n \\sa Test(), ~Test(), testMeToo() and publicVar()\n */"; - //cout << "---ORIGINAL DOXYGEN--- " << endl << doxygenString1 << endl; - //char *nonConstString = (char *)malloc(doxygenString1.length()+1); - //strcpy(nonConstString, doxygenString1.c_str()); - //DoxygenTranslator dT = DoxygenTranslator(); - //char *result = dT.convert("/**\n * \n * Random Line \n * \n * \\name An Entire Line \n * NOT This Line \n * \n * Random Line After */", "JAVADOC"); - //result = dT.convert(nonConstString, "JAVADOC"); - //cout << "End"; - //list rootList = doxyParse.createTree(doxygenString1); - //JavaDocConverter jDC = JavaDocConverter(); - //jDC.convertToJavaDoc(rootList); - //testCommands(); - //return 1; -//} - - - diff --git a/Source/DoxygenTranslator/src/JavaDocConverter.cpp b/Source/DoxygenTranslator/src/JavaDocConverter.cpp index b611cddf9..dbf606bfd 100644 --- a/Source/DoxygenTranslator/src/JavaDocConverter.cpp +++ b/Source/DoxygenTranslator/src/JavaDocConverter.cpp @@ -12,227 +12,152 @@ JavaDocConverter::~JavaDocConverter() { } -/* Sorts entities by javaDoc standard order for commands - * NOTE: will not behave entirely properly until "First level" comments - * such as brief descriptions are TAGGED as such - */ -bool compare_DoxygenEntities(DoxygenEntity first, DoxygenEntity second){ - if(first.typeOfEntity.compare("brief") == 0) return true; - if(second.typeOfEntity.compare("brief") == 0) return false; - if(first.typeOfEntity.compare("details") == 0) return true; - if(second.typeOfEntity.compare("details") == 0) return false; - if(first.typeOfEntity.compare("partofdescription") == 0) return true; - if(first.typeOfEntity.compare("partofdescription") == 0) return false; - if(first.typeOfEntity.compare("plainstring") == 0) return true; - if(second.typeOfEntity.compare("plainstring") == 0) return false; - if(first.typeOfEntity.compare("param") == 0){ - if(second.typeOfEntity.compare("param")== 0) return true; - if(second.typeOfEntity.compare("return")== 0) return true; - if(second.typeOfEntity.compare("exception")== 0) return true; - if(second.typeOfEntity.compare("author")== 0) return true; - if(second.typeOfEntity.compare("version")== 0)return true; - if(second.typeOfEntity.compare("see")== 0)return true; - if(second.typeOfEntity.compare("since")== 0)return true; - if(second.typeOfEntity.compare("deprecated")== 0)return true; - return false; - } - if(first.typeOfEntity.compare("return")== 0){ - if(second.typeOfEntity.compare("return")== 0) return true; - if(second.typeOfEntity.compare("exception")== 0) return true; - if(second.typeOfEntity.compare("author")== 0) return true; - if(second.typeOfEntity.compare("version")== 0)return true; - if(second.typeOfEntity.compare("see")== 0)return true; - if(second.typeOfEntity.compare("since")== 0)return true; - if(second.typeOfEntity.compare("deprecated")== 0)return true; - return false; - - } - if(first.typeOfEntity.compare("exception")== 0){ - if(second.typeOfEntity.compare("exception")== 0) return true; - if(second.typeOfEntity.compare("author")== 0) return true; - if(second.typeOfEntity.compare("version")== 0)return true; - if(second.typeOfEntity.compare("see")== 0)return true; - if(second.typeOfEntity.compare("since")== 0)return true; - if(second.typeOfEntity.compare("deprecated")== 0)return true; - return false; - } - if(first.typeOfEntity.compare("author")== 0){ - if(second.typeOfEntity.compare("author")== 0) return true; - if(second.typeOfEntity.compare("version")== 0)return true; - if(second.typeOfEntity.compare("see")== 0)return true; - if(second.typeOfEntity.compare("since")== 0)return true; - if(second.typeOfEntity.compare("deprecated")== 0)return true; - return false; - } - if(first.typeOfEntity.compare("version")== 0){ - if(second.typeOfEntity.compare("version")== 0)return true; - if(second.typeOfEntity.compare("see")== 0)return true; - if(second.typeOfEntity.compare("since")== 0)return true; - if(second.typeOfEntity.compare("deprecated")== 0)return true; - return false; - } - if(first.typeOfEntity.compare("see")== 0 || first.typeOfEntity.compare("sa")== 0){ - if(second.typeOfEntity.compare("see")== 0)return true; - if(second.typeOfEntity.compare("sa")== 0)return true; - if(second.typeOfEntity.compare("since")== 0)return true; - if(second.typeOfEntity.compare("deprecated")== 0)return true; - return false; - } - if(first.typeOfEntity.compare("since")== 0){ - if(second.typeOfEntity.compare("since")== 0) return true; - if(second.typeOfEntity.compare("deprecated")== 0)return true; - return false; - } - if(first.typeOfEntity.compare("deprecated")== 0){ - if(second.typeOfEntity.compare("deprecated")== 0)return true; - return false; - } - return true; +void JavaDocConverter::printSortedTree(std::list &entityList){ + std::list::iterator p = entityList.begin(); + while (p != entityList.end()){ + (*p).printEntity(0); + p++; + } } -void JavaDocConverter::printSortedTree(list &entityList){ - list::iterator p = entityList.begin(); - while (p != entityList.end()){ - (*p).printEntity(0); - p++; - } -} -string formatCommand(string unformattedLine, int indent){ - string formattedLines = "\n * "; - int lastPosition = 0; - int i = 0; - int isFirstLine = 1; - while (i != -1 && i < unformattedLine.length()){ - lastPosition = i; - if (isFirstLine){ - i+=APPROX_LINE_LENGTH; - } - else i+=APPROX_LINE_LENGTH - indent*TAB_SIZE; - i = unformattedLine.find(" ", i); +std::string formatCommand(std::string unformattedLine, int indent){ + std::string formattedLines = "\n * "; + int lastPosition = 0; + int i = 0; + int isFirstLine = 1; + while (i != -1 && i < unformattedLine.length()){ + lastPosition = i; + if (isFirstLine){ + i+=APPROX_LINE_LENGTH; + } + else i+=APPROX_LINE_LENGTH - indent*TAB_SIZE; + i = unformattedLine.find(" ", i); - if (i > 0 && i + 1 < unformattedLine.length()){ - if (!isFirstLine) for (int j = 0; j < indent; j++) { - formattedLines.append("\t"); - } - else { - isFirstLine = 0; - } - formattedLines.append(unformattedLine.substr(lastPosition, i - lastPosition + 1)); - formattedLines.append("\n *"); + if (i > 0 && i + 1 < unformattedLine.length()){ + if (!isFirstLine) for (int j = 0; j < indent; j++) { + formattedLines.append("\t"); + } + else { + isFirstLine = 0; + } + formattedLines.append(unformattedLine.substr(lastPosition, i - lastPosition + 1)); + formattedLines.append("\n *"); - } - } - if (lastPosition < unformattedLine.length()){ - if (!isFirstLine) {for (int j = 0; j < indent; j++) {formattedLines.append("\t");}} - formattedLines.append(unformattedLine.substr(lastPosition, unformattedLine.length() - lastPosition)); - } + } + } + if (lastPosition < unformattedLine.length()){ + if (!isFirstLine) {for (int j = 0; j < indent; j++) {formattedLines.append("\t");}} + formattedLines.append(unformattedLine.substr(lastPosition, unformattedLine.length() - lastPosition)); + } - return formattedLines; + return formattedLines; } /* Contains the conversions for tags * could probably be much more efficient... */ -string javaDocFormat(DoxygenEntity &doxygenEntity){ - if(doxygenEntity.typeOfEntity.compare("partofdescription") == 0){ - return doxygenEntity.data; - } - if (doxygenEntity.typeOfEntity.compare("plainstring") == 0){ - return doxygenEntity.data; - } - else if (doxygenEntity.typeOfEntity.compare("b") == 0){ - return "" + doxygenEntity.data + ""; - } - else if (doxygenEntity.typeOfEntity.compare("c") == 0){ - return "" + doxygenEntity.data + ""; - } - else if (doxygenEntity.typeOfEntity.compare("@") == 0){ - return "@"; - } - else if (doxygenEntity.typeOfEntity.compare("\\") == 0){ - return "\\"; - } - else if (doxygenEntity.typeOfEntity.compare("<") == 0){ - return "<"; - } - else if (doxygenEntity.typeOfEntity.compare(">") == 0){ - return ">"; - } - else if (doxygenEntity.typeOfEntity.compare("&") == 0){ - return "&"; - } - else if (doxygenEntity.typeOfEntity.compare("#") == 0){ - return "#"; - } - else if (doxygenEntity.typeOfEntity.compare("%") == 0){ - return "%"; - } - else if (doxygenEntity.typeOfEntity.compare("~") == 0){ - return "~"; - } - return ""; -} - - -string translateSubtree( DoxygenEntity &doxygenEntity){ - string returnedString; - if (doxygenEntity.isLeaf){ return javaDocFormat(doxygenEntity) + " ";} - else { - returnedString += javaDocFormat(doxygenEntity); - list::iterator p = doxygenEntity.entityList.begin(); - while (p != doxygenEntity.entityList.end()){ - returnedString+= translateSubtree(*p); - p++; - } - } - return returnedString; -} - -string translateEntity(DoxygenEntity &doxyEntity){ - if(doxyEntity.typeOfEntity.compare("partofdescription")== 0) return formatCommand(string(translateSubtree(doxyEntity)), 0); - if ((doxyEntity.typeOfEntity.compare("brief") == 0)||(doxyEntity.typeOfEntity.compare("details") == 0)){ - return formatCommand(string(translateSubtree(doxyEntity)), 0) + "\n * ";} - else if(doxyEntity.typeOfEntity.compare("plainstring")== 0 || doxyEntity.typeOfEntity.compare("deprecated")== 0 || doxyEntity.typeOfEntity.compare("brief")== 0) - return formatCommand(doxyEntity.data, 0) + "\n * "; - else if(doxyEntity.typeOfEntity.compare("see") == 0){ - return formatCommand(string("@" + doxyEntity.typeOfEntity + "\t\t" + translateSubtree(doxyEntity)), 2); - } - else if(doxyEntity.typeOfEntity.compare("return")== 0 - || doxyEntity.typeOfEntity.compare("author")== 0 - || doxyEntity.typeOfEntity.compare("param")== 0 - || doxyEntity.typeOfEntity.compare("since")== 0 - || doxyEntity.typeOfEntity.compare("version")== 0 - || doxyEntity.typeOfEntity.compare("exception") == 0 - || doxyEntity.typeOfEntity.compare("deprecated") == 0){ - return formatCommand(string("@" + doxyEntity.typeOfEntity + "\t" + translateSubtree(doxyEntity)), 2); - } - else if(doxyEntity.typeOfEntity.compare("sa")== 0){ - return formatCommand(string("@see\t\t" + translateSubtree(doxyEntity)), 2); - } - else return formatCommand(javaDocFormat(doxyEntity), 0 ); - return ""; -} - -string JavaDocConverter:: convertToJavaDoc(Node *n, list entityList){ - - - entityList.sort(compare_DoxygenEntities); - if(printSortedTree2){ - cout << "---RESORTED LIST---" << endl; - printSortedTree(entityList); +std::string javaDocFormat(DoxygenEntity &doxygenEntity){ + if(doxygenEntity.typeOfEntity.compare("partofdescription") == 0){ + return doxygenEntity.data; } + if (doxygenEntity.typeOfEntity.compare("plainstring") == 0){ + return doxygenEntity.data; + } + else if (doxygenEntity.typeOfEntity.compare("b") == 0){ + return "" + doxygenEntity.data + ""; + } + else if (doxygenEntity.typeOfEntity.compare("c") == 0){ + return "" + doxygenEntity.data + ""; + } + else if (doxygenEntity.typeOfEntity.compare("@") == 0){ + return "@"; + } + else if (doxygenEntity.typeOfEntity.compare("\\") == 0){ + return "\\"; + } + else if (doxygenEntity.typeOfEntity.compare("<") == 0){ + return "<"; + } + else if (doxygenEntity.typeOfEntity.compare(">") == 0){ + return ">"; + } + else if (doxygenEntity.typeOfEntity.compare("&") == 0){ + return "&"; + } + else if (doxygenEntity.typeOfEntity.compare("#") == 0){ + return "#"; + } + else if (doxygenEntity.typeOfEntity.compare("%") == 0){ + return "%"; + } + else if (doxygenEntity.typeOfEntity.compare("~") == 0){ + return "~"; + } + return ""; +} - string javaDocString = "/**"; - list::iterator entityIterator = entityList.begin(); - while (entityIterator != entityList.end()){ - javaDocString += translateEntity(*entityIterator); - entityIterator++; - } +std::string translateSubtree( DoxygenEntity &doxygenEntity){ + std::string returnedString; + if (doxygenEntity.isLeaf){ return javaDocFormat(doxygenEntity) + " ";} + else { + returnedString += javaDocFormat(doxygenEntity); + std::list::iterator p = doxygenEntity.entityList.begin(); + while (p != doxygenEntity.entityList.end()){ + returnedString+= translateSubtree(*p); + p++; + } + } + return returnedString; +} - javaDocString += "\n */\n"; - if(printSortedTree2){ - cout << "\n---RESULT IN JAVADOC---" << endl; - cout << javaDocString; } - return javaDocString; +std::string translateEntity(DoxygenEntity &doxyEntity){ + if(doxyEntity.typeOfEntity.compare("partofdescription")== 0) return formatCommand(std::string(translateSubtree(doxyEntity)), 0); + if ((doxyEntity.typeOfEntity.compare("brief") == 0)||(doxyEntity.typeOfEntity.compare("details") == 0)){ + return formatCommand(std::string(translateSubtree(doxyEntity)), 0) + "\n * ";} + else if(doxyEntity.typeOfEntity.compare("plainstring")== 0 || doxyEntity.typeOfEntity.compare("deprecated")== 0 || doxyEntity.typeOfEntity.compare("brief")== 0) + return formatCommand(doxyEntity.data, 0) + "\n * "; + else if(doxyEntity.typeOfEntity.compare("see") == 0){ + return formatCommand(std::string("@" + doxyEntity.typeOfEntity + "\t\t" + translateSubtree(doxyEntity)), 2); + } + else if(doxyEntity.typeOfEntity.compare("return")== 0 + || doxyEntity.typeOfEntity.compare("author")== 0 + || doxyEntity.typeOfEntity.compare("param")== 0 + || doxyEntity.typeOfEntity.compare("since")== 0 + || doxyEntity.typeOfEntity.compare("version")== 0 + || doxyEntity.typeOfEntity.compare("exception") == 0 + || doxyEntity.typeOfEntity.compare("deprecated") == 0){ + return formatCommand(std::string("@" + doxyEntity.typeOfEntity + "\t" + translateSubtree(doxyEntity)), 2); + } + else if(doxyEntity.typeOfEntity.compare("sa")== 0){ + return formatCommand(std::string("@see\t\t" + translateSubtree(doxyEntity)), 2); + } + else return formatCommand(javaDocFormat(doxyEntity), 0 ); + return ""; +} + +std::string JavaDocConverter:: convertToJavaDoc(Node *n, std::list entityList){ + #pragma unused(n) + entityList.sort(CompareDoxygenEntities()); + + if(printSortedTree2){ + std::cout << "---RESORTED LIST---" << std::endl; + printSortedTree(entityList); + } + + std::string javaDocString = "/**"; + + for(std::list::iterator entityIterator = entityList.begin(); entityIterator != entityList.end();){ + javaDocString += translateEntity(*entityIterator); + entityIterator++; + } + + javaDocString += "\n */\n"; + + if(printSortedTree2){ + std::cout << "\n---RESULT IN JAVADOC---" << std::endl; + std::cout << javaDocString; + } + + return javaDocString; } \ No newline at end of file diff --git a/Source/DoxygenTranslator/src/JavaDocConverter.h b/Source/DoxygenTranslator/src/JavaDocConverter.h index 39de3dd15..0a329c27a 100644 --- a/Source/DoxygenTranslator/src/JavaDocConverter.h +++ b/Source/DoxygenTranslator/src/JavaDocConverter.h @@ -9,11 +9,10 @@ class JavaDocConverter { public: - - JavaDocConverter(); - string convertToJavaDoc(Node *n, list entityList); - ~JavaDocConverter(); - void printSortedTree(list &entityList); + JavaDocConverter(); + std::string convertToJavaDoc(Node *n, std::list entityList); + ~JavaDocConverter(); + void printSortedTree(std::list &entityList); }; #endif /*JAVADOCCONVERTER_H_*/ diff --git a/Source/DoxygenTranslator/src/PyDocConverter.cpp b/Source/DoxygenTranslator/src/PyDocConverter.cpp index ad675e273..1e4d6a73e 100644 --- a/Source/DoxygenTranslator/src/PyDocConverter.cpp +++ b/Source/DoxygenTranslator/src/PyDocConverter.cpp @@ -14,192 +14,188 @@ PyDocConverter::PyDocConverter() PyDocConverter::~PyDocConverter() { } - -/* Sorts entities by pyDoc standard order for commands - * NOTE: will not behave entirely properly until "First level" comments - * such as brief descriptions are TAGGED as such - */ -bool compare_DoxygenEntities(DoxygenEntity first, DoxygenEntity second); -void PyDocConverter::printSortedTree(list &entityList){ - list::iterator p = entityList.begin(); - while (p != entityList.end()){ - (*p).printEntity(0); - p++; - } +void PyDocConverter::printSortedTree(std::list &entityList){ + std::list::iterator p = entityList.begin(); + while (p != entityList.end()){ + (*p).printEntity(0); + p++; + } } -string PyDocConverter::formatParam(Node *n, DoxygenEntity &doxygenEntity) { - string result; - ParmList *plist = CopyParmList(Getattr(n, "parms")); - Parm *p = NULL; - - DoxygenEntity& paramNameEntity = *doxygenEntity.entityList.begin(); - DoxygenEntity& paramDescriptionEntity = *(++doxygenEntity.entityList.begin()); - - for (p = plist; p;) { - if(Char(Getattr(p, "name")) == paramNameEntity.data) { - std::string name = Char(Swig_name_make(n, 0, Getattr(p, "name"), 0, 0)); - std::string type = Char(Swig_name_make(n, 0, Getattr(p, "type"), 0, 0)); - - std::ostringstream parameterDocString; - - parameterDocString << std::endl << name << " (" << type << "): "; - parameterDocString << paramDescriptionEntity.data; - - result = parameterDocString.str(); - break; - } - p = Getattr(p, "tmap:in") ? Getattr(p, "tmap:in:next") : nextSibling(p); - } +std::string PyDocConverter::formatParam(Node *n, DoxygenEntity &doxygenEntity) { + std::string result; + ParmList *plist = CopyParmList(Getattr(n, "parms")); + Parm *p = NULL; + + DoxygenEntity& paramNameEntity = *doxygenEntity.entityList.begin(); + DoxygenEntity& paramDescriptionEntity = *(++doxygenEntity.entityList.begin()); + + for (p = plist; p;) { + if(Char(Getattr(p, "name")) == paramNameEntity.data) { + std::string name = Char(Swig_name_make(n, 0, Getattr(p, "name"), 0, 0)); + std::string type = Char(Swig_name_make(n, 0, Getattr(p, "type"), 0, 0)); + + std::ostringstream parameterDocString; + + parameterDocString << std::endl << name << " (" << type << ") -- "; + parameterDocString << paramDescriptionEntity.data; + + result = parameterDocString.str(); + break; + } + p = Getattr(p, "tmap:in") ? Getattr(p, "tmap:in:next") : nextSibling(p); + } - Delete(plist); - return result; + Delete(plist); + return result; } -string PyDocConverter::formatCommand(string unformattedLine, int indent){ - string formattedLines = "\n"; - int lastPosition = 0; - int i = 0; - int isFirstLine = 1; - while (i != -1 && i < unformattedLine.length()){ - lastPosition = i; - if (isFirstLine){ - i+=APPROX_LINE_LENGTH; - } - else i+=APPROX_LINE_LENGTH - indent*TAB_SIZE; - i = unformattedLine.find(" ", i); +std::string PyDocConverter::formatCommand(std::string unformattedLine, int indent){ + std::string formattedLines = "\n"; + int lastPosition = 0; + signed int i = 0; + bool isFirstLine = true; + while (i != -1 && i < (int)unformattedLine.length()){ + lastPosition = i; + if (isFirstLine){ + i+=APPROX_LINE_LENGTH; + } + else i+=APPROX_LINE_LENGTH - indent*TAB_SIZE; + i = unformattedLine.find(" ", i); - if (i > 0 && i + 1 < unformattedLine.length()){ - if (!isFirstLine) for (int j = 0; j < indent; j++) { - formattedLines.append("\t"); - } - else { - isFirstLine = 0; - } - formattedLines.append(unformattedLine.substr(lastPosition, i - lastPosition + 1)); - formattedLines.append("\n"); + if (i > 0 && i + 1 < (int)unformattedLine.length()){ + if (!isFirstLine) for (int j = 0; j < indent; j++) { + formattedLines.append("\t"); + } + else { + isFirstLine = false; + } + formattedLines.append(unformattedLine.substr(lastPosition, i - lastPosition + 1)); + formattedLines.append("\n"); - } - } - if (lastPosition < unformattedLine.length()){ - if (!isFirstLine) {for (int j = 0; j < indent; j++) {formattedLines.append("\t");}} - formattedLines.append(unformattedLine.substr(lastPosition, unformattedLine.length() - lastPosition)); - } + } + } + if (lastPosition < (int)unformattedLine.length()){ + if (!isFirstLine) {for (int j = 0; j < indent; j++) {formattedLines.append("\t");}} + formattedLines.append(unformattedLine.substr(lastPosition, unformattedLine.length() - lastPosition)); + } - return formattedLines; + return formattedLines; } /* Contains the conversions for tags * could probably be much more efficient... */ -string PyDocConverter::pyDocFormat(DoxygenEntity &doxygenEntity){ - if(doxygenEntity.typeOfEntity.compare("partofdescription") == 0){ - return doxygenEntity.data; - } - if (doxygenEntity.typeOfEntity.compare("plainstring") == 0){ - return doxygenEntity.data; - } - else if (doxygenEntity.typeOfEntity.compare("b") == 0){ - return "" + doxygenEntity.data + ""; - } - else if (doxygenEntity.typeOfEntity.compare("c") == 0){ - return "" + doxygenEntity.data + ""; - } - else if (doxygenEntity.typeOfEntity.compare("@") == 0){ - return "@"; - } - else if (doxygenEntity.typeOfEntity.compare("\\") == 0){ - return "\\"; - } - else if (doxygenEntity.typeOfEntity.compare("<") == 0){ - return "<"; - } - else if (doxygenEntity.typeOfEntity.compare(">") == 0){ - return ">"; - } - else if (doxygenEntity.typeOfEntity.compare("&") == 0){ - return "&"; - } - else if (doxygenEntity.typeOfEntity.compare("#") == 0){ - return "#"; - } - else if (doxygenEntity.typeOfEntity.compare("%") == 0){ - return "%"; - } - else if (doxygenEntity.typeOfEntity.compare("~") == 0){ - return "~"; - } - return ""; -} - - -string PyDocConverter::translateSubtree( DoxygenEntity &doxygenEntity){ - string returnedString; - if (doxygenEntity.isLeaf){ return pyDocFormat(doxygenEntity) + " ";} - else { - returnedString += pyDocFormat(doxygenEntity); - list::iterator p = doxygenEntity.entityList.begin(); - while (p != doxygenEntity.entityList.end()){ - returnedString+= translateSubtree(*p); - p++; - } - } - return returnedString; -} - -string PyDocConverter::translateEntity(Node *n, DoxygenEntity &doxyEntity){ - if(doxyEntity.typeOfEntity.compare("partofdescription")== 0) return formatCommand(string(translateSubtree(doxyEntity)), 0); - if ((doxyEntity.typeOfEntity.compare("brief") == 0)||(doxyEntity.typeOfEntity.compare("details") == 0)){ - return formatCommand(string(translateSubtree(doxyEntity)), 0) + "\n * ";} - else if(doxyEntity.typeOfEntity.compare("plainstring")== 0 - || doxyEntity.typeOfEntity.compare("deprecated")== 0 - || doxyEntity.typeOfEntity.compare("brief")== 0) - return formatCommand(doxyEntity.data, 0) + "\n * "; - else if(doxyEntity.typeOfEntity.compare("see") == 0){ - return formatCommand(string("@" + doxyEntity.typeOfEntity + "\t\t" + translateSubtree(doxyEntity)), 2); - } - else if(doxyEntity.typeOfEntity.compare("param") == 0) { - return formatParam(n, doxyEntity); - } - else if(doxyEntity.typeOfEntity.compare("return")== 0 - || doxyEntity.typeOfEntity.compare("author")== 0 - || doxyEntity.typeOfEntity.compare("param")== 0 - || doxyEntity.typeOfEntity.compare("since")== 0 - || doxyEntity.typeOfEntity.compare("version")== 0 - || doxyEntity.typeOfEntity.compare("exception") == 0 - || doxyEntity.typeOfEntity.compare("deprecated") == 0){ - return formatCommand(string("@" + doxyEntity.typeOfEntity + "\t" + translateSubtree(doxyEntity)), 2); - } - else if(doxyEntity.typeOfEntity.compare("sa")== 0){ - return formatCommand(string("@see\t\t" + translateSubtree(doxyEntity)), 2); - } - else return formatCommand(pyDocFormat(doxyEntity), 0 ); - return ""; -} - -string PyDocConverter::convertToPyDoc(Node *n, list entityList){ - entityList.sort(compare_DoxygenEntities); - - if(debug){ - cout << "---RESORTED LIST---" << endl; - printSortedTree(entityList); +std::string PyDocConverter::pyDocFormat(DoxygenEntity &doxygenEntity){ + if(doxygenEntity.typeOfEntity.compare("partofdescription") == 0){ + return doxygenEntity.data; } + if (doxygenEntity.typeOfEntity.compare("plainstd::string") == 0){ + return doxygenEntity.data; + } + else if (doxygenEntity.typeOfEntity.compare("b") == 0){ + return "" + doxygenEntity.data + ""; + } + else if (doxygenEntity.typeOfEntity.compare("c") == 0){ + return "" + doxygenEntity.data + ""; + } + else if (doxygenEntity.typeOfEntity.compare("@") == 0){ + return "@"; + } + else if (doxygenEntity.typeOfEntity.compare("\\") == 0){ + return "\\"; + } + else if (doxygenEntity.typeOfEntity.compare("<") == 0){ + return "<"; + } + else if (doxygenEntity.typeOfEntity.compare(">") == 0){ + return ">"; + } + else if (doxygenEntity.typeOfEntity.compare("&") == 0){ + return "&"; + } + else if (doxygenEntity.typeOfEntity.compare("#") == 0){ + return "#"; + } + else if (doxygenEntity.typeOfEntity.compare("%") == 0){ + return "%"; + } + else if (doxygenEntity.typeOfEntity.compare("~") == 0){ + return "~"; + } + return ""; +} - string pyDocString = "\"\"\""; - list::iterator entityIterator = entityList.begin(); - while (entityIterator != entityList.end()){ - pyDocString += translateEntity(n, *entityIterator); - entityIterator++; - } +std::string PyDocConverter::translateSubtree( DoxygenEntity &doxygenEntity){ + std::string returnedString; + if (doxygenEntity.isLeaf){ return pyDocFormat(doxygenEntity) + " ";} + else { + returnedString += pyDocFormat(doxygenEntity); + std::list::iterator p = doxygenEntity.entityList.begin(); + while (p != doxygenEntity.entityList.end()){ + returnedString+= translateSubtree(*p); + p++; + } + } + return returnedString; +} - pyDocString += "\n\"\"\"\n"; - - if(debug){ - cout << "\n---RESULT IN PYDOC---" << endl; - cout << pyDocString; - } - - return pyDocString; +std::string PyDocConverter::translateEntity(Node *n, DoxygenEntity &doxyEntity){ + if(doxyEntity.typeOfEntity.compare("partofdescription")== 0) + return formatCommand(std::string(translateSubtree(doxyEntity)), 0); + + if ((doxyEntity.typeOfEntity.compare("brief") == 0)||(doxyEntity.typeOfEntity.compare("details") == 0)){ + return formatCommand(std::string(translateSubtree(doxyEntity)), 0) + "\n * ";} + + if(doxyEntity.typeOfEntity.compare("plainstd::string")== 0 + || doxyEntity.typeOfEntity.compare("deprecated")== 0 + || doxyEntity.typeOfEntity.compare("brief")== 0) + return formatCommand(doxyEntity.data, 0) + "\n * "; + + if(doxyEntity.typeOfEntity.compare("see") == 0) + return formatCommand(std::string("@" + doxyEntity.typeOfEntity + "\t\t" + translateSubtree(doxyEntity)), 2); + + if(doxyEntity.typeOfEntity.compare("param") == 0) + return formatParam(n, doxyEntity); + + if(doxyEntity.typeOfEntity.compare("return")== 0 + || doxyEntity.typeOfEntity.compare("author")== 0 + || doxyEntity.typeOfEntity.compare("param")== 0 + || doxyEntity.typeOfEntity.compare("since")== 0 + || doxyEntity.typeOfEntity.compare("version")== 0 + || doxyEntity.typeOfEntity.compare("exception") == 0 + || doxyEntity.typeOfEntity.compare("deprecated") == 0) + return formatCommand(std::string("@" + doxyEntity.typeOfEntity + "\t" + translateSubtree(doxyEntity)), 2); + + if(doxyEntity.typeOfEntity.compare("sa")== 0) + return formatCommand(std::string("@see\t\t" + translateSubtree(doxyEntity)), 2); + + return formatCommand(pyDocFormat(doxyEntity), 0); +} + +std::string PyDocConverter::convertToPyDoc(Node *n, std::list entityList){ + entityList.sort(CompareDoxygenEntities()); + + if(debug){ + std::cout << "---RESORTED LIST---" << std::endl; + printSortedTree(entityList); + } + + std::string pyDocString = "\"\"\""; + + for(std::list::iterator entityIterator = entityList.begin(); entityIterator != entityList.end();){ + pyDocString += translateEntity(n, *entityIterator); + entityIterator++; + } + + pyDocString += "\n\"\"\"\n"; + + if(debug){ + std::cout << "\n---RESULT IN PYDOC---" << std::endl; + std::cout << pyDocString; + } + + return pyDocString; } \ No newline at end of file diff --git a/Source/DoxygenTranslator/src/PyDocConverter.h b/Source/DoxygenTranslator/src/PyDocConverter.h index b9d813476..27faaf6c3 100644 --- a/Source/DoxygenTranslator/src/PyDocConverter.h +++ b/Source/DoxygenTranslator/src/PyDocConverter.h @@ -9,21 +9,20 @@ class PyDocConverter { public: - - PyDocConverter(); - string convertToPyDoc(Node *n, list entityList); - ~PyDocConverter(); - void printSortedTree(list &entityList); + PyDocConverter(); + std::string convertToPyDoc(Node *n, std::list entityList); + ~PyDocConverter(); + void printSortedTree(std::list &entityList); protected: - std::string formatParam(Node *n, DoxygenEntity &doxygenEntity); - std::string formatCommand(string unformattedLine, int indent); - std::string pyDocFormat(DoxygenEntity &doxygenEntity); - std::string translateSubtree( DoxygenEntity &doxygenEntity); - std::string translateEntity(Node *n, DoxygenEntity &doxyEntity); + std::string formatParam(Node *n, DoxygenEntity &doxygenEntity); + std::string formatCommand(std::string unformattedLine, int indent); + std::string pyDocFormat(DoxygenEntity &doxygenEntity); + std::string translateSubtree( DoxygenEntity &doxygenEntity); + std::string translateEntity(Node *n, DoxygenEntity &doxyEntity); private: - bool debug; + bool debug; }; #endif /*PYDOCCONVERTER_H_*/ From eb38ea3a4330001f59b814491de3b2c34b9bef2d Mon Sep 17 00:00:00 2001 From: Jamie Kirkpatrick Date: Fri, 12 Sep 2008 11:19:07 +0000 Subject: [PATCH 031/314] Whitespace corrects. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2008-cherylfoil@10840 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- .../DoxygenTranslator/src/DoxygenEntity.cpp | 21 - Source/DoxygenTranslator/src/DoxygenEntity.h | 1 - .../DoxygenTranslator/src/DoxygenParser.cpp | 1275 +++++++++-------- 3 files changed, 659 insertions(+), 638 deletions(-) diff --git a/Source/DoxygenTranslator/src/DoxygenEntity.cpp b/Source/DoxygenTranslator/src/DoxygenEntity.cpp index dcca1d032..52fb60d90 100644 --- a/Source/DoxygenTranslator/src/DoxygenEntity.cpp +++ b/Source/DoxygenTranslator/src/DoxygenEntity.cpp @@ -10,27 +10,6 @@ #include "DoxygenEntity.h" #include -/* - * Basic node for commands that have nothing after them (eg: \n) - */ -std::string DoxygenEntity::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", - "std::endlatexonly", "std::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", - "$", "@", std::string(1, 92), "&", "~", "<", ">", "#", "%"}; - DoxygenEntity::DoxygenEntity(std::string typeEnt){ typeOfEntity = typeEnt; data = ""; diff --git a/Source/DoxygenTranslator/src/DoxygenEntity.h b/Source/DoxygenTranslator/src/DoxygenEntity.h index 3bec0bb0c..6a0b2e48c 100644 --- a/Source/DoxygenTranslator/src/DoxygenEntity.h +++ b/Source/DoxygenTranslator/src/DoxygenEntity.h @@ -25,7 +25,6 @@ struct DoxygenEntity{ std::list entityList; std::string data; int isLeaf; - static std::string commandArray[]; }; /* diff --git a/Source/DoxygenTranslator/src/DoxygenParser.cpp b/Source/DoxygenTranslator/src/DoxygenParser.cpp index ba624239a..cdc2d709f 100644 --- a/Source/DoxygenTranslator/src/DoxygenParser.cpp +++ b/Source/DoxygenTranslator/src/DoxygenParser.cpp @@ -37,75 +37,75 @@ std::list parse(std::list::iterator endParsingIndex, Toke std::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", - "$", "@", "\\","&", "~", "<", ">", "#", "%"}; + "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", + "$", "@", "\\","&", "~", "<", ">", "#", "%"}; std::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" }; + "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" }; /* All of the doxygen commands divided up by how they are parsed */ std::string simpleCommands[] = {"n", "$", "@", "\\", "&", "~", "<", ">", "#", "%"}; std::string ignoredSimpleCommands[] = {"nothing at the moment"}; std::string commandWords[] = {"a", "b", "c", "e", "em", "p", "def", "enum", "example", "package", - "relates", "namespace", "relatesalso","anchor", "dontinclude", "include", "includelineno"}; + "relates", "namespace", "relatesalso","anchor", "dontinclude", "include", "includelineno"}; std::string ignoredCommandWords[] = {"copydoc", "copybrief", "copydetails", "verbinclude", "htmlinclude"}; std::string commandLines[] = {"addindex", "fn", "name", "line", "var", "skipline", "typedef", "skip", "until", "property"}; std::string ignoreCommandLines[] = {"nothing at the moment"}; std::string commandParagraph[] = {"partofdescription", "return", "remarks", "since", "test", "sa", "see", "pre", "post", "details", "invariant", - "deprecated", "date", "note", "warning", "version", "todo", "bug", "attention", "brief", "author"}; + "deprecated", "date", "note", "warning", "version", "todo", "bug", "attention", "brief", "author"}; std::string ignoreCommandParagraphs[] = {"nothing at the moment"}; std::string commandEndCommands[] = {"code", "dot", "msc", "f$", "f[", "f{environment}{", "htmlonly", "latexonly", "manonly", - "verbatim", "xmlonly", "cond", "if", "ifnot", "link"}; + "verbatim", "xmlonly", "cond", "if", "ifnot", "link"}; std::string commandWordParagraphs[] = {"param", "tparam", "throw", "retval", "exception"}; std::string commandWordLines[] = {"page", "subsection", "subsubsection", "section", "paragraph", "defgroup"}; std::string commandWordOWordOWords [] = {"category", "class", "protocol", "interface", "struct", "union"}; std::string commandOWords[] = {"dir", "file", "cond"}; std::string commandErrorThrowings[] = {"annotatedclassstd::list", "classhierarchy", "define", "functionindex", "header", - "headerfilestd::list", "inherit", "l", "postheader", "private", "privatesection", "protected", - "protectedsection", "public", "publicsection", "endcode", "enddot", "endmsc", "endhtmlonly", - "endlatexonly", "endmanonly", "endlink", "endverbatim", "endxmlonly", "f]", "f}", "endcond", - "endif"}; + "headerfilestd::list", "inherit", "l", "postheader", "private", "privatesection", "protected", + "protectedsection", "public", "publicsection", "endcode", "enddot", "endmsc", "endhtmlonly", + "endlatexonly", "endmanonly", "endlink", "endverbatim", "endxmlonly", "f]", "f}", "endcond", + "endif"}; std::string commandUniques[] = {"xrefitem", "arg", "ingroup", "par", "headerfile", "overload", "weakgroup", "ref", - "subpage", "dotfile", "image", "addtogroup", "li"}; +"subpage", "dotfile", "image", "addtogroup", "li"}; /* Changes a std::string to all lower case */ std::string StringToLower(std::string stringToConvert){ - for(unsigned int i=0;i &rootList){ - std::list::iterator p = rootList.begin(); - while (p != rootList.end()){ - (*p).printEntity(0); - p++; - } - } + std::list::iterator p = rootList.begin(); + while (p != rootList.end()){ + (*p).printEntity(0); + p++; + } +} /* Determines how a command should be handled (what group it belongs to * for parsing rules */ int commandBelongs(std::string theCommand){ - std::string smallString = StringToLower(theCommand); - //cout << " Looking for command " << theCommand << endl; - int i = 0; - for ( i = 0; i < sizeof(simpleCommands)/sizeof(*simpleCommands); i++){ - if(smallString.compare(simpleCommands[i]) == 0){return SIMPLECOMMAND;} - } - for ( i = 0; i < sizeof(ignoredSimpleCommands)/sizeof(*ignoredSimpleCommands); i++){ - if(smallString.compare(ignoredSimpleCommands[i]) == 0){return IGNOREDSIMPLECOMMAND;} - } - for ( i = 0; i < sizeof(commandWords)/sizeof(*commandWords); i++){ - if(smallString.compare( commandWords[i]) == 0){return COMMANDWORD;} - } - for ( i = 0; i < sizeof(ignoredCommandWords)/sizeof(*ignoredCommandWords); i++){ - if(smallString.compare( ignoredCommandWords[i]) == 0){return IGNOREDCOMMANDWORD;} - } - for ( i = 0; i < sizeof(commandLines)/sizeof(*commandLines); i++){ - if(smallString.compare( commandLines[i]) == 0){return COMMANDLINE;} - } - for ( i = 0; i < sizeof(ignoreCommandLines)/sizeof(*ignoreCommandLines); i++){ - if(smallString.compare( ignoreCommandLines[i]) == 0){return IGNOREDCOMMANDLINE;} - } - for ( i = 0; i < sizeof(commandParagraph)/sizeof(*commandParagraph); i++){ - if(smallString.compare( commandParagraph[i]) == 0){return COMMANDPARAGRAPH;} - } - for ( i = 0; i < sizeof(ignoreCommandParagraphs)/sizeof(*ignoreCommandParagraphs); i++){ - if(smallString.compare( ignoreCommandParagraphs[i]) == 0){return IGNORECOMMANDPARAGRAPH;} - } - for ( i = 0; i < sizeof(commandEndCommands)/sizeof(*commandEndCommands); i++){ - if(smallString.compare( commandEndCommands[i]) == 0){return COMMANDENDCOMMAND ;} - } - for ( i = 0; i < sizeof(commandWordParagraphs)/sizeof(*commandWordParagraphs); i++){ - if(smallString.compare( commandWordParagraphs[i]) == 0){return COMMANDWORDPARAGRAPH;} - } - for ( i = 0; i < sizeof(commandWordLines)/sizeof(*commandWordLines); i++){ - if(smallString.compare( commandWordLines[i]) == 0){return COMMANDWORDLINE ;} - } - for ( i = 0; i < sizeof(commandWordOWordOWords)/sizeof(*commandWordOWordOWords); i++){ - if(smallString.compare( commandWordOWordOWords[i]) == 0){return COMMANDWORDOWORDWORD;} - } - for ( i = 0; i < sizeof(commandOWords)/sizeof(*commandOWords); i++){ - if(smallString.compare( commandOWords[i]) == 0){return COMMANDOWORD;} - } - for ( i = 0; i < sizeof(commandErrorThrowings)/sizeof(*commandErrorThrowings); i++){ - if(smallString.compare( commandErrorThrowings[i]) == 0){return COMMANDERRORTHROW;} - } - for ( i = 0; i < sizeof(commandUniques)/sizeof(*commandUniques); i++){ - if(smallString.compare( commandUniques[i]) == 0){return COMMANDUNIQUE;} - } - return 0; + std::string smallString = StringToLower(theCommand); + //cout << " Looking for command " << theCommand << endl; + unsigned i = 0; + for (i = 0; i < sizeof(simpleCommands)/sizeof(*simpleCommands); i++){ + if(smallString.compare(simpleCommands[i]) == 0) + return SIMPLECOMMAND; + } + for (i = 0; i < sizeof(ignoredSimpleCommands)/sizeof(*ignoredSimpleCommands); i++){ + if(smallString.compare(ignoredSimpleCommands[i]) == 0) + return IGNOREDSIMPLECOMMAND; + } + for (i = 0; i < sizeof(commandWords)/sizeof(*commandWords); i++){ + if(smallString.compare( commandWords[i]) == 0) + return COMMANDWORD; + } + for (i = 0; i < sizeof(ignoredCommandWords)/sizeof(*ignoredCommandWords); i++){ + if(smallString.compare( ignoredCommandWords[i]) == 0) + return IGNOREDCOMMANDWORD; + } + for (i = 0; i < sizeof(commandLines)/sizeof(*commandLines); i++){ + if(smallString.compare( commandLines[i]) == 0) + return COMMANDLINE; + } + for (i = 0; i < sizeof(ignoreCommandLines)/sizeof(*ignoreCommandLines); i++){ + if(smallString.compare( ignoreCommandLines[i]) == 0) + return IGNOREDCOMMANDLINE; + } + for (i = 0; i < sizeof(commandParagraph)/sizeof(*commandParagraph); i++){ + if(smallString.compare( commandParagraph[i]) == 0) + return COMMANDPARAGRAPH; + } + for (i = 0; i < sizeof(ignoreCommandParagraphs)/sizeof(*ignoreCommandParagraphs); i++){ + if(smallString.compare( ignoreCommandParagraphs[i]) == 0) + return IGNORECOMMANDPARAGRAPH; + } + for (i = 0; i < sizeof(commandEndCommands)/sizeof(*commandEndCommands); i++){ + if(smallString.compare( commandEndCommands[i]) == 0) + return COMMANDENDCOMMAND; + } + for (i = 0; i < sizeof(commandWordParagraphs)/sizeof(*commandWordParagraphs); i++){ + if(smallString.compare( commandWordParagraphs[i]) == 0) + return COMMANDWORDPARAGRAPH; + } + for (i = 0; i < sizeof(commandWordLines)/sizeof(*commandWordLines); i++){ + if(smallString.compare( commandWordLines[i]) == 0) + return COMMANDWORDLINE; + } + for (i = 0; i < sizeof(commandWordOWordOWords)/sizeof(*commandWordOWordOWords); i++){ + if(smallString.compare( commandWordOWordOWords[i]) == 0) + return COMMANDWORDOWORDWORD; + } + for (i = 0; i < sizeof(commandOWords)/sizeof(*commandOWords); i++){ + if(smallString.compare( commandOWords[i]) == 0) + return COMMANDOWORD; + } + for (i = 0; i < sizeof(commandErrorThrowings)/sizeof(*commandErrorThrowings); i++){ + if(smallString.compare( commandErrorThrowings[i]) == 0) + return COMMANDERRORTHROW; + } + for (i = 0; i < sizeof(commandUniques)/sizeof(*commandUniques); i++){ + if(smallString.compare( commandUniques[i]) == 0) + return COMMANDUNIQUE; + } + return 0; } /* Returns the next word ON THE CURRENT LINE ONLY @@ -191,46 +206,46 @@ int commandBelongs(std::string theCommand){ * Updates the index it is given if success. */ std::string getNextWord(TokenList &tokList){ - Token nextToken = tokList.peek(); - if (nextToken.tokenType == PLAINSTRING ){ - nextToken = tokList.next(); - return nextToken.tokenString; - } - return ""; + Token nextToken = tokList.peek(); + if (nextToken.tokenType == PLAINSTRING ){ + nextToken = tokList.next(); + return nextToken.tokenString; + } + return ""; } /* Returns the location of the end of the line as * an iterator. */ std::list::iterator getOneLine(TokenList &tokList){ - std::list::iterator endOfLine = tokList.iteratorCopy(); - while(endOfLine!= tokList.end()){ - if ((* endOfLine).tokenType == END_LINE){ - //cout << "REACHED END" << endl; - //endOfLine++; - return endOfLine; - } - //cout << (* endOfLine).toString(); - endOfLine++; - } - - return tokList.end(); - } + std::list::iterator endOfLine = tokList.iteratorCopy(); + while(endOfLine!= tokList.end()){ + if ((* endOfLine).tokenType == END_LINE){ + //cout << "REACHED END" << endl; + //endOfLine++; + return endOfLine; + } + //cout << (* endOfLine).toString(); + endOfLine++; + } + + return tokList.end(); + } /* Returns a properly formatted std::string * up til ANY command or end of line is encountered. */ std::string getStringTilCommand(TokenList &tokList){ - std::string description; - if (tokList.peek().tokenType == 0) return ""; - while(tokList.peek().tokenType == PLAINSTRING){ - Token currentToken = tokList.next(); - if(currentToken.tokenType == PLAINSTRING) { - description = description + currentToken.tokenString + " "; - } - } - return description; - } + std::string description; + if (tokList.peek().tokenType == 0) return ""; + while(tokList.peek().tokenType == PLAINSTRING){ + Token currentToken = tokList.next(); + if(currentToken.tokenType == PLAINSTRING) { + description = description + currentToken.tokenString + " "; + } + } + return description; + } /* Returns a properly formatted std::string * up til the command specified is encountered @@ -238,66 +253,66 @@ std::string getStringTilCommand(TokenList &tokList){ //TODO check that this behaves properly for formulas std::string getStringTilEndCommand(std::string theCommand, TokenList &tokList){ - std::string description; - if (tokList.peek().tokenType == 0) return ""; - while(tokList.peek().tokenString.compare(theCommand) != 0 ){ - Token currentToken = tokList.next(); - description = description + currentToken.tokenString + " "; - } - return description; - } + std::string description; + if (tokList.peek().tokenType == 0) return ""; + while(tokList.peek().tokenString.compare(theCommand) != 0 ){ + Token currentToken = tokList.next(); + description = description + currentToken.tokenString + " "; + } + return description; + } /* Returns the end of a Paragraph as an iterator- * Paragraph is defined in Doxygen to be a paragraph of text * seperate by either a structural command or a blank line */ std::list::iterator getEndOfParagraph(TokenList &tokList){ - std::list::iterator endOfParagraph = tokList.iteratorCopy(); - while(endOfParagraph != tokList.end()){ - if ((* endOfParagraph).tokenType == END_LINE){ - endOfParagraph++; - if ((* endOfParagraph).tokenType == END_LINE){ - endOfParagraph++; - //cout << "ENCOUNTERED END OF PARA" << endl; - return endOfParagraph; - } - } - else if ((* endOfParagraph).tokenType == COMMAND){ - if(isSectionIndicator((* endOfParagraph).tokenString)) return endOfParagraph; - else endOfParagraph++; - } - else if((* endOfParagraph).tokenType == PLAINSTRING) { - endOfParagraph++; - } - else return tokList.end(); - } - return tokList.end(); - } + std::list::iterator endOfParagraph = tokList.iteratorCopy(); + while(endOfParagraph != tokList.end()){ + if ((* endOfParagraph).tokenType == END_LINE){ + endOfParagraph++; + if ((* endOfParagraph).tokenType == END_LINE){ + endOfParagraph++; + //cout << "ENCOUNTERED END OF PARA" << endl; + return endOfParagraph; + } + } + else if ((* endOfParagraph).tokenType == COMMAND){ + if(isSectionIndicator((* endOfParagraph).tokenString)) return endOfParagraph; + else endOfParagraph++; + } + else if((* endOfParagraph).tokenType == PLAINSTRING) { + endOfParagraph++; + } + else return tokList.end(); + } + return tokList.end(); + } /* Returns the end of a section, defined as the first blank line OR first encounter of the same * command. Example of this behaviour is \arg * if no end is encountered, returns the last token of the std::list. */ std::list::iterator getEndOfSection(std::string theCommand, TokenList &tokList){ - std::list::iterator endOfParagraph = tokList.iteratorCopy(); - while(endOfParagraph != tokList.end()){ - if ((* endOfParagraph).tokenType == COMMAND){ - if(theCommand.compare((*endOfParagraph).tokenString) == 0) return endOfParagraph; - else endOfParagraph++; - } - else if((* endOfParagraph).tokenType == PLAINSTRING) { - endOfParagraph++; - } - else if ((* endOfParagraph).tokenType == END_LINE){ - endOfParagraph++; - if ((* endOfParagraph).tokenType == END_LINE){ - endOfParagraph++; - return endOfParagraph; - } - } - } - return tokList.end(); - } + std::list::iterator endOfParagraph = tokList.iteratorCopy(); + while(endOfParagraph != tokList.end()){ + if ((* endOfParagraph).tokenType == COMMAND){ + if(theCommand.compare((*endOfParagraph).tokenString) == 0) return endOfParagraph; + else endOfParagraph++; + } + else if((* endOfParagraph).tokenType == PLAINSTRING) { + endOfParagraph++; + } + else if ((* endOfParagraph).tokenType == END_LINE){ + endOfParagraph++; + if ((* endOfParagraph).tokenType == END_LINE){ + endOfParagraph++; + return endOfParagraph; + } + } + } + return tokList.end(); + } /* This method is for returning the end of a specific form of doxygen command * that begins with a \command and ends in \endcommand @@ -306,26 +321,27 @@ std::list::iterator getEndOfSection(std::string theCommand, TokenList &to * If the end is never encountered, it returns the end of the std::list. */ std::list::iterator getEndCommand(std::string theCommand, TokenList &tokList){ - std::list::iterator endOfCommand = tokList.iteratorCopy(); - while (endOfCommand!= tokList.end()){ - if ((*endOfCommand).tokenType == COMMAND){ - if (theCommand.compare((* endOfCommand).tokenString) == 0){ - return endOfCommand; - } - endOfCommand++; - } - } - //End command not found - return tokList.end(); + std::list::iterator endOfCommand = tokList.iteratorCopy(); + while (endOfCommand!= tokList.end()){ + if ((*endOfCommand).tokenType == COMMAND){ + if (theCommand.compare((* endOfCommand).tokenString) == 0){ + return endOfCommand; + } + endOfCommand++; + } + } + //End command not found + return tokList.end(); } /* A specialty method for commands such as \arg that end at the end of a paragraph OR when another \arg is encountered */ //TODO getTilAnyCommand std::list::iterator getTilAnyCommand(std::string theCommand, TokenList &tokList){ - std::list::iterator anIterator; - return anIterator; - } +#pragma unused(theCommand,tokList) + std::list::iterator anIterator; + return anIterator; +} @@ -335,325 +351,349 @@ std::list::iterator getTilAnyCommand(std::string theCommand, TokenList &t * Plain commands, such as newline etc, they contain no other data * \n \\ \@ \& \$ \# \< \> \% */ - int addSimpleCommand(std::string theCommand, std::list &doxyList){ - if (noisy) cout << "Parsing " << theCommand << endl; - doxyList.push_back(DoxygenEntity(theCommand)); - return 1; - } - - /* NOT INCLUDED Simple Commands - * Format: @command - * Plain commands, such as newline etc, they contain no other data - */ - int ignoreSimpleCommand(std::string theCommand, std::list &doxyList){ - if (noisy) cout << "Not Adding " << theCommand << endl; - return 1; - } - - /* CommandWord - * Format: @command - * Commands with a single WORD after then such as @b - * "a", "b", "c", "e", "em", "p", "def", "enum", "example", "package", - * "relates", "namespace", "relatesalso","anchor", "dontinclude", "include", "includelineno" - */ - int addCommandWord(std::string theCommand, TokenList &tokList, std::list &doxyList){ - if (noisy) cout << "Parsing " << theCommand << endl; - std::string name = getNextWord(tokList); - if (!name.empty()){ - doxyList.push_back(DoxygenEntity(theCommand, name)); - return 1; - } - else cout << "No word followed " << theCommand << " command. Not added" << endl; - return 0; - } - - /* NOT INCLUDED CommandWord - * Format: @command - * Commands with a single WORD after then such as @b - * "copydoc", "copybrief", "copydetails", "verbinclude", "htmlinclude" - */ - int ignoreCommandWord(std::string theCommand, TokenList &tokList, std::list &doxyList){ - if (noisy) cout << "Not Adding " << theCommand << endl; - std::string name = getNextWord(tokList); - if (!name.empty()){ - return 1; - } - else cout << "WARNING: No word followed " << theCommand << " command." << endl; - return 0; - } - - /* CommandLine - * Format: @command (line) - * Commands with a single LINE after then such as @var - * "addindex", "fn", "name", "line", "var", "skipline", "typedef", "skip", "until", "property" - */ - int addCommandLine(std::string theCommand, TokenList &tokList, std::list &doxyList){ - if (noisy) cout << "Parsing " << theCommand << endl; - std::list::iterator endOfLine = getOneLine(tokList); - std::list aNewList; - aNewList = parse(endOfLine, tokList); - doxyList.push_back( DoxygenEntity(theCommand, aNewList)); - return 1; - } - - /* NOT INCLUDED CommandLine - * Format: @command (line) - * Commands with a single LINE after then such as @var - * - */ - int ignoreCommandLine(std::string theCommand, TokenList &tokList, std::list &doxyList){ - if (noisy) cout << "Not Adding " << theCommand << endl; - std::list::iterator endOfLine = getOneLine(tokList); - tokList.setIterator(endOfLine); - return 1; +int addSimpleCommand(std::string theCommand, std::list &doxyList){ + if (noisy) cout << "Parsing " << theCommand << endl; + doxyList.push_back(DoxygenEntity(theCommand)); + return 1; } - /* CommandParagraph - * Format: @command {paragraph} - * Commands with a single paragraph after then such as @return - * "return", "remarks", "since", "test", "sa", "see", "pre", "post", "details", "invariant", - * "deprecated", "date", "note", "warning", "version", "todo", "bug", "attention", "brief", "arg", "author" - */ - int addCommandParagraph(std::string theCommand, TokenList &tokList, std::list &doxyList){ - if (noisy) cout << "Parsing " << theCommand << endl; - std::list::iterator endOfParagraph = getEndOfParagraph(tokList); - std::list aNewList; - aNewList = parse(endOfParagraph, tokList); - doxyList.push_back( DoxygenEntity(theCommand, aNewList)); - return 1; - } - - /* CommandParagraph - * Format: @command {paragraph} - * Commands with a single LINE after then such as @var - * - */ - int ignoreCommandParagraph(std::string theCommand, TokenList &tokList, std::list &doxyList){ - if (noisy) cout << "Not Adding " << theCommand << endl; - std::list::iterator endOfParagraph = getEndOfParagraph(tokList); - tokList.setIterator(endOfParagraph); - return 1; +/* NOT INCLUDED Simple Commands +* Format: @command +* Plain commands, such as newline etc, they contain no other data +*/ +int ignoreSimpleCommand(std::string theCommand, std::list &doxyList){ +#pragma unused(doxyList) + if (noisy) cout << "Not Adding " << theCommand << endl; + return 1; } - /* Command EndCommand - * Format: @command and ends at @endcommand - * Commands that take in a block of text such as @code - * "code", "dot", "msc", "f$", "f[", "f{environment}{", "htmlonly", "latexonly", "manonly", - * "verbatim", "xmlonly", "cond", "if", "ifnot", "link" - * Returns 1 if success, 0 if the endcommand is never encountered. - */ - int addCommandEndCommand(std::string theCommand, TokenList &tokList, std::list &doxyList){ - if (noisy) cout << "Not Adding " << theCommand << endl; - std::string description = getStringTilEndCommand( "end" + theCommand, tokList); - doxyList.push_back(DoxygenEntity(theCommand, description)); - return 1; - } +/* CommandWord +* Format: @command +* Commands with a single WORD after then such as @b +* "a", "b", "c", "e", "em", "p", "def", "enum", "example", "package", +* "relates", "namespace", "relatesalso","anchor", "dontinclude", "include", "includelineno" +*/ +int addCommandWord(std::string theCommand, TokenList &tokList, std::list &doxyList){ + if (noisy) cout << "Parsing " << theCommand << endl; + std::string name = getNextWord(tokList); + if (!name.empty()){ + doxyList.push_back(DoxygenEntity(theCommand, name)); + return 1; + } + else + cout << "No word followed " << theCommand << " command. Not added" << endl; + return 0; +} - /* CommandWordParagraph - * Format: @command {paragraph} - * Commands such as param - * "param", "tparam", "throw", "retval", "exception" - */ - int addCommandWordParagraph(std::string theCommand, TokenList &tokList, std::list &doxyList){ - if (noisy) cout << "Parsing " << theCommand << endl; - std::string name = getNextWord(tokList); - if (name.empty()){ - cout << "No word followed " << theCommand << " command. Not added" << endl; - return 0; - } - std::list::iterator endOfParagraph = getEndOfParagraph(tokList); - std::list aNewList; - aNewList = parse(endOfParagraph, tokList); - aNewList.push_front(DoxygenEntity("plainstd::string", name)); - doxyList.push_back(DoxygenEntity(theCommand, aNewList)); - return 1; - } - - /* CommandWordLine - * Format: @command (line) - * Commands such as param - * "page", "subsection", "subsubsection", "section", "paragraph", "defgroup" - */ - int addCommandWordLine(std::string theCommand, TokenList &tokList, std::list &doxyList){ - if (noisy) cout << "Parsing " << theCommand << endl; - std::string name = getNextWord(tokList); - if (name.empty()){ - cout << "No word followed " << theCommand << " command. Not added" << endl; - return 0; - } - std::list::iterator endOfLine = getOneLine(tokList); - std::list aNewList; - aNewList = parse(endOfLine, tokList); - aNewList.push_front(DoxygenEntity("plainstd::string", name)); - doxyList.push_back(DoxygenEntity(theCommand, aNewList)); - return 1; - - //else cout << "No line followed " << theCommand << " command. Not added" << endl; - } +/* NOT INCLUDED CommandWord +* Format: @command +* Commands with a single WORD after then such as @b +* "copydoc", "copybrief", "copydetails", "verbinclude", "htmlinclude" +*/ +int ignoreCommandWord(std::string theCommand, TokenList &tokList, std::list &doxyList){ +#pragma unused(doxyList) + if (noisy) + cout << "Not Adding " << theCommand << endl; + std::string name = getNextWord(tokList); + if (!name.empty()) + return 1; + else + cout << "WARNING: No word followed " << theCommand << " command." << endl; + return 0; +} - /* Command Word Optional Word Optional Word - * Format: @command [] [] - * Commands such as class - * "category", "class", "protocol", "interface", "struct", "union" - */ - int addCommandWordOWordOWord(std::string theCommand, TokenList &tokList, std::list &doxyList){ - if (noisy) cout << "Parsing " << theCommand << endl; - std::string name = getNextWord(tokList); - if (name.empty()){ - cout << "No word followed " << theCommand << " command. Not added" << endl; - return 0; - } - std::string headerfile = getNextWord(tokList); - std::string headername = getNextWord(tokList); - std::list aNewList; - aNewList.push_back(DoxygenEntity("plainstd::string", name)); - if (!headerfile.empty()) aNewList.push_back(DoxygenEntity("plainstd::string", headerfile)); - if (!headername.empty()) aNewList.push_back(DoxygenEntity("plainstd::string", headername)); - doxyList.push_back(DoxygenEntity(theCommand, aNewList)); - return 1; - } +/* CommandLine +* Format: @command (line) +* Commands with a single LINE after then such as @var +* "addindex", "fn", "name", "line", "var", "skipline", "typedef", "skip", "until", "property" +*/ +int addCommandLine(std::string theCommand, TokenList &tokList, std::list &doxyList){ + if (noisy) + cout << "Parsing " << theCommand << endl; + std::list::iterator endOfLine = getOneLine(tokList); + std::list aNewList = parse(endOfLine, tokList); + doxyList.push_back( DoxygenEntity(theCommand, aNewList)); + return 1; +} + +/* NOT INCLUDED CommandLine +* Format: @command (line) +* Commands with a single LINE after then such as @var +* +*/ +int ignoreCommandLine(std::string theCommand, TokenList &tokList, std::list &doxyList){ +#pragma unused(doxyList) + if (noisy) + cout << "Not Adding " << theCommand << endl; + std::list::iterator endOfLine = getOneLine(tokList); + tokList.setIterator(endOfLine); + return 1; +} + +/* CommandParagraph +* Format: @command {paragraph} +* Commands with a single paragraph after then such as @return +* "return", "remarks", "since", "test", "sa", "see", "pre", "post", "details", "invariant", +* "deprecated", "date", "note", "warning", "version", "todo", "bug", "attention", "brief", "arg", "author" +*/ +int addCommandParagraph(std::string theCommand, TokenList &tokList, std::list &doxyList){ + if (noisy) + cout << "Parsing " << theCommand << endl; + std::list::iterator endOfParagraph = getEndOfParagraph(tokList); + std::list aNewList; + aNewList = parse(endOfParagraph, tokList); + doxyList.push_back( DoxygenEntity(theCommand, aNewList)); + return 1; +} - /* Command Optional Word - * Format: @command [] - * Commands such as dir - * "dir", "file", "cond" - */ - int addCommandOWord(std::string theCommand, TokenList &tokList, std::list &doxyList){ - if (noisy) cout << "Parsing " << theCommand << endl; - std::string name = getNextWord(tokList); - doxyList.push_back(DoxygenEntity(theCommand, name)); - return 1; - } +/* CommandParagraph +* Format: @command {paragraph} +* Commands with a single LINE after then such as @var +* +*/ +int ignoreCommandParagraph(std::string theCommand, TokenList &tokList, std::list &doxyList){ +#pragma unused(doxyList) + if (noisy) + cout << "Not Adding " << theCommand << endl; + std::list::iterator endOfParagraph = getEndOfParagraph(tokList); + tokList.setIterator(endOfParagraph); + return 1; +} + +/* Command EndCommand +* Format: @command and ends at @endcommand +* Commands that take in a block of text such as @code +* "code", "dot", "msc", "f$", "f[", "f{environment}{", "htmlonly", "latexonly", "manonly", +* "verbatim", "xmlonly", "cond", "if", "ifnot", "link" +* Returns 1 if success, 0 if the endcommand is never encountered. +*/ +int addCommandEndCommand(std::string theCommand, TokenList &tokList, std::list &doxyList){ + if (noisy) + cout << "Not Adding " << theCommand << endl; + std::string description = getStringTilEndCommand( "end" + theCommand, tokList); + doxyList.push_back(DoxygenEntity(theCommand, description)); + return 1; +} + +/* CommandWordParagraph +* Format: @command {paragraph} +* Commands such as param +* "param", "tparam", "throw", "retval", "exception" +*/ +int addCommandWordParagraph(std::string theCommand, TokenList &tokList, std::list &doxyList){ + if (noisy) + cout << "Parsing " << theCommand << endl; + std::string name = getNextWord(tokList); + if (name.empty()){ + cout << "No word followed " << theCommand << " command. Not added" << endl; + return 0; + } + std::list::iterator endOfParagraph = getEndOfParagraph(tokList); + std::list aNewList; + aNewList = parse(endOfParagraph, tokList); + aNewList.push_front(DoxygenEntity("plainstd::string", name)); + doxyList.push_back(DoxygenEntity(theCommand, aNewList)); + return 1; +} + +/* CommandWordLine +* Format: @command (line) +* Commands such as param +* "page", "subsection", "subsubsection", "section", "paragraph", "defgroup" +*/ +int addCommandWordLine(std::string theCommand, TokenList &tokList, std::list &doxyList){ + if (noisy) cout << "Parsing " << theCommand << endl; + std::string name = getNextWord(tokList); + if (name.empty()){ + cout << "No word followed " << theCommand << " command. Not added" << endl; + return 0; + } + std::list::iterator endOfLine = getOneLine(tokList); + std::list aNewList; + aNewList = parse(endOfLine, tokList); + aNewList.push_front(DoxygenEntity("plainstd::string", name)); + doxyList.push_back(DoxygenEntity(theCommand, aNewList)); + return 1; + //else cout << "No line followed " << theCommand << " command. Not added" << endl; +} + +/* Command Word Optional Word Optional Word +* Format: @command [] [] +* Commands such as class +* "category", "class", "protocol", "interface", "struct", "union" +*/ +int addCommandWordOWordOWord(std::string theCommand, TokenList &tokList, std::list &doxyList){ + if (noisy) + cout << "Parsing " << theCommand << endl; + std::string name = getNextWord(tokList); + if (name.empty()){ + cout << "No word followed " << theCommand << " command. Not added" << endl; + return 0; + } + std::string headerfile = getNextWord(tokList); + std::string headername = getNextWord(tokList); + std::list aNewList; + aNewList.push_back(DoxygenEntity("plainstd::string", name)); + if (!headerfile.empty()) + aNewList.push_back(DoxygenEntity("plainstd::string", headerfile)); + if (!headername.empty()) + aNewList.push_back(DoxygenEntity("plainstd::string", headername)); + doxyList.push_back(DoxygenEntity(theCommand, aNewList)); + return 1; +} + +/* Command Optional Word +* Format: @command [] +* Commands such as dir +* "dir", "file", "cond" +*/ +int addCommandOWord(std::string theCommand, TokenList &tokList, std::list &doxyList){ + if (noisy) + cout << "Parsing " << theCommand << endl; + std::string name = getNextWord(tokList); + doxyList.push_back(DoxygenEntity(theCommand, name)); + return 1; +} /* Commands that should not be encountered (such as PHP only) * goes til the end of line then returns */ - int addCommandErrorThrow(std::string theCommand, TokenList &tokList, std::list &doxyList){ - cout << "Encountered :" << theCommand << endl; - cout << "This command should not have been encountered. Behaviour past this may be unpredictable " << endl; - std::list::iterator endOfLine = getOneLine(tokList); - tokList.setIterator(endOfLine); - return 0; +int addCommandErrorThrow(std::string theCommand, TokenList &tokList, std::list &doxyList){ +#pragma unused(doxyList) + cout << "Encountered :" << theCommand << endl; + cout << "This command should not have been encountered. Behaviour past this may be unpredictable " << endl; + std::list::iterator endOfLine = getOneLine(tokList); + tokList.setIterator(endOfLine); + return 0; } /* Adds the unique commands- different process for each unique command */ - int addCommandUnique(std::string theCommand, TokenList &tokList, std::list &doxyList){ - std::list aNewList; - if (theCommand.compare("arg") == 0 || theCommand.compare("li") == 0){ - std::list::iterator endOfSection = getEndOfSection(theCommand, tokList); - std::list aNewList; - aNewList = parse(endOfSection, tokList); - doxyList.push_back( DoxygenEntity(theCommand, aNewList)); - } - // \xrefitem "(heading)" "(std::list title)" {text} - else if (theCommand.compare("xrefitem") == 0){ - //TODO Implement xrefitem - if (noisy) cout << "Not Adding " << theCommand << endl; - std::list::iterator endOfParagraph = getEndOfParagraph(tokList); - tokList.setIterator(endOfParagraph); - return 1; - } - // \ingroup ( [ ]) - else if (theCommand.compare("ingroup") == 0){ - std::string name = getNextWord(tokList); - aNewList.push_back(DoxygenEntity("plainstd::string", name)); - name = getNextWord(tokList); - if(!name.empty()) aNewList.push_back(DoxygenEntity("plainstd::string", name)); - name = getNextWord(tokList); - if(!name.empty()) aNewList.push_back(DoxygenEntity("plainstd::string", name)); - doxyList.push_back(DoxygenEntity(theCommand, aNewList)); - return 1; - } - // \par [(paragraph title)] { paragraph } - else if (theCommand.compare("par") == 0){ - std::list::iterator endOfLine = getOneLine(tokList); - aNewList = parse(endOfLine, tokList); - std::list aNewList2; - aNewList2 = parse(endOfLine, tokList); - aNewList.splice(aNewList.end(), aNewList2); - doxyList.push_back(DoxygenEntity(theCommand, aNewList)); - return 1; - } - // \headerfile [] - else if (theCommand.compare("headerfile") == 0){ - std::list aNewList; - std::string name = getNextWord(tokList); - aNewList.push_back(DoxygenEntity("plainstd::string", name)); - name = getNextWord(tokList); - if(!name.empty()) aNewList.push_back(DoxygenEntity("plainstd::string", name)); - doxyList.push_back(DoxygenEntity(theCommand, aNewList)); - return 1; - } - // \overload [(function declaration)] - else if (theCommand.compare("overload") == 0){ - std::list::iterator endOfLine = getOneLine(tokList); - if (endOfLine != tokList.current()){ - std::list aNewList; - aNewList = parse(endOfLine, tokList); - doxyList.push_back(DoxygenEntity(theCommand, aNewList)); - } - else doxyList.push_back(DoxygenEntity(theCommand)); - return 1; - } - // \weakgroup [(title)] - else if (theCommand.compare("weakgroup") == 0){ - if (noisy) cout << "Parsing " << theCommand << endl; - std::string name = getNextWord(tokList); - if (name.empty()){ - cout << "No word followed " << theCommand << " command. Not added" << endl; - return 0; - } - std::list aNewList; - std::list::iterator endOfLine = getOneLine(tokList); - if (endOfLine != tokList.current()) { - aNewList = parse(endOfLine, tokList); - } - aNewList.push_front(DoxygenEntity("plainstd::string", name)); - doxyList.push_back(DoxygenEntity(theCommand, aNewList)); - } - // \ref ["(text)"] - else if (theCommand.compare("ref") == 0){ - //TODO Implement ref - if (noisy) cout << "Not Adding " << theCommand << endl; - std::list::iterator endOfParagraph = getEndOfParagraph(tokList); - tokList.setIterator(endOfParagraph); - } - // \subpage ["(text)"] - else if (theCommand.compare("subpage") == 0){ - //TODO implement subpage - if (noisy) cout << "Not Adding " << theCommand << endl; - std::list::iterator endOfParagraph = getEndOfParagraph(tokList); - tokList.setIterator(endOfParagraph); - } - // \dotfile ["caption"] - else if (theCommand.compare("dotfile") == 0){ - //TODO implement dotfile - if (noisy) cout << "Not Adding " << theCommand << endl; - std::list::iterator endOfParagraph = getEndOfParagraph(tokList); - tokList.setIterator(endOfParagraph); - } - // \image ["caption"] [=] - else if (theCommand.compare("image") == 0){ - //todo implement image - } - // \addtogroup [(title)] - else if (theCommand.compare("addtogroup") == 0){ - if (noisy) cout << "Parsing " << theCommand << endl; - std::string name = getNextWord(tokList); - if (name.empty()){ - cout << "No word followed " << theCommand << " command. Not added" << endl; - return 0; - } - std::list aNewList; - std::list::iterator endOfLine = getOneLine(tokList); - if (endOfLine != tokList.current()) { - aNewList = parse(endOfLine, tokList); - } - aNewList.push_front(DoxygenEntity("plainstd::string", name)); - doxyList.push_back(DoxygenEntity(theCommand, aNewList)); - } - return 0; - } +int addCommandUnique(std::string theCommand, TokenList &tokList, std::list &doxyList){ + std::list aNewList; + if (theCommand.compare("arg") == 0 || theCommand.compare("li") == 0){ + std::list::iterator endOfSection = getEndOfSection(theCommand, tokList); + std::list aNewList; + aNewList = parse(endOfSection, tokList); + doxyList.push_back( DoxygenEntity(theCommand, aNewList)); + } + // \xrefitem "(heading)" "(std::list title)" {text} + else if (theCommand.compare("xrefitem") == 0){ + //TODO Implement xrefitem + if (noisy) + cout << "Not Adding " << theCommand << endl; + std::list::iterator endOfParagraph = getEndOfParagraph(tokList); + tokList.setIterator(endOfParagraph); + return 1; + } + // \ingroup ( [ ]) + else if (theCommand.compare("ingroup") == 0){ + std::string name = getNextWord(tokList); + aNewList.push_back(DoxygenEntity("plainstd::string", name)); + name = getNextWord(tokList); + if(!name.empty()) + aNewList.push_back(DoxygenEntity("plainstd::string", name)); + name = getNextWord(tokList); + if(!name.empty()) + aNewList.push_back(DoxygenEntity("plainstd::string", name)); + doxyList.push_back(DoxygenEntity(theCommand, aNewList)); + return 1; + } + // \par [(paragraph title)] { paragraph } + else if (theCommand.compare("par") == 0){ + std::list::iterator endOfLine = getOneLine(tokList); + aNewList = parse(endOfLine, tokList); + std::list aNewList2; + aNewList2 = parse(endOfLine, tokList); + aNewList.splice(aNewList.end(), aNewList2); + doxyList.push_back(DoxygenEntity(theCommand, aNewList)); + return 1; + } + // \headerfile [] + else if (theCommand.compare("headerfile") == 0){ + std::list aNewList; + std::string name = getNextWord(tokList); + aNewList.push_back(DoxygenEntity("plainstd::string", name)); + name = getNextWord(tokList); + if(!name.empty()) + aNewList.push_back(DoxygenEntity("plainstd::string", name)); + doxyList.push_back(DoxygenEntity(theCommand, aNewList)); + return 1; + } + // \overload [(function declaration)] + else if (theCommand.compare("overload") == 0){ + std::list::iterator endOfLine = getOneLine(tokList); + if (endOfLine != tokList.current()){ + std::list aNewList; + aNewList = parse(endOfLine, tokList); + doxyList.push_back(DoxygenEntity(theCommand, aNewList)); + } + else + doxyList.push_back(DoxygenEntity(theCommand)); + return 1; + } + // \weakgroup [(title)] + else if (theCommand.compare("weakgroup") == 0){ + if (noisy) cout << "Parsing " << theCommand << endl; + std::string name = getNextWord(tokList); + if (name.empty()){ + cout << "No word followed " << theCommand << " command. Not added" << endl; + return 0; + } + std::list aNewList; + std::list::iterator endOfLine = getOneLine(tokList); + if (endOfLine != tokList.current()) { + aNewList = parse(endOfLine, tokList); + } + aNewList.push_front(DoxygenEntity("plainstd::string", name)); + doxyList.push_back(DoxygenEntity(theCommand, aNewList)); + } + // \ref ["(text)"] + else if (theCommand.compare("ref") == 0){ + //TODO Implement ref + if (noisy) + cout << "Not Adding " << theCommand << endl; + std::list::iterator endOfParagraph = getEndOfParagraph(tokList); + tokList.setIterator(endOfParagraph); + } + // \subpage ["(text)"] + else if (theCommand.compare("subpage") == 0){ + //TODO implement subpage + if (noisy) + cout << "Not Adding " << theCommand << endl; + std::list::iterator endOfParagraph = getEndOfParagraph(tokList); + tokList.setIterator(endOfParagraph); + } + // \dotfile ["caption"] + else if (theCommand.compare("dotfile") == 0){ + //TODO implement dotfile + if (noisy) + cout << "Not Adding " << theCommand << endl; + std::list::iterator endOfParagraph = getEndOfParagraph(tokList); + tokList.setIterator(endOfParagraph); + } + // \image ["caption"] [=] + else if (theCommand.compare("image") == 0){ + //todo implement image + } + // \addtogroup [(title)] + else if (theCommand.compare("addtogroup") == 0){ + if (noisy) + cout << "Parsing " << theCommand << endl; + std::string name = getNextWord(tokList); + if (name.empty()){ + cout << "No word followed " << theCommand << " command. Not added" << endl; + return 0; + } + std::list aNewList; + std::list::iterator endOfLine = getOneLine(tokList); + if (endOfLine != tokList.current()) { + aNewList = parse(endOfLine, tokList); + } + aNewList.push_front(DoxygenEntity("plainstd::string", name)); + doxyList.push_back(DoxygenEntity(theCommand, aNewList)); + } + return 0; +} /* The actual "meat" of the doxygen parser. This is not yet fully implemented * with my current design- however the skeletal outline is contained in @@ -662,129 +702,132 @@ std::list::iterator getTilAnyCommand(std::string theCommand, TokenList &t int addCommand(std::string commandString, TokenList &tokList,std::list &doxyList){ - std::string theCommand = StringToLower(commandString); - if (theCommand.compare("plainstd::string") == 0){ - std::string nextPhrase = getStringTilCommand( tokList); - if (noisy) cout << "Parsing plain std::string :" << nextPhrase << endl; - doxyList.push_back(DoxygenEntity("plainstd::string", nextPhrase )); - return 1; - } - int commandNumber = commandBelongs(theCommand); - if (commandNumber == SIMPLECOMMAND){ - return addSimpleCommand(theCommand, doxyList); - } - if (commandNumber == IGNOREDSIMPLECOMMAND){ - return ignoreSimpleCommand(theCommand, doxyList); - } - if (commandNumber == COMMANDWORD){ - return addCommandWord(theCommand, tokList, doxyList); - } - if (commandNumber == IGNOREDCOMMANDWORD){ - return ignoreCommandWord(theCommand, tokList, doxyList); - } - if (commandNumber == COMMANDLINE ){ - return addCommandLine(theCommand, tokList, doxyList); - } - if (commandNumber == IGNOREDCOMMANDLINE ){ - return ignoreCommandLine(theCommand, tokList, doxyList); - } - if (commandNumber == COMMANDPARAGRAPH){ - return addCommandParagraph(theCommand, tokList, doxyList); - } - if (commandNumber == IGNORECOMMANDPARAGRAPH){ - return ignoreCommandParagraph(theCommand, tokList, doxyList); - } - if (commandNumber == COMMANDENDCOMMAND){ - return addCommandEndCommand(theCommand, tokList, doxyList); - } - if (commandNumber == COMMANDWORDPARAGRAPH){ - return addCommandWordParagraph(theCommand, tokList, doxyList); - } - if (commandNumber == COMMANDWORDLINE){ - return addCommandWordLine(theCommand, tokList, doxyList); - } - if (commandNumber == COMMANDWORDOWORDWORD){ - return addCommandWordOWordOWord(theCommand, tokList, doxyList); - } - if (commandNumber == COMMANDOWORD){ - return addCommandOWord(theCommand, tokList, doxyList); - } - if (commandNumber == COMMANDERRORTHROW){ - return addCommandErrorThrow(theCommand, tokList, doxyList); - } - if (commandNumber == COMMANDUNIQUE){ - return addCommandUnique(theCommand, tokList, doxyList); - } - - return 0; - } + std::string theCommand = StringToLower(commandString); + if (theCommand.compare("plainstd::string") == 0){ + std::string nextPhrase = getStringTilCommand( tokList); + if (noisy) cout << "Parsing plain std::string :" << nextPhrase << endl; + doxyList.push_back(DoxygenEntity("plainstd::string", nextPhrase )); + return 1; + } + int commandNumber = commandBelongs(theCommand); + if (commandNumber == SIMPLECOMMAND){ + return addSimpleCommand(theCommand, doxyList); + } + if (commandNumber == IGNOREDSIMPLECOMMAND){ + return ignoreSimpleCommand(theCommand, doxyList); + } + if (commandNumber == COMMANDWORD){ + return addCommandWord(theCommand, tokList, doxyList); + } + if (commandNumber == IGNOREDCOMMANDWORD){ + return ignoreCommandWord(theCommand, tokList, doxyList); + } + if (commandNumber == COMMANDLINE ){ + return addCommandLine(theCommand, tokList, doxyList); + } + if (commandNumber == IGNOREDCOMMANDLINE ){ + return ignoreCommandLine(theCommand, tokList, doxyList); + } + if (commandNumber == COMMANDPARAGRAPH){ + return addCommandParagraph(theCommand, tokList, doxyList); + } + if (commandNumber == IGNORECOMMANDPARAGRAPH){ + return ignoreCommandParagraph(theCommand, tokList, doxyList); + } + if (commandNumber == COMMANDENDCOMMAND){ + return addCommandEndCommand(theCommand, tokList, doxyList); + } + if (commandNumber == COMMANDWORDPARAGRAPH){ + return addCommandWordParagraph(theCommand, tokList, doxyList); + } + if (commandNumber == COMMANDWORDLINE){ + return addCommandWordLine(theCommand, tokList, doxyList); + } + if (commandNumber == COMMANDWORDOWORDWORD){ + return addCommandWordOWordOWord(theCommand, tokList, doxyList); + } + if (commandNumber == COMMANDOWORD){ + return addCommandOWord(theCommand, tokList, doxyList); + } + if (commandNumber == COMMANDERRORTHROW){ + return addCommandErrorThrow(theCommand, tokList, doxyList); + } + if (commandNumber == COMMANDUNIQUE){ + return addCommandUnique(theCommand, tokList, doxyList); + } + + return 0; + } std::list parse(std::list::iterator endParsingIndex, TokenList &tokList){ - std::list aNewList; - int currCommand; - while (tokList.current() != endParsingIndex){ - Token currToken = tokList.peek(); - if(noisy) cout << "Parsing for phrase starting in:" << currToken.toString() << endl; - if(currToken.tokenType == END_LINE ){ - tokList.next(); - } - else if(currToken.tokenType == COMMAND){ - currCommand = findCommand(currToken.tokenString); - if (currCommand < 0 ){ - if(noisy) cout << "Unidentified Command " << currToken.tokenString << endl; - tokList.next(); - addCommand(std::string("plainstd::string"), tokList, aNewList);} - //cout << "Command: " << currWord << " " << currCommand << endl; - else { tokList.next(); - addCommand(currToken.tokenString, tokList, aNewList); - } - } - else if (currToken.tokenType == PLAINSTRING){ - addCommand(std::string("plainstd::string"), tokList, aNewList); - } - else break; - } - return aNewList; - } + std::list aNewList; + int currCommand; + while (tokList.current() != endParsingIndex){ + Token currToken = tokList.peek(); + if(noisy) + cout << "Parsing for phrase starting in:" << currToken.toString() << endl; + if(currToken.tokenType == END_LINE ){ + tokList.next(); + } + else if(currToken.tokenType == COMMAND){ + currCommand = findCommand(currToken.tokenString); + if (currCommand < 0 ){ + if(noisy) + cout << "Unidentified Command " << currToken.tokenString << endl; + tokList.next(); + addCommand(std::string("plainstd::string"), tokList, aNewList); + } + else { tokList.next(); + addCommand(currToken.tokenString, tokList, aNewList); + } + } + else if (currToken.tokenType == PLAINSTRING){ + addCommand(std::string("plainstd::string"), tokList, aNewList); + } + break; + } + return aNewList; +} std::list parseRoot(std::list::iterator endParsingIndex, TokenList &tokList){ - std::list aNewList; - int currCommand; - while (tokList.current() != endParsingIndex){ - Token currToken = tokList.peek(); - if(noisy) cout << "Parsing for phrase starting in:" << currToken.toString() << endl; - if(currToken.tokenType == END_LINE ){ - tokList.next(); - } - else if(currToken.tokenType == COMMAND){ - currCommand = findCommand(currToken.tokenString); - if (currCommand < 0 ){ - if(noisy) cout << "Unidentified Command " << currToken.tokenString << endl; - tokList.next(); - addCommand(std::string("partofdescription"), tokList, aNewList);} - //cout << "Command: " << currWord << " " << currCommand << endl; - else { tokList.next(); - addCommand(currToken.tokenString, tokList, aNewList); - } - } - else if (currToken.tokenType == PLAINSTRING){ - addCommand(std::string("partofdescription"), tokList, aNewList); - } - } - return aNewList; - } + std::list aNewList; + int currCommand; + while (tokList.current() != endParsingIndex){ + Token currToken = tokList.peek(); + if(noisy) cout << "Parsing for phrase starting in:" << currToken.toString() << endl; + if(currToken.tokenType == END_LINE ){ + tokList.next(); + } + else if(currToken.tokenType == COMMAND){ + currCommand = findCommand(currToken.tokenString); + if (currCommand < 0 ){ + if(noisy) + cout << "Unidentified Command " << currToken.tokenString << endl; + tokList.next(); + addCommand(std::string("partofdescription"), tokList, aNewList);} + //cout << "Command: " << currWord << " " << currCommand << endl; + else { tokList.next(); + addCommand(currToken.tokenString, tokList, aNewList); + } + } + else if (currToken.tokenType == PLAINSTRING){ + addCommand(std::string("partofdescription"), tokList, aNewList); + } + } + return aNewList; +} std::list DoxygenParser::createTree(std::string doxygenBlob){ - TokenList tokList = TokenList(doxygenBlob); - if(noisy) { - cout << "---TOKEN LIST---" << endl; - tokList.printList(); - } - std::list rootList; - rootList = parseRoot( tokList.end(), tokList); - if(noisy) { - cout << "PARSED LIST" << endl; - printTree(rootList); - } - return rootList; + TokenList tokList = TokenList(doxygenBlob); + if(noisy) { + cout << "---TOKEN LIST---" << endl; + tokList.printList(); + } + std::list rootList; + rootList = parseRoot( tokList.end(), tokList); + if(noisy) { + cout << "PARSED LIST" << endl; + printTree(rootList); + } + return rootList; } From d7f2ceedd4246b9ad8f4ac6c7ee2a6bf593676d0 Mon Sep 17 00:00:00 2001 From: Jamie Kirkpatrick Date: Fri, 12 Sep 2008 11:19:32 +0000 Subject: [PATCH 032/314] Improve output so that the width of the docstrings can be controlled. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2008-cherylfoil@10841 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- .../DoxygenTranslator/src/PyDocConverter.cpp | 155 ++++++------------ Source/DoxygenTranslator/src/PyDocConverter.h | 8 +- 2 files changed, 56 insertions(+), 107 deletions(-) diff --git a/Source/DoxygenTranslator/src/PyDocConverter.cpp b/Source/DoxygenTranslator/src/PyDocConverter.cpp index 1e4d6a73e..5bbda8dc2 100644 --- a/Source/DoxygenTranslator/src/PyDocConverter.cpp +++ b/Source/DoxygenTranslator/src/PyDocConverter.cpp @@ -2,9 +2,6 @@ #include #include -#define APPROX_LINE_LENGTH 64//characters per line allowed -#define TAB_SIZE 8//characters per line allowed - //TODO {@link} {@linkplain} {@docRoot}, and other useful doxy commands that are not a pydoc tag PyDocConverter::PyDocConverter() { @@ -15,7 +12,7 @@ PyDocConverter::~PyDocConverter() { } -void PyDocConverter::printSortedTree(std::list &entityList){ +void PyDocConverter::printTree(std::list &entityList){ std::list::iterator p = entityList.begin(); while (p != entityList.end()){ (*p).printEntity(0); @@ -24,24 +21,23 @@ void PyDocConverter::printSortedTree(std::list &entityList){ } std::string PyDocConverter::formatParam(Node *n, DoxygenEntity &doxygenEntity) { - std::string result; ParmList *plist = CopyParmList(Getattr(n, "parms")); Parm *p = NULL; DoxygenEntity& paramNameEntity = *doxygenEntity.entityList.begin(); DoxygenEntity& paramDescriptionEntity = *(++doxygenEntity.entityList.begin()); + std::string result; + std::string paramDescription = formatCommand(paramDescriptionEntity.data, DOC_PARAM_STRING_LENGTH); + for (p = plist; p;) { if(Char(Getattr(p, "name")) == paramNameEntity.data) { std::string name = Char(Swig_name_make(n, 0, Getattr(p, "name"), 0, 0)); std::string type = Char(Swig_name_make(n, 0, Getattr(p, "type"), 0, 0)); - std::ostringstream parameterDocString; - - parameterDocString << std::endl << name << " (" << type << ") -- "; - parameterDocString << paramDescriptionEntity.data; - - result = parameterDocString.str(); + result = name + " (" + type + ") "; + result.resize(DOC_PARAM_STRING_LENGTH - 3, ' '); + result += "-- " + paramDescription.substr(DOC_PARAM_STRING_LENGTH); break; } p = Getattr(p, "tmap:in") ? Getattr(p, "tmap:in:next") : nextSibling(p); @@ -51,88 +47,33 @@ std::string PyDocConverter::formatParam(Node *n, DoxygenEntity &doxygenEntity) { return result; } -std::string PyDocConverter::formatCommand(std::string unformattedLine, int indent){ - std::string formattedLines = "\n"; - int lastPosition = 0; - signed int i = 0; - bool isFirstLine = true; - while (i != -1 && i < (int)unformattedLine.length()){ - lastPosition = i; - if (isFirstLine){ - i+=APPROX_LINE_LENGTH; - } - else i+=APPROX_LINE_LENGTH - indent*TAB_SIZE; - i = unformattedLine.find(" ", i); - - if (i > 0 && i + 1 < (int)unformattedLine.length()){ - if (!isFirstLine) for (int j = 0; j < indent; j++) { - formattedLines.append("\t"); - } - else { - isFirstLine = false; - } - formattedLines.append(unformattedLine.substr(lastPosition, i - lastPosition + 1)); - formattedLines.append("\n"); - +std::string PyDocConverter::formatCommand(std::string documentString, int indent, int maxWidth){ + std::ostringstream formattedString; + std::string currentLine; + + for(std::string::iterator stringPosition = documentString.begin(); stringPosition != documentString.end(); ++stringPosition) + { + if(currentLine.length() == 0) + currentLine.resize(indent, ' '); + + currentLine += *stringPosition; + + if(*stringPosition == ' ' && (int)currentLine.size() >= maxWidth || (stringPosition + 1) == documentString.end()) + { + formattedString << currentLine << std::endl; + currentLine = ""; } } - if (lastPosition < (int)unformattedLine.length()){ - if (!isFirstLine) {for (int j = 0; j < indent; j++) {formattedLines.append("\t");}} - formattedLines.append(unformattedLine.substr(lastPosition, unformattedLine.length() - lastPosition)); - } - - return formattedLines; + + return formattedString.str(); } -/* Contains the conversions for tags - * could probably be much more efficient... - */ -std::string PyDocConverter::pyDocFormat(DoxygenEntity &doxygenEntity){ - if(doxygenEntity.typeOfEntity.compare("partofdescription") == 0){ - return doxygenEntity.data; - } - if (doxygenEntity.typeOfEntity.compare("plainstd::string") == 0){ - return doxygenEntity.data; - } - else if (doxygenEntity.typeOfEntity.compare("b") == 0){ - return "" + doxygenEntity.data + ""; - } - else if (doxygenEntity.typeOfEntity.compare("c") == 0){ - return "" + doxygenEntity.data + ""; - } - else if (doxygenEntity.typeOfEntity.compare("@") == 0){ - return "@"; - } - else if (doxygenEntity.typeOfEntity.compare("\\") == 0){ - return "\\"; - } - else if (doxygenEntity.typeOfEntity.compare("<") == 0){ - return "<"; - } - else if (doxygenEntity.typeOfEntity.compare(">") == 0){ - return ">"; - } - else if (doxygenEntity.typeOfEntity.compare("&") == 0){ - return "&"; - } - else if (doxygenEntity.typeOfEntity.compare("#") == 0){ - return "#"; - } - else if (doxygenEntity.typeOfEntity.compare("%") == 0){ - return "%"; - } - else if (doxygenEntity.typeOfEntity.compare("~") == 0){ - return "~"; - } - return ""; -} - - std::string PyDocConverter::translateSubtree( DoxygenEntity &doxygenEntity){ std::string returnedString; - if (doxygenEntity.isLeaf){ return pyDocFormat(doxygenEntity) + " ";} + if (doxygenEntity.isLeaf) + return doxygenEntity.data + " "; else { - returnedString += pyDocFormat(doxygenEntity); + returnedString += doxygenEntity.data; std::list::iterator p = doxygenEntity.entityList.begin(); while (p != doxygenEntity.entityList.end()){ returnedString+= translateSubtree(*p); @@ -150,8 +91,8 @@ std::string PyDocConverter::translateEntity(Node *n, DoxygenEntity &doxyEntity){ return formatCommand(std::string(translateSubtree(doxyEntity)), 0) + "\n * ";} if(doxyEntity.typeOfEntity.compare("plainstd::string")== 0 - || doxyEntity.typeOfEntity.compare("deprecated")== 0 - || doxyEntity.typeOfEntity.compare("brief")== 0) + || doxyEntity.typeOfEntity.compare("deprecated")== 0 + || doxyEntity.typeOfEntity.compare("brief")== 0) return formatCommand(doxyEntity.data, 0) + "\n * "; if(doxyEntity.typeOfEntity.compare("see") == 0) @@ -159,33 +100,38 @@ std::string PyDocConverter::translateEntity(Node *n, DoxygenEntity &doxyEntity){ if(doxyEntity.typeOfEntity.compare("param") == 0) return formatParam(n, doxyEntity); + + if(doxyEntity.typeOfEntity.compare("return")== 0) + - if(doxyEntity.typeOfEntity.compare("return")== 0 - || doxyEntity.typeOfEntity.compare("author")== 0 - || doxyEntity.typeOfEntity.compare("param")== 0 - || doxyEntity.typeOfEntity.compare("since")== 0 - || doxyEntity.typeOfEntity.compare("version")== 0 - || doxyEntity.typeOfEntity.compare("exception") == 0 - || doxyEntity.typeOfEntity.compare("deprecated") == 0) + if(doxyEntity.typeOfEntity.compare("author")== 0 + || doxyEntity.typeOfEntity.compare("param")== 0 + || doxyEntity.typeOfEntity.compare("since")== 0 + || doxyEntity.typeOfEntity.compare("version")== 0 + || doxyEntity.typeOfEntity.compare("exception") == 0 + || doxyEntity.typeOfEntity.compare("deprecated") == 0) return formatCommand(std::string("@" + doxyEntity.typeOfEntity + "\t" + translateSubtree(doxyEntity)), 2); if(doxyEntity.typeOfEntity.compare("sa")== 0) return formatCommand(std::string("@see\t\t" + translateSubtree(doxyEntity)), 2); - return formatCommand(pyDocFormat(doxyEntity), 0); + return formatCommand(doxyEntity.data, 0); } std::string PyDocConverter::convertToPyDoc(Node *n, std::list entityList){ - entityList.sort(CompareDoxygenEntities()); + std::string pyDocString = "\"\"\"\n"; - if(debug){ - std::cout << "---RESORTED LIST---" << std::endl; - printSortedTree(entityList); - } - - std::string pyDocString = "\"\"\""; + bool inParamsSection = false; for(std::list::iterator entityIterator = entityList.begin(); entityIterator != entityList.end();){ + if(entityIterator->typeOfEntity.compare("param") == 0 && !inParamsSection) + { + inParamsSection = true; + pyDocString += "\nArguments:\n"; + } + else if(entityIterator->typeOfEntity.compare("param") != 0 && inParamsSection) + inParamsSection = false; + pyDocString += translateEntity(n, *entityIterator); entityIterator++; } @@ -194,7 +140,8 @@ std::string PyDocConverter::convertToPyDoc(Node *n, std::list ent if(debug){ std::cout << "\n---RESULT IN PYDOC---" << std::endl; - std::cout << pyDocString; + std::cout << pyDocString; + std::cout << std::endl; } return pyDocString; diff --git a/Source/DoxygenTranslator/src/PyDocConverter.h b/Source/DoxygenTranslator/src/PyDocConverter.h index 27faaf6c3..4c7fdd4db 100644 --- a/Source/DoxygenTranslator/src/PyDocConverter.h +++ b/Source/DoxygenTranslator/src/PyDocConverter.h @@ -6,18 +6,20 @@ #include "swig.h" #include "DoxygenEntity.h" +#define DOC_STRING_LENGTH 64 // characters per line allowed +#define DOC_PARAM_STRING_LENGTH 30 // characters reserved for param name / type + class PyDocConverter { public: PyDocConverter(); std::string convertToPyDoc(Node *n, std::list entityList); ~PyDocConverter(); - void printSortedTree(std::list &entityList); + void printTree(std::list &entityList); protected: std::string formatParam(Node *n, DoxygenEntity &doxygenEntity); - std::string formatCommand(std::string unformattedLine, int indent); - std::string pyDocFormat(DoxygenEntity &doxygenEntity); + std::string formatCommand(std::string unformattedLine, int indent, int maxWidth = DOC_STRING_LENGTH); std::string translateSubtree( DoxygenEntity &doxygenEntity); std::string translateEntity(Node *n, DoxygenEntity &doxyEntity); From 0f41d25c0938566f4037fd117526f848009d3887 Mon Sep 17 00:00:00 2001 From: Jamie Kirkpatrick Date: Fri, 12 Sep 2008 11:19:53 +0000 Subject: [PATCH 033/314] Ensure doxygen comments are copied to overloaded function nodes. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2008-cherylfoil@10842 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Source/CParse/parser.y | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Source/CParse/parser.y b/Source/CParse/parser.y index 95bd8701d..06b0685c6 100644 --- a/Source/CParse/parser.y +++ b/Source/CParse/parser.y @@ -1363,6 +1363,10 @@ static void default_arguments(Node *n) { if (throws) Setattr(new_function,"throws",pl); Delete(pl); } + + /* copy doxygen comments if found */ + if(Getattr(function,"DoxygenComment")) + Setattr(new_function,"DoxygenComment",Getattr(function,"DoxygenComment")); /* copy specific attributes for global (or in a namespace) template functions - these are not templated class methods */ if (strcmp(cntype,"template") == 0) { From 01695a31285dc7101b07b09deae7465caeaad0f3 Mon Sep 17 00:00:00 2001 From: Jamie Kirkpatrick Date: Fri, 12 Sep 2008 11:20:58 +0000 Subject: [PATCH 034/314] Major refactoring: translation now takes a node and returns a translated comment if there is one. This is to allow for situations where you need to use several nodes to create a comment, for example where there are multiple overloads for the same function but the target language doesnt support overloading: in this case we want to combine comments to explain the possible overloads. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2008-cherylfoil@10843 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- .../src/DoxygenTranslator.cpp | 63 ++++---- .../DoxygenTranslator/src/DoxygenTranslator.h | 58 ++++++- .../src/JavaDocConverter.cpp | 51 +++--- .../DoxygenTranslator/src/JavaDocConverter.h | 34 ++-- .../DoxygenTranslator/src/PyDocConverter.cpp | 59 ++++--- Source/DoxygenTranslator/src/PyDocConverter.h | 43 +++++- Source/Modules/java.cxx | 145 +++++++++--------- Source/Modules/python.cxx | 58 ++++--- Source/Swig/misc.c | 11 ++ Source/Swig/swig.h | 3 +- 10 files changed, 324 insertions(+), 201 deletions(-) diff --git a/Source/DoxygenTranslator/src/DoxygenTranslator.cpp b/Source/DoxygenTranslator/src/DoxygenTranslator.cpp index fc74c5c20..025670796 100644 --- a/Source/DoxygenTranslator/src/DoxygenTranslator.cpp +++ b/Source/DoxygenTranslator/src/DoxygenTranslator.cpp @@ -1,43 +1,32 @@ -#include "DoxygenParser.h" +/* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * + * DoxygenTranslator.cpp + * + * Module to return documentation for nodes formatted for various documentation + * systems. + * ----------------------------------------------------------------------------- */ + #include "DoxygenTranslator.h" -#include -#include -#include -#include "DoxygenEntity.h" #include "JavaDocConverter.h" #include "PyDocConverter.h" -DoxygenParser doxyParse; -JavaDocConverter jDC; -PyDocConverter pyDC; - -DoxygenTranslator::DoxygenTranslator(){ - doxyParse = DoxygenParser(); - JavaDocConverter jDC = JavaDocConverter(); - PyDocConverter pyDC = PyDocConverter(); -} - -DoxygenTranslator::~DoxygenTranslator(){ - -} - - -char *DoxygenTranslator::convert(Node *n, char* doxygenBlob, char* option){ - - std::list rootList = doxyParse.createTree(std::string(doxygenBlob)); - std::string returnedString; - - if(strcmp(option, "JAVADOC") == 0) - returnedString = jDC.convertToJavaDoc(n, rootList); - else if(strcmp(option, "PYDOC") == 0) - returnedString = pyDC.convertToPyDoc(n, rootList); - else - std::cout << "Option not current supported." << std::endl; - - char *nonConstString; - nonConstString = (char *)malloc(returnedString.length() + 1); - strcpy(nonConstString, returnedString.c_str()); - - return nonConstString; +bool DoxygenTranslator::getDocumentation(Node *node, DocumentationFormat format, String *&documentation){ + switch(format){ + case JavaDoc: + return JavaDocConverter().getDocumentation(node, documentation); + case PyDoc: + return PyDocConverter().getDocumentation(node, documentation); + default: + return false; + } } +void DoxygenTranslator::printTree(std::list &entityList){ + std::list::iterator p = entityList.begin(); + while (p != entityList.end()){ + (*p).printEntity(0); + p++; + } +} \ No newline at end of file diff --git a/Source/DoxygenTranslator/src/DoxygenTranslator.h b/Source/DoxygenTranslator/src/DoxygenTranslator.h index 3c26e3a25..4be1e97e3 100644 --- a/Source/DoxygenTranslator/src/DoxygenTranslator.h +++ b/Source/DoxygenTranslator/src/DoxygenTranslator.h @@ -1,13 +1,65 @@ +/* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * + * DoxygenTranslator.h + * + * Module to return documentation for nodes formatted for various documentation + * systems. + * ----------------------------------------------------------------------------- */ + #ifndef DOXYGENTRANSLATOR_H_ #define DOXYGENTRANSLATOR_H_ #include "swig.h" +#include "DoxygenEntity.h" +#include +/* + * Describes the availible documentation systems + * that can be translated to. + */ +enum DocumentationFormat { + JavaDoc = 1, + PyDoc = 2 +}; + +/* + * A class to translate doxygen comments attacted to parser nodes + * into alternative formats for use in code generated for target languages. + */ class DoxygenTranslator { public: - DoxygenTranslator(); - virtual ~DoxygenTranslator(); - char* convert(Node *n, char* doxygenBlob, char* option); + /* + * Virtual destructor. + */ + virtual ~DoxygenTranslator(){} + + /* + * Return the documentation for a given node formated for the correct + * documentation system. + * @param node The node to extract and translate documentation for. + * @param format The documentation format to output. + * @param documentation The returned documentation string. + * @return A bool to indicate if there was documentation to return for the node. + */ + static bool getDocumentation(Node *node, DocumentationFormat format, String *&documentation); + +protected: + /* + * Overridden in subclasses to return the documentation formatted for a given + * documentation system. + * @param node The node to extract and translate documentation for. + * @param documentation The returned documentation string. + * @return A bool to indicate if there was documentation to return for the node. + */ + virtual bool getDocumentation(Node *node, String *&documentation) = 0; + + /* + * Prints the details of a parsed entity list to stdout (for debugging). + */ + void printTree(std::list &entityList); }; + #endif /*DOXYGENTRANSLATOR_H_*/ diff --git a/Source/DoxygenTranslator/src/JavaDocConverter.cpp b/Source/DoxygenTranslator/src/JavaDocConverter.cpp index dbf606bfd..5081156bd 100644 --- a/Source/DoxygenTranslator/src/JavaDocConverter.cpp +++ b/Source/DoxygenTranslator/src/JavaDocConverter.cpp @@ -1,31 +1,17 @@ #include "JavaDocConverter.h" +#include "DoxygenParser.h" #include #define APPROX_LINE_LENGTH 64//characters per line allowed #define TAB_SIZE 8//characters per line allowed int printSortedTree2 = 0; //TODO {@link} {@linkplain} {@docRoot}, and other useful doxy commands that are not a javadoc tag -JavaDocConverter::JavaDocConverter() -{ -} -JavaDocConverter::~JavaDocConverter() -{ -} - -void JavaDocConverter::printSortedTree(std::list &entityList){ - std::list::iterator p = entityList.begin(); - while (p != entityList.end()){ - (*p).printEntity(0); - p++; - } -} - -std::string formatCommand(std::string unformattedLine, int indent){ +std::string JavaDocConverter::formatCommand(std::string unformattedLine, int indent){ std::string formattedLines = "\n * "; int lastPosition = 0; int i = 0; int isFirstLine = 1; - while (i != -1 && i < unformattedLine.length()){ + while (i != -1 && i < (int)unformattedLine.length()){ lastPosition = i; if (isFirstLine){ i+=APPROX_LINE_LENGTH; @@ -33,7 +19,7 @@ std::string formatCommand(std::string unformattedLine, int indent){ else i+=APPROX_LINE_LENGTH - indent*TAB_SIZE; i = unformattedLine.find(" ", i); - if (i > 0 && i + 1 < unformattedLine.length()){ + if (i > 0 && i + 1 < (int)unformattedLine.length()){ if (!isFirstLine) for (int j = 0; j < indent; j++) { formattedLines.append("\t"); } @@ -45,7 +31,7 @@ std::string formatCommand(std::string unformattedLine, int indent){ } } - if (lastPosition < unformattedLine.length()){ + if (lastPosition < (int)unformattedLine.length()){ if (!isFirstLine) {for (int j = 0; j < indent; j++) {formattedLines.append("\t");}} formattedLines.append(unformattedLine.substr(lastPosition, unformattedLine.length() - lastPosition)); } @@ -56,7 +42,7 @@ std::string formatCommand(std::string unformattedLine, int indent){ /* Contains the conversions for tags * could probably be much more efficient... */ -std::string javaDocFormat(DoxygenEntity &doxygenEntity){ +std::string JavaDocConverter::javaDocFormat(DoxygenEntity &doxygenEntity){ if(doxygenEntity.typeOfEntity.compare("partofdescription") == 0){ return doxygenEntity.data; } @@ -97,7 +83,7 @@ std::string javaDocFormat(DoxygenEntity &doxygenEntity){ } -std::string translateSubtree( DoxygenEntity &doxygenEntity){ +std::string JavaDocConverter::translateSubtree( DoxygenEntity &doxygenEntity){ std::string returnedString; if (doxygenEntity.isLeaf){ return javaDocFormat(doxygenEntity) + " ";} else { @@ -111,7 +97,7 @@ std::string translateSubtree( DoxygenEntity &doxygenEntity){ return returnedString; } -std::string translateEntity(DoxygenEntity &doxyEntity){ +std::string JavaDocConverter::translateEntity(DoxygenEntity &doxyEntity){ if(doxyEntity.typeOfEntity.compare("partofdescription")== 0) return formatCommand(std::string(translateSubtree(doxyEntity)), 0); if ((doxyEntity.typeOfEntity.compare("brief") == 0)||(doxyEntity.typeOfEntity.compare("details") == 0)){ return formatCommand(std::string(translateSubtree(doxyEntity)), 0) + "\n * ";} @@ -136,13 +122,19 @@ std::string translateEntity(DoxygenEntity &doxyEntity){ return ""; } -std::string JavaDocConverter:: convertToJavaDoc(Node *n, std::list entityList){ - #pragma unused(n) +bool JavaDocConverter::getDocumentation(Node *n, String *&documentation){ + documentation = Getattr(n,"DoxygenComment"); + if(documentation == NULL) + return false; + + std::list entityList = DoxygenParser().createTree(Char(documentation)); + Delete(documentation); + entityList.sort(CompareDoxygenEntities()); - if(printSortedTree2){ + if(debug){ std::cout << "---RESORTED LIST---" << std::endl; - printSortedTree(entityList); + printTree(entityList); } std::string javaDocString = "/**"; @@ -154,10 +146,11 @@ std::string JavaDocConverter:: convertToJavaDoc(Node *n, std::list -#include -#include "swig.h" -#include "DoxygenEntity.h" +#include "DoxygenTranslator.h" -class JavaDocConverter +/* + * A class to translate doxygen comments into JavaDoc style comments. + */ +class JavaDocConverter : public DoxygenTranslator { public: - JavaDocConverter(); - std::string convertToJavaDoc(Node *n, std::list entityList); - ~JavaDocConverter(); - void printSortedTree(std::list &entityList); + JavaDocConverter() : debug( true ){} + virtual bool getDocumentation(Node *node, String *&documentation); + +protected: + std::string formatCommand(std::string unformattedLine, int indent); + std::string translateEntity(DoxygenEntity &doxyEntity); + std::string javaDocFormat(DoxygenEntity &doxygenEntity); + std::string translateSubtree( DoxygenEntity &doxygenEntity); + +private: + bool debug; }; #endif /*JAVADOCCONVERTER_H_*/ diff --git a/Source/DoxygenTranslator/src/PyDocConverter.cpp b/Source/DoxygenTranslator/src/PyDocConverter.cpp index 5bbda8dc2..2065b090e 100644 --- a/Source/DoxygenTranslator/src/PyDocConverter.cpp +++ b/Source/DoxygenTranslator/src/PyDocConverter.cpp @@ -1,4 +1,14 @@ +/* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * + * PyDocConverter.cpp + * + * Module to return documentation for nodes formatted for PyDoc + * ----------------------------------------------------------------------------- */ + #include "PyDocConverter.h" +#include "DoxygenParser.h" #include #include @@ -8,18 +18,6 @@ PyDocConverter::PyDocConverter() debug = 1; } -PyDocConverter::~PyDocConverter() -{ -} - -void PyDocConverter::printTree(std::list &entityList){ - std::list::iterator p = entityList.begin(); - while (p != entityList.end()){ - (*p).printEntity(0); - p++; - } -} - std::string PyDocConverter::formatParam(Node *n, DoxygenEntity &doxygenEntity) { ParmList *plist = CopyParmList(Getattr(n, "parms")); Parm *p = NULL; @@ -28,7 +26,7 @@ std::string PyDocConverter::formatParam(Node *n, DoxygenEntity &doxygenEntity) { DoxygenEntity& paramDescriptionEntity = *(++doxygenEntity.entityList.begin()); std::string result; - std::string paramDescription = formatCommand(paramDescriptionEntity.data, DOC_PARAM_STRING_LENGTH); + std::string paramDescription = justifyString(paramDescriptionEntity.data, DOC_PARAM_STRING_LENGTH); for (p = plist; p;) { if(Char(Getattr(p, "name")) == paramNameEntity.data) { @@ -47,7 +45,12 @@ std::string PyDocConverter::formatParam(Node *n, DoxygenEntity &doxygenEntity) { return result; } -std::string PyDocConverter::formatCommand(std::string documentString, int indent, int maxWidth){ +std::string PyDocConverter::formatReturnDescription(Node *node, DoxygenEntity &doxygenEntity){ +#pragma unused(node) + return "\nResult:\n" + justifyString(translateSubtree(doxygenEntity)); +} + +std::string PyDocConverter::justifyString(std::string documentString, int indent, int maxWidth){ std::ostringstream formattedString; std::string currentLine; @@ -85,24 +88,24 @@ std::string PyDocConverter::translateSubtree( DoxygenEntity &doxygenEntity){ std::string PyDocConverter::translateEntity(Node *n, DoxygenEntity &doxyEntity){ if(doxyEntity.typeOfEntity.compare("partofdescription")== 0) - return formatCommand(std::string(translateSubtree(doxyEntity)), 0); + return justifyString(std::string(translateSubtree(doxyEntity)), 0); if ((doxyEntity.typeOfEntity.compare("brief") == 0)||(doxyEntity.typeOfEntity.compare("details") == 0)){ - return formatCommand(std::string(translateSubtree(doxyEntity)), 0) + "\n * ";} + return justifyString(std::string(translateSubtree(doxyEntity)), 0) + "\n * ";} if(doxyEntity.typeOfEntity.compare("plainstd::string")== 0 || doxyEntity.typeOfEntity.compare("deprecated")== 0 || doxyEntity.typeOfEntity.compare("brief")== 0) - return formatCommand(doxyEntity.data, 0) + "\n * "; + return justifyString(doxyEntity.data, 0) + "\n * "; if(doxyEntity.typeOfEntity.compare("see") == 0) - return formatCommand(std::string("@" + doxyEntity.typeOfEntity + "\t\t" + translateSubtree(doxyEntity)), 2); + return justifyString(std::string("@" + doxyEntity.typeOfEntity + "\t\t" + translateSubtree(doxyEntity)), 2); if(doxyEntity.typeOfEntity.compare("param") == 0) return formatParam(n, doxyEntity); if(doxyEntity.typeOfEntity.compare("return")== 0) - + return formatReturnDescription(n, doxyEntity); if(doxyEntity.typeOfEntity.compare("author")== 0 || doxyEntity.typeOfEntity.compare("param")== 0 @@ -110,15 +113,22 @@ std::string PyDocConverter::translateEntity(Node *n, DoxygenEntity &doxyEntity){ || doxyEntity.typeOfEntity.compare("version")== 0 || doxyEntity.typeOfEntity.compare("exception") == 0 || doxyEntity.typeOfEntity.compare("deprecated") == 0) - return formatCommand(std::string("@" + doxyEntity.typeOfEntity + "\t" + translateSubtree(doxyEntity)), 2); + return justifyString(std::string("@" + doxyEntity.typeOfEntity + "\t" + translateSubtree(doxyEntity)), 2); if(doxyEntity.typeOfEntity.compare("sa")== 0) - return formatCommand(std::string("@see\t\t" + translateSubtree(doxyEntity)), 2); + return justifyString(std::string("@see\t\t" + translateSubtree(doxyEntity)), 2); - return formatCommand(doxyEntity.data, 0); + return justifyString(doxyEntity.data); } -std::string PyDocConverter::convertToPyDoc(Node *n, std::list entityList){ +bool PyDocConverter::getDocumentation(Node *n, String *&documentation){ + documentation = Getattr(n,"DoxygenComment"); + if(documentation == NULL) + return false; + + std::list entityList = DoxygenParser().createTree(Char(documentation)); + Delete(documentation); + std::string pyDocString = "\"\"\"\n"; bool inParamsSection = false; @@ -144,5 +154,6 @@ std::string PyDocConverter::convertToPyDoc(Node *n, std::list ent std::cout << std::endl; } - return pyDocString; + documentation = NewString(pyDocString.c_str()); + return true; } \ No newline at end of file diff --git a/Source/DoxygenTranslator/src/PyDocConverter.h b/Source/DoxygenTranslator/src/PyDocConverter.h index 4c7fdd4db..5da58e4ec 100644 --- a/Source/DoxygenTranslator/src/PyDocConverter.h +++ b/Source/DoxygenTranslator/src/PyDocConverter.h @@ -1,3 +1,12 @@ +/* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * + * PyDocConverter.h + * + * Module to return documentation for nodes formatted for PyDoc + * ----------------------------------------------------------------------------- */ + #ifndef PYDOCCONVERTER_H_ #define PYDOCCONVERTER_H_ @@ -5,21 +14,41 @@ #include #include "swig.h" #include "DoxygenEntity.h" +#include "DoxygenTranslator.h" #define DOC_STRING_LENGTH 64 // characters per line allowed #define DOC_PARAM_STRING_LENGTH 30 // characters reserved for param name / type -class PyDocConverter +class PyDocConverter : public DoxygenTranslator { public: PyDocConverter(); - std::string convertToPyDoc(Node *n, std::list entityList); - ~PyDocConverter(); - void printTree(std::list &entityList); - + bool getDocumentation(Node *node, String *&documentation); + protected: - std::string formatParam(Node *n, DoxygenEntity &doxygenEntity); - std::string formatCommand(std::string unformattedLine, int indent, int maxWidth = DOC_STRING_LENGTH); + /* + * Format the doxygen comment relating to a function or method parameter + * @param node The parse tree node that the parameter relates to. + * @param doxygenEntity The doxygen entity relating to the parameter docstring. + */ + std::string formatParam(Node *node, DoxygenEntity &doxygenEntity); + + /* + * Format the doxygen comment relating to the return value for a method or function. + * @param node The parse tree node that the parameter relates to. + * @param doxygenEntity The doxygen entity relating to the parameter docstring. + */ + std::string formatReturnDescription(Node *node, DoxygenEntity &doxygenEntity); + + /* + * Format a string so it is justified and split over several lines + * not exeeding a given length. + * @param unformattedLine The string to justify and split. + * @param indent An optional number of spaces to indent each line by. + * @param maxWidth The approximate maximum line width. + */ + std::string justifyString(std::string unformattedLine, int indent = 0, int maxWidth = DOC_STRING_LENGTH); + std::string translateSubtree( DoxygenEntity &doxygenEntity); std::string translateEntity(Node *n, DoxygenEntity &doxyEntity); diff --git a/Source/Modules/java.cxx b/Source/Modules/java.cxx index edb88ebbb..42ba5b396 100644 --- a/Source/Modules/java.cxx +++ b/Source/Modules/java.cxx @@ -91,10 +91,6 @@ class JAVA:public Language { Setline(p, Getline(n)); return p; } - /* DOXYGEN TO JAVADOC globals */ - //TODO make this bool a command line option - DoxygenTranslator doxyTranslator; - public: @@ -124,7 +120,7 @@ public: global_variable_flag(false), old_variable_names(false), member_func_flag(false), - doxygen_javadoc_flag(true), + doxygen_javadoc_flag(true), comment_creation_chatter(false), imclass_name(NULL), module_class_name(NULL), @@ -160,7 +156,6 @@ public: should be easy to implement though */ director_multiple_inheritance = 0; director_language = 1; - doxyTranslator = DoxygenTranslator(); } /* ----------------------------------------------------------------------------- @@ -508,12 +503,13 @@ public: Printf(f_module, "%s\n", module_imports); if (doxygen_javadoc_flag){ - if (Getattr(n,"DoxygenComment")){ - if(comment_creation_chatter) Printf(f_module, "/* This was generated from top() */"); - char *convertedString = doxyTranslator.convert(n, Char(Getattr(n,"DoxygenComment")),"JAVADOC"); - Printf(f_module, convertedString); - free(convertedString); - } + String *doxygen_comments; + if(DoxygenTranslator::getDocumentation(n, JavaDoc,doxygen_comments)){ + if(comment_creation_chatter) + Printf(f_module, "/* This was generated from top() */"); + Printf(f_module, Char(doxygen_comments)); + Delete(doxygen_comments); + } } if (Len(module_class_modifiers) > 0) Printf(f_module, "%s ", module_class_modifiers); @@ -1234,15 +1230,17 @@ public: // Add extra indentation Replaceall(enum_code, "\n", "\n "); Replaceall(enum_code, " \n", "\n"); - //translate and write javadoc comment if flagged - if (doxygen_javadoc_flag){ - if (Getattr(n,"DoxygenComment")){ - if(comment_creation_chatter) Printv(proxy_class_constants_code, "/* This was generated from enumvalueDeclaration */", NIL ); - char *convertedString = doxyTranslator.convert(n, Char(Getattr(n,"DoxygenComment")),"JAVADOC"); - Printv(proxy_class_constants_code, convertedString, NIL); - free(convertedString); - } + + //translate and write javadoc comment if flagged + if (doxygen_javadoc_flag){ + String *doxygen_comments; + if(DoxygenTranslator::getDocumentation(n, JavaDoc,doxygen_comments)){ + if(comment_creation_chatter) + Printf(proxy_class_constants_code, "/* This was generated from enumvalueDeclaration() */"); + Printf(proxy_class_constants_code, Char(doxygen_comments)); + Delete(doxygen_comments); } + } Printv(proxy_class_constants_code, " ", enum_code, "\n\n", NIL); } else { @@ -1308,12 +1306,13 @@ public: //translate and write javadoc comment if flagged if (doxygen_javadoc_flag){ - if (Getattr(n,"DoxygenComment")){ - if(comment_creation_chatter) Printf(enum_code, "/* This was generated from enumvalueDeclaration() */" ); - char *convertedString = doxyTranslator.convert(n, Char(Getattr(n,"DoxygenComment")),"JAVADOC"); - Printf(enum_code, convertedString); - free(convertedString); - } + String *doxygen_comments; + if(DoxygenTranslator::getDocumentation(n, JavaDoc,doxygen_comments)){ + if(comment_creation_chatter) + Printf(enum_code, "/* This was generated from enumvalueDeclaration() */"); + Printf(enum_code, Char(doxygen_comments)); + Delete(doxygen_comments); + } } { EnumFeature enum_feature = decodeEnumFeature(parentNode(n)); @@ -1379,15 +1378,16 @@ public: * file * ------------------------------------------------------------------------ */ virtual int doxygenComment(Node *n){ - if (doxygen_javadoc_flag){ - if (Getattr(n,"DoxygenComment")){ - if(comment_creation_chatter) Printv(structuralComments, "/* This was generated from doxygenComment() */\n", NIL); - char *convertedString = doxyTranslator.convert(n, Char(Getattr(n,"DoxygenComment")),"JAVADOC"); - Printv(structuralComments, convertedString, NIL); - free(convertedString); - } - } - return SWIG_OK; + if (doxygen_javadoc_flag){ + String *doxygen_comments; + if(DoxygenTranslator::getDocumentation(n, JavaDoc, doxygen_comments)){ + if(comment_creation_chatter) + Printf(structuralComments, "/* This was generated from doxygenComment() */"); + Printf(structuralComments, Char(doxygen_comments)); + Delete(doxygen_comments); + } + } + return SWIG_OK; } /* ----------------------------------------------------------------------- @@ -1408,14 +1408,16 @@ public: String *tm; String *return_type = NewString(""); String *constants_code = NewString(""); + //translate and write javadoc comment if flagged if (doxygen_javadoc_flag){ - if (Getattr(n,"DoxygenComment")){ - if(comment_creation_chatter) Printf(constants_code, "/* This was generated from enumvalueDeclaration */\n"); - char *convertedString = doxyTranslator.convert(n, Char(Getattr(n,"DoxygenComment")),"JAVADOC"); - Printf(constants_code, convertedString); - free(convertedString); - } + String *doxygen_comments; + if(DoxygenTranslator::getDocumentation(n, JavaDoc, doxygen_comments)){ + if(comment_creation_chatter) + Printf(constants_code, "/* This was generated from constantWrapper() */"); + Printf(constants_code, Char(doxygen_comments)); + Delete(doxygen_comments); + } } if (!addSymbol(symname, n)) @@ -1681,12 +1683,13 @@ public: //translate and write javadoc comment if flagged if (doxygen_javadoc_flag){ - if (Getattr(n,"DoxygenComment")){ - if(comment_creation_chatter) Printv(proxy_class_def, "/* This was generated from emitProxyClassDefAndCPPCasts() */\n", NIL ); - char *convertedString = doxyTranslator.convert(n, Char(Getattr(n,"DoxygenComment")),"JAVADOC"); - Printv(proxy_class_def, convertedString, NIL); - free(convertedString); - } + String *doxygen_comments; + if(DoxygenTranslator::getDocumentation(n, JavaDoc, doxygen_comments)){ + if(comment_creation_chatter) + Printf(proxy_class_def, "/* This was generated from emitProxyClassDefAndCPPCasts() */"); + Printf(proxy_class_def, Char(doxygen_comments)); + Delete(doxygen_comments); + } } // Start writing the proxy class @@ -2021,15 +2024,15 @@ public: setter_flag = (Cmp(Getattr(n, "sym:name"), Swig_name_set(Swig_name_member(proxy_class_name, variable_name))) == 0); } - //translate and write javadoc comment if flagged if (doxygen_javadoc_flag){ - if (Getattr(n,"DoxygenComment")){ - if(comment_creation_chatter) Printf(function_code, "/* This was generated from proxyclassfunctionhandler */"); - char *convertedString = doxyTranslator.convert(n, Char(Getattr(n,"DoxygenComment")),"JAVADOC"); - Printf(function_code, convertedString); - free(convertedString); - } + String *doxygen_comments; + if(DoxygenTranslator::getDocumentation(n, JavaDoc, doxygen_comments)){ + if(comment_creation_chatter) + Printf(function_code, "/* This was generated from proxyclassfunctionhandler() */"); + Printf(function_code, Char(doxygen_comments)); + Delete(doxygen_comments); + } } /* Start generating the proxy function */ @@ -2254,15 +2257,16 @@ public: tm = Getattr(n, "tmap:jtype"); // typemaps were attached earlier to the node Printf(im_return_type, "%s", tm); - //translate and write javadoc comment if flagged - if (doxygen_javadoc_flag){ - if (Getattr(n,"DoxygenComment")){ - if(comment_creation_chatter) Printf(function_code, "/* This was generated from constructionhandler */\n" ); - char *convertedString = doxyTranslator.convert(n, Char(Getattr(n,"DoxygenComment")),"JAVADOC"); - Printf(function_code, convertedString); - free(convertedString); - } - } + //translate and write javadoc comment if flagged + if (doxygen_javadoc_flag){ + String *doxygen_comments; + if(DoxygenTranslator::getDocumentation(n, JavaDoc, doxygen_comments)){ + if(comment_creation_chatter) + Printf(function_code, "/* This was generated from constructionhandler() */"); + Printf(function_code, Char(doxygen_comments)); + Delete(doxygen_comments); + } + } Printf(function_code, " %s %s(", methodmods, proxy_class_name); Printf(helper_code, " static private %s SwigConstruct%s(", im_return_type, proxy_class_name); @@ -2525,14 +2529,15 @@ public: String *pre_code = NewString(""); String *post_code = NewString(""); - //translate and write javadoc comment if flagged + // translate and write javadoc comment if flagged if (doxygen_javadoc_flag){ - if (Getattr(n,"DoxygenComment")){ - if(comment_creation_chatter) Printf(function_code, "/* This was generated from moduleClassFunctionHandler() */\n" ); - char *convertedString = doxyTranslator.convert(n, Char(Getattr(n,"DoxygenComment")),"JAVADOC"); - Printf(function_code, convertedString); - free(convertedString); - } + String *doxygen_comments; + if(DoxygenTranslator::getDocumentation(n, JavaDoc, doxygen_comments)){ + if(comment_creation_chatter) + Printf(function_code, "/* This was generated from moduleClassFunctionHandler() */"); + Printf(function_code, Char(doxygen_comments)); + Delete(doxygen_comments); + } } if (l) { diff --git a/Source/Modules/python.cxx b/Source/Modules/python.cxx index ba02eae2e..94b3c1377 100644 --- a/Source/Modules/python.cxx +++ b/Source/Modules/python.cxx @@ -18,6 +18,7 @@ char cvsroot_python_cxx[] = "$Id: python.cxx 10453 2008-05-15 21:18:44Z wsfulton static int treduce = SWIG_cparse_template_reduce(0); #include +#include #include "../DoxygenTranslator/src/DoxygenTranslator.h" #define PYSHADOW_MEMBER 0x2 @@ -85,8 +86,6 @@ static int extranative = 0; static int outputtuple = 0; static int nortti = 0; -static DoxygenTranslator doxyTranslator; - /* flags for the make_autodoc function */ enum autodoc_t { AUTODOC_CLASS, @@ -2906,19 +2905,18 @@ public: } } Printf(f_shadow, ":\n"); - - //translate and write pydoc comment if flagged - if (doxygen){ - if (Getattr(n,"DoxygenComment")){ - //if(comment_creation_chatter) Printf(function_code, "/* This was generated from classHandler */"); - char *convertedString = doxyTranslator.convert(n, Char(Getattr(n,"DoxygenComment")), "PYDOC"); - Printf(f_shadow, Char(pythoncode(convertedString, shadow_indent))); - free(convertedString); - } + + // translate and write pydoc comment if flagged + if (doxygen){ + String *doxygen_comments; + if(DoxygenTranslator::getDocumentation(n, PyDoc, doxygen_comments)){ + Printf(f_shadow, Char(pythoncode(doxygen_comments, shadow_indent))); + Delete(doxygen_comments); } + } - // otherwise use default docstrings if requested - else if (have_docstring(n)) { + // otherwise use default docstrings if requested + else if (have_docstring(n)) { String *str = docstring(n, AUTODOC_CLASS, tab4); if (str != NULL && Len(str)) Printv(f_shadow, tab4, str, "\n", NIL); @@ -3130,15 +3128,33 @@ public: } else { Printv(f_shadow, tab4, "def ", symname, "(",parms , ")", returnTypeAnnotation(n), ":", NIL); Printv(f_shadow, "\n", NIL); - if (doxygen) { - if (Getattr(n,"DoxygenComment")){ - //if(comment_creation_chatter) Printf(function_code, "/* This was generated from classHandler */"); - char *convertedString = doxyTranslator.convert(n, Char(Getattr(n,"DoxygenComment")), "PYDOC"); - Printf(f_shadow, Char(pythoncode(convertedString, tab8))); - free(convertedString); - } + if (doxygen) { + /*Node *documented_node = n; + if(Getattr(n, "sym:overloaded")){ + // If the function is overloaded then this funciton is called + // for the last one. Rewind to the first so the docstrings are + // in order. + while (Getattr(documented_node, "sym:previousSibling")) + documented_node = Getattr(documented_node, "sym:previousSibling"); + + int real_overload_count = 0; + std::ostringstream all_documentation; + + // for each real method (not a generated overload) append the documentation + while(documented_node){ + if(!is_generated_overload(documented_node) && Getattr(documented_node,"DoxygenComment")){ + all_documentation << "Overload " << ++real_overload_count << ":" << std::endl; + all_documentation << Char(Getattr(documented_node,"DoxygenComment")) << std::endl; + } + documented_node = Getattr(documented_node, "sym:nextSibling"); } - if (have_docstring(n)) + + char *convertedString = doxyTranslator.convert(n,const_cast< char *>(all_documentation.str().c_str()), "PYDOC"); + Printf(f_shadow, Char(pythoncode(convertedString, tab8))); + free(convertedString); + }*/ + } + else if (have_docstring(n)) Printv(f_shadow, tab8, docstring(n, AUTODOC_METHOD, tab8), "\n", NIL); if (have_pythonprepend(n)) { fproxy = 0; diff --git a/Source/Swig/misc.c b/Source/Swig/misc.c index d29250517..a9c64011e 100644 --- a/Source/Swig/misc.c +++ b/Source/Swig/misc.c @@ -1032,6 +1032,17 @@ String *Swig_string_rxspencer(String *s) { } #endif +/* ------------------------------------------------------------ + * is_generated_overload() + * Check if the function is an automatically generated + * overload created because a method has default parameters. + * ------------------------------------------------------------ */ +int Swig_is_generated_overload(Node *n) +{ + Node *base_method = Getattr(n, "sym:overloaded"); + Node *default_args = Getattr(n, "defaultargs"); + return ((base_method != NULL) && (default_args != NULL) && (base_method == default_args)); +} /* ----------------------------------------------------------------------------- * Swig_init() diff --git a/Source/Swig/swig.h b/Source/Swig/swig.h index 451de86c4..3f736bbd5 100644 --- a/Source/Swig/swig.h +++ b/Source/Swig/swig.h @@ -300,8 +300,9 @@ extern int ParmList_is_compactdefargs(ParmList *p); extern void Swig_init(void); extern void Swig_warn(const char *filename, int line, const char *msg); - + extern int Swig_value_wrapper_mode(int mode); + extern int Swig_is_generated_overload(Node *n); #define WARNING(msg) Swig_warn(__FILE__,__LINE__,msg) From 83cef07b9025935338499a0b2b9fd70bb7d4706a Mon Sep 17 00:00:00 2001 From: Jamie Kirkpatrick Date: Fri, 12 Sep 2008 11:21:40 +0000 Subject: [PATCH 035/314] Multiple documentation sections are now concatted into one where there are various overloads for methods with the same name. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2008-cherylfoil@10844 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- .../src/JavaDocConverter.cpp | 2 - .../DoxygenTranslator/src/PyDocConverter.cpp | 101 +++++++++++++----- Source/DoxygenTranslator/src/PyDocConverter.h | 13 +++ Source/Modules/python.cxx | 29 +---- 4 files changed, 95 insertions(+), 50 deletions(-) diff --git a/Source/DoxygenTranslator/src/JavaDocConverter.cpp b/Source/DoxygenTranslator/src/JavaDocConverter.cpp index 5081156bd..0ba97fc60 100644 --- a/Source/DoxygenTranslator/src/JavaDocConverter.cpp +++ b/Source/DoxygenTranslator/src/JavaDocConverter.cpp @@ -128,8 +128,6 @@ bool JavaDocConverter::getDocumentation(Node *n, String *&documentation){ return false; std::list entityList = DoxygenParser().createTree(Char(documentation)); - Delete(documentation); - entityList.sort(CompareDoxygenEntities()); if(debug){ diff --git a/Source/DoxygenTranslator/src/PyDocConverter.cpp b/Source/DoxygenTranslator/src/PyDocConverter.cpp index 2065b090e..dbee97233 100644 --- a/Source/DoxygenTranslator/src/PyDocConverter.cpp +++ b/Source/DoxygenTranslator/src/PyDocConverter.cpp @@ -9,8 +9,9 @@ #include "PyDocConverter.h" #include "DoxygenParser.h" -#include #include +#include +#include //TODO {@link} {@linkplain} {@docRoot}, and other useful doxy commands that are not a pydoc tag PyDocConverter::PyDocConverter() @@ -121,39 +122,91 @@ std::string PyDocConverter::translateEntity(Node *n, DoxygenEntity &doxyEntity){ return justifyString(doxyEntity.data); } -bool PyDocConverter::getDocumentation(Node *n, String *&documentation){ - documentation = Getattr(n,"DoxygenComment"); - if(documentation == NULL) - return false; - - std::list entityList = DoxygenParser().createTree(Char(documentation)); - Delete(documentation); - - std::string pyDocString = "\"\"\"\n"; - +std::string PyDocConverter::processEntityList(Node *n, std::list& entityList){ + std::string result; bool inParamsSection = false; for(std::list::iterator entityIterator = entityList.begin(); entityIterator != entityList.end();){ - if(entityIterator->typeOfEntity.compare("param") == 0 && !inParamsSection) - { + if(entityIterator->typeOfEntity.compare("param") == 0 && !inParamsSection){ inParamsSection = true; - pyDocString += "\nArguments:\n"; + result += "\nArguments:\n"; } else if(entityIterator->typeOfEntity.compare("param") != 0 && inParamsSection) inParamsSection = false; - pyDocString += translateEntity(n, *entityIterator); + result += translateEntity(n, *entityIterator); entityIterator++; - } + } + + return result; +} - pyDocString += "\n\"\"\"\n"; +bool PyDocConverter::getDocumentation(Node *n, String *&documentation){ + std::string pyDocString, result; - if(debug){ - std::cout << "\n---RESULT IN PYDOC---" << std::endl; - std::cout << pyDocString; - std::cout << std::endl; + // for overloaded functions we must concat documentation for underlying overloads + if(Checkattr(n, "kind", "function") && Getattr(n, "sym:overloaded")){ + // rewind to the first overload + while (Getattr(n, "sym:previousSibling")) + n = Getattr(n, "sym:previousSibling"); + + std::vector allDocumentation; + + // for each real method (not a generated overload) append the documentation + while(n){ + documentation = Getattr(n,"DoxygenComment"); + if(!Swig_is_generated_overload(n) && documentation){ + std::list entityList = DoxygenParser().createTree(Char(documentation)); + allDocumentation.push_back(processEntityList(n, entityList)); + } + n = Getattr(n, "sym:nextSibling"); + } + + // construct final documentation string + if(allDocumentation.size() > 1){ + std::ostringstream concatDocString; + for(int realOverloadCount = 0; realOverloadCount < (int)allDocumentation.size(); realOverloadCount++){ + concatDocString << generateDivider(); + concatDocString << "Overload " << (realOverloadCount + 1) << ":" << std::endl; + concatDocString << generateDivider(); + concatDocString << allDocumentation[realOverloadCount] << std::endl; + } + pyDocString = concatDocString.str(); + } + else if (allDocumentation.size() == 1) { + pyDocString = *(allDocumentation.begin()); + } + } + // for other nodes just process as normal + else { + documentation = Getattr(n,"DoxygenComment"); + if(documentation != NULL){ + std::list entityList = DoxygenParser().createTree(Char(documentation)); + pyDocString = processEntityList(n, entityList); + } } - documentation = NewString(pyDocString.c_str()); - return true; -} \ No newline at end of file + // if we got something log the result and construct DOH string to return + if(pyDocString.length()) { + result = "\"\"\"\n" + pyDocString + "\"\"\"\n"; + + if(debug){ + std::cout << "\n---RESULT IN PYDOC---" << std::endl; + std::cout << result; + std::cout << std::endl; + } + + documentation = NewString(result.c_str()); + return true; + } + + return false; +} + +std::string PyDocConverter::generateDivider(){ + std::ostringstream dividerString; + for(int i = 0; i < DOC_STRING_LENGTH; i++) + dividerString << '-'; + dividerString << std::endl; + return dividerString.str(); +} diff --git a/Source/DoxygenTranslator/src/PyDocConverter.h b/Source/DoxygenTranslator/src/PyDocConverter.h index 5da58e4ec..500e39fe8 100644 --- a/Source/DoxygenTranslator/src/PyDocConverter.h +++ b/Source/DoxygenTranslator/src/PyDocConverter.h @@ -26,6 +26,14 @@ public: bool getDocumentation(Node *node, String *&documentation); protected: + + /* + * Process the contents of the entity list producing a documentation string. + * @param node The parse tree node that the entity list relates to. + * @param entityList The entity list to process + */ + std::string processEntityList(Node *node, std::list& entityList); + /* * Format the doxygen comment relating to a function or method parameter * @param node The parse tree node that the parameter relates to. @@ -51,6 +59,11 @@ protected: std::string translateSubtree( DoxygenEntity &doxygenEntity); std::string translateEntity(Node *n, DoxygenEntity &doxyEntity); + + /* + * Utility method to generate a diving line for a documentation string. + */ + std::string generateDivider(); private: bool debug; diff --git a/Source/Modules/python.cxx b/Source/Modules/python.cxx index 94b3c1377..8a3160ef3 100644 --- a/Source/Modules/python.cxx +++ b/Source/Modules/python.cxx @@ -3129,30 +3129,11 @@ public: Printv(f_shadow, tab4, "def ", symname, "(",parms , ")", returnTypeAnnotation(n), ":", NIL); Printv(f_shadow, "\n", NIL); if (doxygen) { - /*Node *documented_node = n; - if(Getattr(n, "sym:overloaded")){ - // If the function is overloaded then this funciton is called - // for the last one. Rewind to the first so the docstrings are - // in order. - while (Getattr(documented_node, "sym:previousSibling")) - documented_node = Getattr(documented_node, "sym:previousSibling"); - - int real_overload_count = 0; - std::ostringstream all_documentation; - - // for each real method (not a generated overload) append the documentation - while(documented_node){ - if(!is_generated_overload(documented_node) && Getattr(documented_node,"DoxygenComment")){ - all_documentation << "Overload " << ++real_overload_count << ":" << std::endl; - all_documentation << Char(Getattr(documented_node,"DoxygenComment")) << std::endl; - } - documented_node = Getattr(documented_node, "sym:nextSibling"); - } - - char *convertedString = doxyTranslator.convert(n,const_cast< char *>(all_documentation.str().c_str()), "PYDOC"); - Printf(f_shadow, Char(pythoncode(convertedString, tab8))); - free(convertedString); - }*/ + String *doxygen_comments; + if(DoxygenTranslator::getDocumentation(n, PyDoc, doxygen_comments)){ + Printf(f_shadow, Char(pythoncode(doxygen_comments, tab8))); + Delete(doxygen_comments); + } } else if (have_docstring(n)) Printv(f_shadow, tab8, docstring(n, AUTODOC_METHOD, tab8), "\n", NIL); From 8d28e0faadbfb6ce9a1d6695d11cc1f15fc8ccbb Mon Sep 17 00:00:00 2001 From: Jamie Kirkpatrick Date: Fri, 12 Sep 2008 11:22:04 +0000 Subject: [PATCH 036/314] Reformatting. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2008-cherylfoil@10845 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- .../DoxygenTranslator/src/PyDocConverter.cpp | 39 ++++++++----------- 1 file changed, 17 insertions(+), 22 deletions(-) diff --git a/Source/DoxygenTranslator/src/PyDocConverter.cpp b/Source/DoxygenTranslator/src/PyDocConverter.cpp index dbee97233..bb36aa382 100644 --- a/Source/DoxygenTranslator/src/PyDocConverter.cpp +++ b/Source/DoxygenTranslator/src/PyDocConverter.cpp @@ -14,8 +14,7 @@ #include //TODO {@link} {@linkplain} {@docRoot}, and other useful doxy commands that are not a pydoc tag -PyDocConverter::PyDocConverter() -{ +PyDocConverter::PyDocConverter(){ debug = 1; } @@ -88,36 +87,32 @@ std::string PyDocConverter::translateSubtree( DoxygenEntity &doxygenEntity){ } std::string PyDocConverter::translateEntity(Node *n, DoxygenEntity &doxyEntity){ - if(doxyEntity.typeOfEntity.compare("partofdescription")== 0) + if(doxyEntity.typeOfEntity.compare("partofdescription") == 0) return justifyString(std::string(translateSubtree(doxyEntity)), 0); - if ((doxyEntity.typeOfEntity.compare("brief") == 0)||(doxyEntity.typeOfEntity.compare("details") == 0)){ - return justifyString(std::string(translateSubtree(doxyEntity)), 0) + "\n * ";} + if ((doxyEntity.typeOfEntity.compare("brief") == 0) + ||(doxyEntity.typeOfEntity.compare("details") == 0)) + return justifyString(std::string(translateSubtree(doxyEntity)), 0) + "\n"; - if(doxyEntity.typeOfEntity.compare("plainstd::string")== 0 - || doxyEntity.typeOfEntity.compare("deprecated")== 0 - || doxyEntity.typeOfEntity.compare("brief")== 0) - return justifyString(doxyEntity.data, 0) + "\n * "; - - if(doxyEntity.typeOfEntity.compare("see") == 0) - return justifyString(std::string("@" + doxyEntity.typeOfEntity + "\t\t" + translateSubtree(doxyEntity)), 2); + if(doxyEntity.typeOfEntity.compare("plainstring") == 0 + || doxyEntity.typeOfEntity.compare("deprecated") == 0 + || doxyEntity.typeOfEntity.compare("brief") == 0) + return justifyString(doxyEntity.data, 0) + "\n"; if(doxyEntity.typeOfEntity.compare("param") == 0) return formatParam(n, doxyEntity); - if(doxyEntity.typeOfEntity.compare("return")== 0) + if(doxyEntity.typeOfEntity.compare("return") == 0) return formatReturnDescription(n, doxyEntity); - if(doxyEntity.typeOfEntity.compare("author")== 0 - || doxyEntity.typeOfEntity.compare("param")== 0 - || doxyEntity.typeOfEntity.compare("since")== 0 - || doxyEntity.typeOfEntity.compare("version")== 0 + if(doxyEntity.typeOfEntity.compare("author") == 0 + || doxyEntity.typeOfEntity.compare("param") == 0 + || doxyEntity.typeOfEntity.compare("since") == 0 + || doxyEntity.typeOfEntity.compare("version") == 0 || doxyEntity.typeOfEntity.compare("exception") == 0 - || doxyEntity.typeOfEntity.compare("deprecated") == 0) - return justifyString(std::string("@" + doxyEntity.typeOfEntity + "\t" + translateSubtree(doxyEntity)), 2); - - if(doxyEntity.typeOfEntity.compare("sa")== 0) - return justifyString(std::string("@see\t\t" + translateSubtree(doxyEntity)), 2); + || doxyEntity.typeOfEntity.compare("deprecated") == 0 + || doxyEntity.typeOfEntity.compare("sa") == 0) + return ""; return justifyString(doxyEntity.data); } From 2cd2dac7e6dd91f17b634f373a28cc009e067d85 Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Sat, 1 Nov 2008 21:48:20 +0000 Subject: [PATCH 037/314] type fix git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2008-cherylfoil@10895 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Doc/Manual/Doxygen.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/Manual/Doxygen.html b/Doc/Manual/Doxygen.html index 27fc013eb..54161eeb3 100644 --- a/Doc/Manual/Doxygen.html +++ b/Doc/Manual/Doxygen.html @@ -59,7 +59,7 @@ The behaviour of this functionality is wildly unpredictable if the interface fil

    To make use of the comment translation system, your documentation comments must be in properly formatted Doxygen. They can be present in your main interface file or any header file that it imports. It is advised that you are certain your comments compile properly with Doxygen before you try to translate them. -Doxygen itself is a deeper tool and can provide you better feedback for correct any syntax errors that may be present. +Doxygen itself is a deeper tool and can provide you better feedback for correcting any syntax errors that may be present. Please look at Doxygen's Documenting the code for proper specificatons for comment format.

    From 45518cd0d1c413da083d85c140c3bd640f139303 Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Tue, 13 Oct 2009 21:27:09 +0000 Subject: [PATCH 038/314] apply doxygen-svndiff.patch from #2763155 git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2008-cherylfoil@11697 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Source/CParse/cscanner.c | 4 +- Source/CParse/parser.y | 192 ++++++++++++++++-- .../DoxygenTranslator/src/DoxygenEntity.cpp | 31 ++- Source/DoxygenTranslator/src/DoxygenEntity.h | 35 +++- .../DoxygenTranslator/src/DoxygenParser.cpp | 72 +++---- .../src/Examples/DoxygenTransWTokenizer.cpp | 16 +- .../src/JavaDocConverter.cpp | 77 +++++-- .../DoxygenTranslator/src/JavaDocConverter.h | 2 +- .../DoxygenTranslator/src/PyDocConverter.cpp | 2 +- Source/DoxygenTranslator/src/Token.cpp | 1 + Source/DoxygenTranslator/src/Token.h | 5 +- Source/DoxygenTranslator/src/TokenList.cpp | 155 +++++++++----- Source/DoxygenTranslator/src/TokenList.h | 19 +- Source/Modules/java.cxx | 17 +- Source/Modules/python.cxx | 9 +- 15 files changed, 467 insertions(+), 170 deletions(-) diff --git a/Source/CParse/cscanner.c b/Source/CParse/cscanner.c index 12556dcf6..68d50cd2d 100644 --- a/Source/CParse/cscanner.c +++ b/Source/CParse/cscanner.c @@ -427,12 +427,12 @@ int yylook(void) { scanner_locator(cmt); } if (strncmp(loc, "/**<", 4) == 0 || strncmp(loc, "///<", 4) == 0||strncmp(loc, "/*!<", 4) == 0||strncmp(loc, "//!<", 4) == 0) { - printf("Doxygen Post Comment: %s lines %d-%d [%s]\n", Char(Scanner_file(scan)), Scanner_start_line(scan), Scanner_line(scan), loc); + /* printf("Doxygen Post Comment: %s lines %d-%d [%s]\n", Char(Scanner_file(scan)), Scanner_start_line(scan), Scanner_line(scan), loc); */ yylval.str = NewString(loc); return DOXYGENPOSTSTRING; } if (strncmp(loc, "/**", 3) == 0 || strncmp(loc, "///", 3) == 0||strncmp(loc, "/*!", 3) == 0||strncmp(loc, "//!", 3) == 0) { - printf("Doxygen Comment: %s lines %d-%d [%s]\n", Char(Scanner_file(scan)), Scanner_start_line(scan), Scanner_line(scan), loc); + /* printf("Doxygen Comment: %s lines %d-%d [%s]\n", Char(Scanner_file(scan)), Scanner_start_line(scan), Scanner_line(scan), loc); */ yylval.str = NewString(loc); return DOXYGENSTRING; } diff --git a/Source/CParse/parser.y b/Source/CParse/parser.y index 06b0685c6..d28516206 100644 --- a/Source/CParse/parser.y +++ b/Source/CParse/parser.y @@ -13,7 +13,7 @@ #define yylex yylex -char cvsroot_parser_y[] = "$Id: parser.y 10767 2008-08-16 07:31:05Z cherylfoil $"; +char cvsroot_parser_y[] = "$Id$"; #include "swig.h" #include "cparse.h" @@ -1575,6 +1575,7 @@ static void tag_nodes(Node *n, const String_or_char *attrname, DOH *value) { %type doxygen_comment; %type c_style_comment; %type doxygen_post_comment; +%type doxygen_post_comment_item; %% /* ====================================================================== @@ -3213,9 +3214,17 @@ c_constructor_decl : storage_class type LPAREN parms RPAREN ctor_end { doxygen_comment : DOXYGENSTRING { - while(Strchr($1,'/') == Char($1)) - Replace($1,"/","",DOH_REPLACE_FIRST); - if(isStructuralDoxygen($1)){ + /* while(Strchr($1,'/') == Char($1)) + Replace($1,"/","",DOH_REPLACE_FIRST); */ + DohReplace($1, "/**", "", 0); + DohReplace($1, "/*!", "", 0); + DohReplace($1, "///", "", 0); + DohReplace($1, "*/", "", 0); + + /* isStructuralDoxygen() is disabled, since no comment + appears in such case. Need to fix. (most commands are + not translatable to javadoc anyway) */ + if(0 && isStructuralDoxygen($1)){ $$ = new_node("doxycomm"); Setattr($$,"DoxygenComment",$1); } @@ -3231,13 +3240,26 @@ doxygen_comment : DOXYGENSTRING ; -doxygen_post_comment : DOXYGENPOSTSTRING +doxygen_post_comment_item : DOXYGENPOSTSTRING { - if(currentPostComment != 0){ - Append(currentPostComment, $1); - } - else currentPostComment = $1; - $$ = 0; + DohReplace($1, "///<", "", 0); + DohReplace($1, "/**<", "", 0); + DohReplace($1, "/*!<", "", 0); + DohReplace($1, "//!<", "", 0); + DohReplace($1, "*/", "", 0); + + $$ = $1; + } + ; + +doxygen_post_comment : doxygen_post_comment doxygen_post_comment_item + { + Append($1, $2); + $$ = $1; + } + | doxygen_post_comment_item + { + $$ = $1; } ; @@ -4541,13 +4563,38 @@ storage_class : EXTERN { $$ = "extern"; } ------------------------------------------------------------------------------ */ parms : rawparms { - Parm *p; + Parm *p, *nextSibling; $$ = $1; p = $1; - while (p) { + while (p) { + String *postComment = NULL; + nextSibling = nextSibling(p); + if (nextSibling != NULL) { + postComment = Getattr(nextSibling, "postComment"); + } else { + /* the last functino parameter has two attributes - + post comment of the previous params and its own post + comment. + */ + postComment = Getattr(p, "lastParamPostComment"); + } + if (postComment != NULL) { + String *param = NewString("\n@param "); + if (currentComment != 0) { + Append(currentComment, param); + Append(currentComment, Getattr(p, "name")); + Append(currentComment, postComment); + } + else { + currentComment = param; + Append(currentComment, Getattr(p, "name")); + Append(currentComment, postComment); + } + } + Replace(Getattr(p,"type"),"typename ", "", DOH_REPLACE_ANY); - p = nextSibling(p); - } + p = nextSibling; + } } ; @@ -4562,6 +4609,34 @@ ptail : COMMA parm ptail { set_nextSibling($2,$3); $$ = $2; } + | COMMA doxygen_post_comment parm ptail { + set_nextSibling($3,$4); + $$ = $3; + + /** because function parameters are not nodes, + it must be the current function node, which + gets doxy comment set. + */ + + Setattr($3, "postComment", $2); + /* + currentPostComment = $2; + if (previousParmName != 0) { + String *param = NewString("\n@param "); + if (currentComment != 0) { + Append(currentComment, param); + Append(currentComment, previousParmName ); + Append(currentComment, currentPostComment); + } + else { + currentComment = param; + Append(currentComment, Getattr($3, "name") ); + Append(currentComment, currentPostComment); + } + } + currentPostComment = 0; + */ + } | empty { $$ = 0; } ; @@ -4575,6 +4650,36 @@ parm : rawtype parameter_declarator { Setattr($$,"value",$2.defarg); } } + | rawtype parameter_declarator doxygen_post_comment { + /** handles the last function parameter, which is not followed by comma */ + /* + String *param = NewString("@param "); + String *name = NewString($2.id); + + if (currentComment != 0) { + Append(currentComment, param); + } + else { + currentComment = param; + } + + Append(currentComment, name); + Append(currentComment, $3); + + if (currentPostComment != 0) { + } + currentPostComment = 0; + */ + + SwigType_push($1,$2.type); + $$ = NewParm($1,$2.id); + Setattr($$, "lastParamPostComment", $3); + Setfile($$,cparse_file); + Setline($$,cparse_line); + if ($2.defarg) { + Setattr($$,"value",$2.defarg); + } + } | TEMPLATE LESSTHAN cpptype GREATERTHAN cpptype idcolon def_args { $$ = NewParm(NewStringf("template %s %s", $5,$6), 0); @@ -5462,6 +5567,65 @@ edecl : ID { } SetFlag($$,"feature:immutable"); } + + | doxygen_comment ID EQUAL etype { + $$ = new_node("enumitem"); + Setattr($$,"name",$2); + Setattr($$,"enumvalue", $4.val); + if ($4.type == T_CHAR) { + SwigType *type = NewSwigType(T_CHAR); + Setattr($$,"value",NewStringf("\'%(escape)s\'", $4.val)); + Setattr($$,"type",type); + Delete(type); + } else { + SwigType *type = NewSwigType(T_INT); + Setattr($$,"value",$2); + Setattr($$,"type",type); + Delete(type); + } + SetFlag($$,"feature:immutable"); + } + + | doxygen_post_comment ID EQUAL etype { + currentPostComment = $1; + $$ = new_node("enumitem"); + Setattr($$,"name",$2); + Setattr($$,"enumvalue", $4.val); + if ($4.type == T_CHAR) { + SwigType *type = NewSwigType(T_CHAR); + Setattr($$,"value",NewStringf("\'%(escape)s\'", $4.val)); + Setattr($$,"type",type); + Delete(type); + } else { + SwigType *type = NewSwigType(T_INT); + Setattr($$,"value",$2); + Setattr($$,"type",type); + Delete(type); + } + SetFlag($$,"feature:immutable"); + } + + | doxygen_comment ID { + SwigType *type = NewSwigType(T_INT); + $$ = new_node("enumitem"); + Setattr($$,"name",$2); + Setattr($$,"type",type); + SetFlag($$,"feature:immutable"); + Delete(type); + } + | doxygen_post_comment ID { + SwigType *type = NewSwigType(T_INT); + currentPostComment = $1; + $$ = new_node("enumitem"); + Setattr($$,"name",$2); + Setattr($$,"type",type); + SetFlag($$,"feature:immutable"); + Delete(type); + } + | doxygen_post_comment { + currentPostComment = $1; + $$ = $1; + } | empty { $$ = 0; } ; diff --git a/Source/DoxygenTranslator/src/DoxygenEntity.cpp b/Source/DoxygenTranslator/src/DoxygenEntity.cpp index 52fb60d90..b2b156b5d 100644 --- a/Source/DoxygenTranslator/src/DoxygenEntity.cpp +++ b/Source/DoxygenTranslator/src/DoxygenEntity.cpp @@ -13,7 +13,7 @@ DoxygenEntity::DoxygenEntity(std::string typeEnt){ typeOfEntity = typeEnt; data = ""; - isLeaf = 1; + isLeaf = true; } /* Basic node for commands that have @@ -24,7 +24,7 @@ DoxygenEntity::DoxygenEntity(std::string typeEnt){ DoxygenEntity::DoxygenEntity(std::string typeEnt, std::string param1){ typeOfEntity = typeEnt; data = param1; - isLeaf = 1; + isLeaf = true; } /* Nonterminal node @@ -33,23 +33,35 @@ DoxygenEntity::DoxygenEntity(std::string typeEnt, std::string param1){ DoxygenEntity::DoxygenEntity(std::string typeEnt, std::list &entList ){ typeOfEntity = typeEnt; data = ""; - isLeaf = 0; + isLeaf = false; entityList = entList; } void DoxygenEntity::printEntity(int level){ int thisLevel = level; if (isLeaf) { - for (int i = 0; i < thisLevel; i++) {std::cout << "\t";} + for (int i = 0; i < thisLevel; i++) { + std::cout << "\t"; + } + std::cout << "Node Command: " << typeOfEntity << " "; - if (data.compare("") != 0) std::cout << "Node Data: " << data; + + if (data.compare("") != 0) { + std::cout << "Node Data: " << data; + } std::cout << std::endl; + + } else { + + for (int i = 0; i < thisLevel; i++) { + std::cout << "\t"; } - else{ - for (int i = 0; i < thisLevel; i++) {std::cout << "\t";} + std::cout << "Node Command : " << typeOfEntity << std::endl; + std::list::iterator p = entityList.begin(); thisLevel++; + while (p != entityList.end()){ (*p).printEntity(thisLevel); p++; @@ -57,7 +69,10 @@ void DoxygenEntity::printEntity(int level){ } } +// not used, completely wrong - currently std lib reports 'invalid operator <' bool CompareDoxygenEntities::operator()(DoxygenEntity& first, DoxygenEntity& second){ + + // return first.typeOfEntity < second.typeOfEntity; if(first.typeOfEntity.compare("brief") == 0) return true; if(second.typeOfEntity.compare("brief") == 0) @@ -68,7 +83,7 @@ bool CompareDoxygenEntities::operator()(DoxygenEntity& first, DoxygenEntity& sec return false; if(first.typeOfEntity.compare("partofdescription") == 0) return true; - if(first.typeOfEntity.compare("partofdescription") == 0) + if(second.typeOfEntity.compare("partofdescription") == 0) return false; if(first.typeOfEntity.compare("plainstd::string") == 0) return true; diff --git a/Source/DoxygenTranslator/src/DoxygenEntity.h b/Source/DoxygenTranslator/src/DoxygenEntity.h index 6a0b2e48c..4c1ab7ff9 100644 --- a/Source/DoxygenTranslator/src/DoxygenEntity.h +++ b/Source/DoxygenTranslator/src/DoxygenEntity.h @@ -13,18 +13,43 @@ #include #include + +typedef enum { + SIMPLECOMMAND, + IGNOREDSIMPLECOMMAND, + COMMANDWORD, + IGNOREDCOMMANDWORD, + COMMANDLINE, + IGNOREDCOMMANDLINE, + COMMANDPARAGRAPH, + IGNORECOMMANDPARAGRAPH, + COMMANDENDCOMMAND, + COMMANDWORDPARAGRAPH, + COMMANDWORDLINE, + COMMANDWORDOWORDWORD, + COMMANDOWORD, + COMMANDERRORTHROW, + COMMANDUNIQUE, + END_LINE, + PARAGRAPH_END, + PLAINSTRING, + COMMAND +} DoxyCommandEnum; + /* * Structure to represent a doxygen comment entry */ struct DoxygenEntity{ - DoxygenEntity(std::string typeEnt); - DoxygenEntity(std::string typeEnt, std::string param1); - DoxygenEntity(std::string typeEnt, std::list &entList ); - void printEntity(int level); std::string typeOfEntity; std::list entityList; std::string data; - int isLeaf; + bool isLeaf; + + DoxygenEntity(std::string typeEnt); + DoxygenEntity(std::string typeEnt, std::string param1); + DoxygenEntity(std::string typeEnt, std::list &entList ); + + void printEntity(int level); }; /* diff --git a/Source/DoxygenTranslator/src/DoxygenParser.cpp b/Source/DoxygenTranslator/src/DoxygenParser.cpp index cdc2d709f..78072852d 100644 --- a/Source/DoxygenTranslator/src/DoxygenParser.cpp +++ b/Source/DoxygenTranslator/src/DoxygenParser.cpp @@ -1,24 +1,6 @@ #include "DoxygenParser.h" #include "TokenList.h" -#define SIMPLECOMMAND 1 -#define IGNOREDSIMPLECOMMAND 2 -#define COMMANDWORD 3 -#define IGNOREDCOMMANDWORD 4 -#define COMMANDLINE 5 -#define IGNOREDCOMMANDLINE 6 -#define COMMANDPARAGRAPH 7 -#define IGNORECOMMANDPARAGRAPH 8 -#define COMMANDENDCOMMAND 9 -#define COMMANDWORDPARAGRAPH 10 -#define COMMANDWORDLINE 11 -#define COMMANDWORDOWORDWORD 12 -#define COMMANDOWORD 13 -#define COMMANDERRORTHROW 14 -#define COMMANDUNIQUE 15 -#define END_LINE 101 -#define PARAGRAPH_END 102 -#define PLAINSTRING 103 -#define COMMAND 104 + DoxygenParser::DoxygenParser() { @@ -50,14 +32,14 @@ std::string commandArray[] = {"a", "addindex", "addtogroup", "anchor", "arg", "a "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", + "subsection", "subsubsection", "test", "throw", "throws", "todo", "tparam", "typedef", "union", "until", "var", "verbatim", "verbinclude", "version", "warning", "weakgroup", "xmlonly", "xrefitem", "$", "@", "\\","&", "~", "<", ">", "#", "%"}; std::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", + "tparam", "post" , "pre", "remarks", "return", "retval", "sa", "see", "since", "test", "throw", "throws", "todo", "version", "warning", "xrefitem" }; /* All of the doxygen commands divided up by how they are parsed */ @@ -73,7 +55,7 @@ std::string commandParagraph[] = {"partofdescription", "return", "remarks", "sin std::string ignoreCommandParagraphs[] = {"nothing at the moment"}; std::string commandEndCommands[] = {"code", "dot", "msc", "f$", "f[", "f{environment}{", "htmlonly", "latexonly", "manonly", "verbatim", "xmlonly", "cond", "if", "ifnot", "link"}; -std::string commandWordParagraphs[] = {"param", "tparam", "throw", "retval", "exception"}; +std::string commandWordParagraphs[] = {"param", "tparam", "throw", "throws", "retval", "exception"}; std::string commandWordLines[] = {"page", "subsection", "subsubsection", "section", "paragraph", "defgroup"}; std::string commandWordOWordOWords [] = {"category", "class", "protocol", "interface", "struct", "union"}; std::string commandOWords[] = {"dir", "file", "cond"}; @@ -264,28 +246,33 @@ std::string getStringTilEndCommand(std::string theCommand, TokenList &tokList){ /* Returns the end of a Paragraph as an iterator- * Paragraph is defined in Doxygen to be a paragraph of text -* seperate by either a structural command or a blank line + * separated by either a structural command or a blank line */ std::list::iterator getEndOfParagraph(TokenList &tokList){ std::list::iterator endOfParagraph = tokList.iteratorCopy(); while(endOfParagraph != tokList.end()){ if ((* endOfParagraph).tokenType == END_LINE){ endOfParagraph++; - if ((* endOfParagraph).tokenType == END_LINE){ + if (endOfParagraph != tokList.end() && (* endOfParagraph).tokenType == END_LINE) { endOfParagraph++; //cout << "ENCOUNTERED END OF PARA" << endl; return endOfParagraph; } + + } else if ((*endOfParagraph).tokenType == COMMAND) { + + if (isSectionIndicator((* endOfParagraph).tokenString)) { + return endOfParagraph; } - else if ((* endOfParagraph).tokenType == COMMAND){ - if(isSectionIndicator((* endOfParagraph).tokenString)) return endOfParagraph; else endOfParagraph++; - } - else if((* endOfParagraph).tokenType == PLAINSTRING) { + + } else if ((*endOfParagraph).tokenType == PLAINSTRING) { endOfParagraph++; + } else { + return tokList.end(); } - else return tokList.end(); } + return tokList.end(); } @@ -478,7 +465,7 @@ int addCommandEndCommand(std::string theCommand, TokenList &tokList, std::list < /* CommandWordParagraph * Format: @command {paragraph} * Commands such as param -* "param", "tparam", "throw", "retval", "exception" + * "param", "tparam", "throw", "throws", "retval", "exception" */ int addCommandWordParagraph(std::string theCommand, TokenList &tokList, std::list &doxyList){ if (noisy) @@ -560,8 +547,10 @@ int addCommandOWord(std::string theCommand, TokenList &tokList, std::list &doxyList){ #pragma unused(doxyList) - cout << "Encountered :" << theCommand << endl; - cout << "This command should not have been encountered. Behaviour past this may be unpredictable " << endl; + if (noisy) { + cout << "Encountered :" << theCommand << endl; + cout << "This command should not have been encountered. Behaviour past this may be unpredictable " << endl; + } std::list::iterator endOfLine = getOneLine(tokList); tokList.setIterator(endOfLine); return 0; @@ -699,8 +688,6 @@ int addCommandUnique(std::string theCommand, TokenList &tokList, std::list &doxyList){ std::string theCommand = StringToLower(commandString); if (theCommand.compare("plainstd::string") == 0){ @@ -790,23 +777,30 @@ std::list parse(std::list::iterator endParsingIndex, Token } std::list parseRoot(std::list::iterator endParsingIndex, TokenList &tokList){ + std::list aNewList; int currCommand; + while (tokList.current() != endParsingIndex){ + Token currToken = tokList.peek(); - if(noisy) cout << "Parsing for phrase starting in:" << currToken.toString() << endl; + if(noisy) { + cout << "Parsing for phrase starting in:" << currToken.toString() << endl; + } + if(currToken.tokenType == END_LINE ){ tokList.next(); } else if(currToken.tokenType == COMMAND){ currCommand = findCommand(currToken.tokenString); if (currCommand < 0 ){ - if(noisy) + if(noisy) { cout << "Unidentified Command " << currToken.tokenString << endl; + } + tokList.next(); + addCommand(std::string("partofdescription"), tokList, aNewList); + } else { tokList.next(); - addCommand(std::string("partofdescription"), tokList, aNewList);} - //cout << "Command: " << currWord << " " << currCommand << endl; - else { tokList.next(); addCommand(currToken.tokenString, tokList, aNewList); } } diff --git a/Source/DoxygenTranslator/src/Examples/DoxygenTransWTokenizer.cpp b/Source/DoxygenTranslator/src/Examples/DoxygenTransWTokenizer.cpp index 299f59216..dacb31f77 100644 --- a/Source/DoxygenTranslator/src/Examples/DoxygenTransWTokenizer.cpp +++ b/Source/DoxygenTranslator/src/Examples/DoxygenTransWTokenizer.cpp @@ -569,7 +569,7 @@ string getStringTilCommand(int &startInd, string doxygenString){ } else{ startIndex = savedIndex; - addCommand(string("plainstring"), startIndex, aNewList, doxygenString); + addCommand(string("plainstd::string"), startIndex, aNewList, doxygenString); } } @@ -728,7 +728,7 @@ string getStringTilCommand(int &startInd, string doxygenString){ if(!restOfParagraph.empty()){ list aNewList; aNewList = parse(placement, restOfParagraph); - aNewList.push_front(DoxygenEntity("plainstring", name)); + aNewList.push_front(DoxygenEntity("plainstd::string", name)); doxyList.push_back(DoxygenEntity(theCommand, aNewList)); return 1; } @@ -752,7 +752,7 @@ string getStringTilCommand(int &startInd, string doxygenString){ if(!restOfLine.empty()){ list aNewList; aNewList = parse(placement, restOfLine); - aNewList.push_front(DoxygenEntity("plainstring", name)); + aNewList.push_front(DoxygenEntity("plainstd::string", name)); doxyList.push_back(DoxygenEntity(theCommand, aNewList)); return 1; } @@ -775,9 +775,9 @@ string getStringTilCommand(int &startInd, string doxygenString){ string headerfile = getNextWord(startInd, doxygenString); string headername = getNextWord(startInd, doxygenString); list aNewList; - aNewList.push_back(DoxygenEntity("plainstring", name)); - if (!headerfile.empty()) aNewList.push_back(DoxygenEntity("plainstring", headerfile)); - if (!headername.empty()) aNewList.push_back(DoxygenEntity("plainstring", headername)); + aNewList.push_back(DoxygenEntity("plainstd::string", name)); + if (!headerfile.empty()) aNewList.push_back(DoxygenEntity("plainstd::string", headerfile)); + if (!headername.empty()) aNewList.push_back(DoxygenEntity("plainstd::string", headername)); doxyList.push_back(DoxygenEntity(theCommand, aNewList)); return 1; } @@ -806,10 +806,10 @@ string getStringTilCommand(int &startInd, string doxygenString){ /* @command */ - if (theCommand.compare("plainstring") == 0){ + if (theCommand.compare("plainstd::string") == 0){ string nextPhrase = getStringTilCommand(startInd, doxygenString); if (noisy) cout << "Parsing plain string :" << nextPhrase << endl; - doxyList.push_back(DoxygenEntity("plainstring", nextPhrase )); + doxyList.push_back(DoxygenEntity("plainstd::string", nextPhrase )); return 1; } int commandNumber = commandBelongs(theCommand); diff --git a/Source/DoxygenTranslator/src/JavaDocConverter.cpp b/Source/DoxygenTranslator/src/JavaDocConverter.cpp index 0ba97fc60..33a62ff77 100644 --- a/Source/DoxygenTranslator/src/JavaDocConverter.cpp +++ b/Source/DoxygenTranslator/src/JavaDocConverter.cpp @@ -15,15 +15,16 @@ std::string JavaDocConverter::formatCommand(std::string unformattedLine, int ind lastPosition = i; if (isFirstLine){ i+=APPROX_LINE_LENGTH; + } else { + i+=APPROX_LINE_LENGTH - indent*TAB_SIZE; } - else i+=APPROX_LINE_LENGTH - indent*TAB_SIZE; + i = unformattedLine.find(" ", i); if (i > 0 && i + 1 < (int)unformattedLine.length()){ if (!isFirstLine) for (int j = 0; j < indent; j++) { formattedLines.append("\t"); - } - else { + } else { isFirstLine = 0; } formattedLines.append(unformattedLine.substr(lastPosition, i - lastPosition + 1)); @@ -32,7 +33,11 @@ std::string JavaDocConverter::formatCommand(std::string unformattedLine, int ind } } if (lastPosition < (int)unformattedLine.length()){ - if (!isFirstLine) {for (int j = 0; j < indent; j++) {formattedLines.append("\t");}} + if (!isFirstLine) { + for (int j = 0; j < indent; j++) { + formattedLines.append("\t"); + } + } formattedLines.append(unformattedLine.substr(lastPosition, unformattedLine.length() - lastPosition)); } @@ -46,7 +51,7 @@ std::string JavaDocConverter::javaDocFormat(DoxygenEntity &doxygenEntity){ if(doxygenEntity.typeOfEntity.compare("partofdescription") == 0){ return doxygenEntity.data; } - if (doxygenEntity.typeOfEntity.compare("plainstring") == 0){ + if (doxygenEntity.typeOfEntity.compare("plainstd::string") == 0){ return doxygenEntity.data; } else if (doxygenEntity.typeOfEntity.compare("b") == 0){ @@ -85,10 +90,12 @@ std::string JavaDocConverter::javaDocFormat(DoxygenEntity &doxygenEntity){ std::string JavaDocConverter::translateSubtree( DoxygenEntity &doxygenEntity){ std::string returnedString; - if (doxygenEntity.isLeaf){ return javaDocFormat(doxygenEntity) + " ";} - else { + if (doxygenEntity.isLeaf) { + return javaDocFormat(doxygenEntity) + " "; + } else { returnedString += javaDocFormat(doxygenEntity); std::list::iterator p = doxygenEntity.entityList.begin(); + while (p != doxygenEntity.entityList.end()){ returnedString+= translateSubtree(*p); p++; @@ -97,38 +104,64 @@ std::string JavaDocConverter::translateSubtree( DoxygenEntity &doxygenEntity){ return returnedString; } + std::string JavaDocConverter::translateEntity(DoxygenEntity &doxyEntity){ - if(doxyEntity.typeOfEntity.compare("partofdescription")== 0) return formatCommand(std::string(translateSubtree(doxyEntity)), 0); - if ((doxyEntity.typeOfEntity.compare("brief") == 0)||(doxyEntity.typeOfEntity.compare("details") == 0)){ - return formatCommand(std::string(translateSubtree(doxyEntity)), 0) + "\n * ";} - else if(doxyEntity.typeOfEntity.compare("plainstring")== 0 || doxyEntity.typeOfEntity.compare("deprecated")== 0 || doxyEntity.typeOfEntity.compare("brief")== 0) - return formatCommand(doxyEntity.data, 0) + "\n * "; - else if(doxyEntity.typeOfEntity.compare("see") == 0){ - return formatCommand(std::string("@" + doxyEntity.typeOfEntity + "\t\t" + translateSubtree(doxyEntity)), 2); + if (doxyEntity.typeOfEntity.compare("partofdescription") == 0) { + return formatCommand(std::string(translateSubtree(doxyEntity)), 0); } - else if(doxyEntity.typeOfEntity.compare("return")== 0 + + if ((doxyEntity.typeOfEntity.compare("brief") == 0) || + (doxyEntity.typeOfEntity.compare("details") == 0)) { + return formatCommand(std::string(translateSubtree(doxyEntity)), 0) + "\n * "; + + } else if(doxyEntity.typeOfEntity.compare("plainstd::string")== 0 || + doxyEntity.typeOfEntity.compare("deprecated")== 0 || + doxyEntity.typeOfEntity.compare("brief")== 0) { + return formatCommand(doxyEntity.data, 0) + "\n * "; + + } else if(doxyEntity.typeOfEntity.compare("see") == 0) { + return formatCommand(std::string("@" + doxyEntity.typeOfEntity + "\t\t" + + translateSubtree(doxyEntity)), 2); + + } else if(doxyEntity.typeOfEntity.compare("return")== 0 || doxyEntity.typeOfEntity.compare("author")== 0 || doxyEntity.typeOfEntity.compare("param")== 0 + || doxyEntity.typeOfEntity.compare("throw")== 0 + || doxyEntity.typeOfEntity.compare("throws")== 0 || doxyEntity.typeOfEntity.compare("since")== 0 || doxyEntity.typeOfEntity.compare("version")== 0 || doxyEntity.typeOfEntity.compare("exception") == 0 || doxyEntity.typeOfEntity.compare("deprecated") == 0){ + + // this 'if' is a hack - convert doxyEntity.typeOfEntity at the time of parsing + if (doxyEntity.typeOfEntity.compare("throw")== 0) { + doxyEntity.typeOfEntity = "throws"; + } return formatCommand(std::string("@" + doxyEntity.typeOfEntity + "\t" + translateSubtree(doxyEntity)), 2); - } - else if(doxyEntity.typeOfEntity.compare("sa")== 0){ + + } else if(doxyEntity.typeOfEntity.compare("sa")== 0) { return formatCommand(std::string("@see\t\t" + translateSubtree(doxyEntity)), 2); + + } else { + return formatCommand(javaDocFormat(doxyEntity), 0 ); } - else return formatCommand(javaDocFormat(doxyEntity), 0 ); + return ""; } -bool JavaDocConverter::getDocumentation(Node *n, String *&documentation){ - documentation = Getattr(n,"DoxygenComment"); - if(documentation == NULL) + +bool JavaDocConverter::getDocumentation(Node *node, String *&documentation) { + + documentation = Getattr(node, "DoxygenComment"); + + if (documentation == NULL) { return false; + } std::list entityList = DoxygenParser().createTree(Char(documentation)); - entityList.sort(CompareDoxygenEntities()); + + // entityList.sort(CompareDoxygenEntities()); sorting currently not used, + // see CompareDoxygenEntities::operator() in DoxygenEntity.cpp if(debug){ std::cout << "---RESORTED LIST---" << std::endl; diff --git a/Source/DoxygenTranslator/src/JavaDocConverter.h b/Source/DoxygenTranslator/src/JavaDocConverter.h index e2a25d4ff..8651bb1cf 100644 --- a/Source/DoxygenTranslator/src/JavaDocConverter.h +++ b/Source/DoxygenTranslator/src/JavaDocConverter.h @@ -18,7 +18,7 @@ class JavaDocConverter : public DoxygenTranslator { public: - JavaDocConverter() : debug( true ){} + JavaDocConverter() : debug( false ){} virtual bool getDocumentation(Node *node, String *&documentation); protected: diff --git a/Source/DoxygenTranslator/src/PyDocConverter.cpp b/Source/DoxygenTranslator/src/PyDocConverter.cpp index bb36aa382..6418ee73c 100644 --- a/Source/DoxygenTranslator/src/PyDocConverter.cpp +++ b/Source/DoxygenTranslator/src/PyDocConverter.cpp @@ -94,7 +94,7 @@ std::string PyDocConverter::translateEntity(Node *n, DoxygenEntity &doxyEntity){ ||(doxyEntity.typeOfEntity.compare("details") == 0)) return justifyString(std::string(translateSubtree(doxyEntity)), 0) + "\n"; - if(doxyEntity.typeOfEntity.compare("plainstring") == 0 + if(doxyEntity.typeOfEntity.compare("plainstd::string") == 0 || doxyEntity.typeOfEntity.compare("deprecated") == 0 || doxyEntity.typeOfEntity.compare("brief") == 0) return justifyString(doxyEntity.data, 0) + "\n"; diff --git a/Source/DoxygenTranslator/src/Token.cpp b/Source/DoxygenTranslator/src/Token.cpp index 198b3e442..2ac03afe5 100644 --- a/Source/DoxygenTranslator/src/Token.cpp +++ b/Source/DoxygenTranslator/src/Token.cpp @@ -1,4 +1,5 @@ #include "Token.h" +#include "DoxygenEntity.h" using namespace std; diff --git a/Source/DoxygenTranslator/src/Token.h b/Source/DoxygenTranslator/src/Token.h index e98686c14..cf28c90b7 100644 --- a/Source/DoxygenTranslator/src/Token.h +++ b/Source/DoxygenTranslator/src/Token.h @@ -2,10 +2,6 @@ #define TOKEN_H_ #include -#define END_LINE 101 -#define PARAGRAPH_END 102 -#define PLAINSTRING 103 -#define COMMAND 104 using namespace std; class Token @@ -13,6 +9,7 @@ class Token public: Token(int tType, string tString); ~Token(); + int tokenType; /* currently can be END_LINE, PLAINSTRING, or COMMAND */ string tokenString; /* the data , such as param for @param*/ string toString(); diff --git a/Source/DoxygenTranslator/src/TokenList.cpp b/Source/DoxygenTranslator/src/TokenList.cpp index a05d2ceef..1a9ff0a7a 100644 --- a/Source/DoxygenTranslator/src/TokenList.cpp +++ b/Source/DoxygenTranslator/src/TokenList.cpp @@ -4,99 +4,162 @@ #include #include #include "Token.h" +#include "DoxygenEntity.h" #define TOKENSPERLINE 8; //change this to change the printing behaviour of the token list -#define END_LINE 101 -#define PARAGRAPH_END 102 //not used at the moment -#define PLAINSTRING 103 -#define COMMAND 104 + using namespace std; - -list tokenList; -list::iterator tokenListIterator; int noisy2 = 0; /* The tokenizer*/ +TokenList::TokenList(const std::string &doxygenStringConst){ + size_t commentPos; + string doxygenString = doxygenStringConst; + + /* Comment start tokens are replaced in parser.y, see doxygen_comment and + doxygen_post_comment_item + do { + commentPos = doxygenString.find("///<"); + if (commentPos != string::npos) { + doxygenString.replace(commentPos, 4, " "); + continue; + } + commentPos = doxygenString.find("/**<"); + if (commentPos != string::npos) { + doxygenString.replace(commentPos, 4, " "); + continue; + } + commentPos = doxygenString.find("/*!<"); + if (commentPos != string::npos) { + doxygenString.replace(commentPos, 4, " "); + continue; + } + commentPos = doxygenString.find("//!<"); + if (commentPos != string::npos) { + doxygenString.replace(commentPos, 4, " "); + continue; + } + break; + } while (true); */ + + size_t currentIndex = 0; + size_t nextIndex = 0; -TokenList::TokenList(string doxygenString){ - int currentIndex = 0; - //Regex whitespace("[ \t]+"); - //Regex newLine("[\n]"); - //Regex command("[@|\\]{1}[^ \t \n]+"); //the cheap solution - //Regex doxygenFluff("[/*!]+"); - int nextIndex = 0; - int isFluff = 0; string currentWord; + while (currentIndex < doxygenString.length()){ + if(doxygenString[currentIndex] == '\n'){ - tokenList.push_back(Token(END_LINE, currentWord)); + m_tokenList.push_back(Token(END_LINE, currentWord)); currentIndex++; } + + // skip WS, except \n while(currentIndex < doxygenString.length() && (doxygenString[currentIndex] == ' ' || doxygenString[currentIndex]== '\t')) currentIndex ++; - if (currentIndex == doxygenString.length()) {} //do nothing since end of string was reached - else {nextIndex = currentIndex; + + if (currentIndex < doxygenString.length()) { + + nextIndex = currentIndex; + + // skip non WS while (nextIndex < doxygenString.length() && (doxygenString[nextIndex] != ' ' - && doxygenString[nextIndex]!= '\t' && doxygenString[nextIndex]!= '\n')) nextIndex++; + && doxygenString[nextIndex] != '\t' && doxygenString[nextIndex]!= '\n')) + nextIndex++; + + // now we have a token currentWord = doxygenString.substr(currentIndex, nextIndex-currentIndex); - if(noisy2) cout << "Current Word: " << currentWord << endl; + + if(noisy2) + cout << "Current Word: " << currentWord << endl; + if (currentWord[0] == '@' || currentWord[0] == '\\'){ + // it is doxygen command currentWord = currentWord.substr(1, currentWord.length()-1); - tokenList.push_back(Token(COMMAND, currentWord)); - } - else if (currentWord[0] == '\n'){ - //if ((tokenList.back()).tokenType == END_LINE){} - tokenList.push_back(Token(END_LINE, currentWord)); + m_tokenList.push_back(Token(COMMAND, currentWord)); + + } else if (currentWord[0] == '\n'){ + + m_tokenList.push_back(Token(END_LINE, currentWord)); } else if (currentWord[0] == '*' || currentWord[0] == '/' ||currentWord[0] == '!'){ - if (currentWord.length() == 1) {isFluff = 1;} - else { isFluff = 1; - for(int i = 1; i < currentWord.length(); i++){ - if (currentWord[0] != '*' && currentWord[0] != '/' && currentWord[0] != '!') isFluff = 0; - } + bool isPlainString = false; + + if (currentWord.length() > 1) { + + for(size_t i = 1; i < currentWord.length(); i++){ + if (currentWord[i] != '*' && currentWord[i] != '/' && + currentWord[i] != '!') { + isPlainString = true; + break; + } } - if(!isFluff) tokenList.push_back(Token(PLAINSTRING, currentWord)); } - else if (!currentWord.empty())tokenList.push_back(Token(PLAINSTRING, currentWord)); + if(isPlainString) + m_tokenList.push_back(Token(PLAINSTRING, currentWord)); + + } else if (!currentWord.empty()) { + m_tokenList.push_back(Token(PLAINSTRING, currentWord)); + } currentIndex = nextIndex; } } - tokenListIterator = tokenList.begin(); + + m_tokenListIter = m_tokenList.begin(); +} + + +TokenList:: ~TokenList(){ } Token TokenList::peek(){ - if(tokenListIterator!= tokenList.end()){ - Token returnedToken = (*tokenListIterator); + if(m_tokenListIter!= m_tokenList.end()){ + Token returnedToken = (*m_tokenListIter); return returnedToken; } else return Token(0, ""); } + Token TokenList::next(){ - if(tokenListIterator != tokenList.end()){ - Token returnedToken = (*tokenListIterator); - tokenListIterator++; + if(m_tokenListIter != m_tokenList.end()){ + Token returnedToken = (*m_tokenListIter); + m_tokenListIter++; return (returnedToken); } else return Token(0, ""); } + list::iterator TokenList::end(){ return tokenList.end(); } + list::iterator TokenList::current(){ - return tokenListIterator; + return m_tokenListIter; } + + +list::iterator TokenList::iteratorCopy(){ + return m_tokenListIter; +} + + +void TokenList::setIterator(list::iterator newPosition){ + m_tokenListIter = newPosition; +} + + void TokenList::printList(){ - list::iterator p = tokenList.begin(); + list::iterator p = m_tokenList.begin(); int i = 1; int b = 0; - while (p != tokenList.end()){ + while (p != m_tokenList.end()){ cout << (*p).toString() << " "; b = i%TOKENSPERLINE; if (b == 0) cout << endl; @@ -104,13 +167,3 @@ void TokenList::printList(){ } } -list::iterator TokenList::iteratorCopy(){ - list::iterator p = tokenListIterator; - return p; -} -void TokenList::setIterator(list::iterator newPosition){ - tokenListIterator = newPosition; -} -TokenList:: ~TokenList(){ - tokenList.clear(); -} diff --git a/Source/DoxygenTranslator/src/TokenList.h b/Source/DoxygenTranslator/src/TokenList.h index cc61f56e4..0f5710e0f 100644 --- a/Source/DoxygenTranslator/src/TokenList.h +++ b/Source/DoxygenTranslator/src/TokenList.h @@ -5,23 +5,30 @@ #include #include #include "Token.h" -using namespace std; /* a small class used to represent the sequence of tokens * that can be derived from a formatted doxygen string */ class TokenList{ +private: + std::list m_tokenList; + std::list::iterator m_tokenListIter; + public: - TokenList(string doxygenString); /* constructor takes a blob of Doxygen comment */ + TokenList(const std::string &doxygenString); /* constructor takes a blob of Doxygen comment */ ~TokenList(); + Token peek(); /* returns next token without advancing */ Token next(); /* returns next token and advances */ - list::iterator end(); /* returns an end iterator */ - list::iterator current(); /* returns the current iterator */ - void printList(); /* prints out the sequence of tokens */ - list::iterator iteratorCopy(); /* returns a copy of the current iterator */ + + std::list::iterator end(); /* returns an end iterator */ + std::list::iterator current(); /* returns the current iterator */ + + std::list::iterator iteratorCopy(); /* returns a copy of the current iterator */ void setIterator(list::iterator newPosition); /*moves up the iterator*/ + + void printList(); /* prints out the sequence of tokens */ }; #endif /*TOKENLIST_H_*/ diff --git a/Source/Modules/java.cxx b/Source/Modules/java.cxx index 42ba5b396..532dfd305 100644 --- a/Source/Modules/java.cxx +++ b/Source/Modules/java.cxx @@ -1304,6 +1304,15 @@ public: // Note that this is used in enumValue() amongst other places Setattr(n, "value", tmpValue); + { + EnumFeature enum_feature = decodeEnumFeature(parentNode(n)); + + if ((enum_feature == ProperEnum) && Getattr(parentNode(n), "sym:name") && !Getattr(parentNode(n), "unnamedinstance")) { + // Wrap (non-anonymous) C/C++ enum with a proper Java enum + // Emit the enum item. + if (!Getattr(n, "_last")) // Only the first enum item has this attribute set + Printf(enum_code, ",\n"); + //translate and write javadoc comment if flagged if (doxygen_javadoc_flag){ String *doxygen_comments; @@ -1314,14 +1323,7 @@ public: Delete(doxygen_comments); } } - { - EnumFeature enum_feature = decodeEnumFeature(parentNode(n)); - if ((enum_feature == ProperEnum) && Getattr(parentNode(n), "sym:name") && !Getattr(parentNode(n), "unnamedinstance")) { - // Wrap (non-anonymous) C/C++ enum with a proper Java enum - // Emit the enum item. - if (!Getattr(n, "_last")) // Only the first enum item has this attribute set - Printf(enum_code, ",\n"); Printf(enum_code, " %s", symname); if (Getattr(n, "enumvalue")) { String *value = enumValue(n); @@ -1841,7 +1843,6 @@ public: emitBanner(f_proxy); if (Len(package) > 0){ - Printf(f_proxy, "LETS TEST THIS NAO THX \n\n\n"); Printf(f_proxy, "package %s;\n", package); } Clear(proxy_class_def); diff --git a/Source/Modules/python.cxx b/Source/Modules/python.cxx index 8a3160ef3..bfbada1da 100644 --- a/Source/Modules/python.cxx +++ b/Source/Modules/python.cxx @@ -7,7 +7,7 @@ * Python language module for SWIG. * ----------------------------------------------------------------------------- */ -char cvsroot_python_cxx[] = "$Id: python.cxx 10453 2008-05-15 21:18:44Z wsfulton $"; +char cvsroot_python_cxx[] = "$Id$"; #include "swigmod.h" #define ctab2 " " @@ -3124,6 +3124,13 @@ public: if (!fastproxy || olddefs) { Printv(f_shadow, tab4, "def ", symname, "(", parms, ")", returnTypeAnnotation(n), ":", NIL); Printv(f_shadow, " return ", funcCall(Swig_name_member(class_name, symname), callParms), "\n", NIL); + if (doxygen) { + String *doxygen_comments; + if (DoxygenTranslator::getDocumentation(n, PyDoc, doxygen_comments)) { + Printf(f_shadow, Char(pythoncode(doxygen_comments, tab8))); + Delete(doxygen_comments); + } + } } } else { Printv(f_shadow, tab4, "def ", symname, "(",parms , ")", returnTypeAnnotation(n), ":", NIL); From ad9eb0e0bb066100fc1c4ca84982c3c9dd96347d Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Tue, 13 Oct 2009 23:22:52 +0000 Subject: [PATCH 039/314] fix compile error introduced in last patch git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2008-cherylfoil@11698 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Source/DoxygenTranslator/src/TokenList.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/DoxygenTranslator/src/TokenList.cpp b/Source/DoxygenTranslator/src/TokenList.cpp index 1a9ff0a7a..9efd7e9ef 100644 --- a/Source/DoxygenTranslator/src/TokenList.cpp +++ b/Source/DoxygenTranslator/src/TokenList.cpp @@ -136,7 +136,7 @@ Token TokenList::next(){ list::iterator TokenList::end(){ - return tokenList.end(); + return m_tokenList.end(); } From 19d90026ef5c0c7f595b08495f8105063bced1ba Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Tue, 13 Oct 2009 23:26:01 +0000 Subject: [PATCH 040/314] formatting fixes after running make beautify plus a few manual formatting fixes git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2008-cherylfoil@11699 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- .../DoxygenTranslator/src/DoxygenEntity.cpp | 204 ++- Source/DoxygenTranslator/src/DoxygenEntity.h | 12 +- .../DoxygenTranslator/src/DoxygenParser.cpp | 862 +++++----- Source/DoxygenTranslator/src/DoxygenParser.h | 7 +- .../src/DoxygenTranslator.cpp | 24 +- .../DoxygenTranslator/src/DoxygenTranslator.h | 15 +- .../src/Examples/DoxygenTransWTokenizer.cpp | 1483 +++++++++-------- .../src/Examples/DoxygenTransWTokenizer.h | 9 +- .../src/Examples/translator.h | 252 +-- .../src/JavaDocConverter.cpp | 147 +- .../DoxygenTranslator/src/JavaDocConverter.h | 18 +- .../DoxygenTranslator/src/PyDocConverter.cpp | 156 +- Source/DoxygenTranslator/src/PyDocConverter.h | 35 +- Source/DoxygenTranslator/src/Token.cpp | 39 +- Source/DoxygenTranslator/src/Token.h | 15 +- Source/DoxygenTranslator/src/TokenList.cpp | 230 ++- Source/DoxygenTranslator/src/TokenList.h | 26 +- 17 files changed, 1805 insertions(+), 1729 deletions(-) diff --git a/Source/DoxygenTranslator/src/DoxygenEntity.cpp b/Source/DoxygenTranslator/src/DoxygenEntity.cpp index b2b156b5d..f770dc514 100644 --- a/Source/DoxygenTranslator/src/DoxygenEntity.cpp +++ b/Source/DoxygenTranslator/src/DoxygenEntity.cpp @@ -10,10 +10,10 @@ #include "DoxygenEntity.h" #include -DoxygenEntity::DoxygenEntity(std::string typeEnt){ - typeOfEntity = typeEnt; - data = ""; - isLeaf = true; +DoxygenEntity::DoxygenEntity(std::string typeEnt) { + typeOfEntity = typeEnt; + data = ""; + isLeaf = true; } /* Basic node for commands that have @@ -21,173 +21,171 @@ DoxygenEntity::DoxygenEntity(std::string typeEnt){ * example: \b word * OR holding a std::string */ -DoxygenEntity::DoxygenEntity(std::string typeEnt, std::string param1){ - typeOfEntity = typeEnt; - data = param1; - isLeaf = true; +DoxygenEntity::DoxygenEntity(std::string typeEnt, std::string param1) { + typeOfEntity = typeEnt; + data = param1; + isLeaf = true; } /* Nonterminal node * contains */ -DoxygenEntity::DoxygenEntity(std::string typeEnt, std::list &entList ){ - typeOfEntity = typeEnt; - data = ""; - isLeaf = false; - entityList = entList; +DoxygenEntity::DoxygenEntity(std::string typeEnt, std::list < DoxygenEntity > &entList) { + typeOfEntity = typeEnt; + data = ""; + isLeaf = false; + entityList = entList; } -void DoxygenEntity::printEntity(int level){ - int thisLevel = level; - if (isLeaf) { - for (int i = 0; i < thisLevel; i++) { - std::cout << "\t"; - } - - std::cout << "Node Command: " << typeOfEntity << " "; - - if (data.compare("") != 0) { - std::cout << "Node Data: " << data; - } - std::cout << std::endl; +void DoxygenEntity::printEntity(int level) { + int thisLevel = level; + if (isLeaf) { + for (int i = 0; i < thisLevel; i++) { + std::cout << "\t"; + } - } else { + std::cout << "Node Command: " << typeOfEntity << " "; - for (int i = 0; i < thisLevel; i++) { - std::cout << "\t"; - } + if (data.compare("") != 0) { + std::cout << "Node Data: " << data; + } + std::cout << std::endl; - std::cout << "Node Command : " << typeOfEntity << std::endl; + } else { - std::list::iterator p = entityList.begin(); - thisLevel++; + for (int i = 0; i < thisLevel; i++) { + std::cout << "\t"; + } - while (p != entityList.end()){ - (*p).printEntity(thisLevel); - p++; - } - } + std::cout << "Node Command : " << typeOfEntity << std::endl; + + std::list < DoxygenEntity >::iterator p = entityList.begin(); + thisLevel++; + + while (p != entityList.end()) { + (*p).printEntity(thisLevel); + p++; + } + } } // not used, completely wrong - currently std lib reports 'invalid operator <' -bool CompareDoxygenEntities::operator()(DoxygenEntity& first, DoxygenEntity& second){ +bool CompareDoxygenEntities::operator() (DoxygenEntity & first, DoxygenEntity & second) { - // return first.typeOfEntity < second.typeOfEntity; - if(first.typeOfEntity.compare("brief") == 0) + // return first.typeOfEntity < second.typeOfEntity; + if (first.typeOfEntity.compare("brief") == 0) return true; - if(second.typeOfEntity.compare("brief") == 0) + if (second.typeOfEntity.compare("brief") == 0) return false; - if(first.typeOfEntity.compare("details") == 0) + if (first.typeOfEntity.compare("details") == 0) return true; - if(second.typeOfEntity.compare("details") == 0) + if (second.typeOfEntity.compare("details") == 0) return false; - if(first.typeOfEntity.compare("partofdescription") == 0) + if (first.typeOfEntity.compare("partofdescription") == 0) return true; - if(second.typeOfEntity.compare("partofdescription") == 0) + if (second.typeOfEntity.compare("partofdescription") == 0) return false; - if(first.typeOfEntity.compare("plainstd::string") == 0) + if (first.typeOfEntity.compare("plainstd::string") == 0) return true; - if(second.typeOfEntity.compare("plainstd::string") == 0) + if (second.typeOfEntity.compare("plainstd::string") == 0) return false; - if(first.typeOfEntity.compare("param") == 0){ - if(second.typeOfEntity.compare("param")== 0) + if (first.typeOfEntity.compare("param") == 0) { + if (second.typeOfEntity.compare("param") == 0) return true; - if(second.typeOfEntity.compare("return")== 0) + if (second.typeOfEntity.compare("return") == 0) return true; - if(second.typeOfEntity.compare("exception")== 0) + if (second.typeOfEntity.compare("exception") == 0) return true; - if(second.typeOfEntity.compare("author")== 0) + if (second.typeOfEntity.compare("author") == 0) return true; - if(second.typeOfEntity.compare("version")== 0) + if (second.typeOfEntity.compare("version") == 0) return true; - if(second.typeOfEntity.compare("see")== 0) + if (second.typeOfEntity.compare("see") == 0) return true; - if(second.typeOfEntity.compare("since")== 0) + if (second.typeOfEntity.compare("since") == 0) return true; - if(second.typeOfEntity.compare("deprecated")== 0) + if (second.typeOfEntity.compare("deprecated") == 0) return true; return false; } - if(first.typeOfEntity.compare("return")== 0){ - if(second.typeOfEntity.compare("return")== 0) + if (first.typeOfEntity.compare("return") == 0) { + if (second.typeOfEntity.compare("return") == 0) return true; - if(second.typeOfEntity.compare("exception")== 0) + if (second.typeOfEntity.compare("exception") == 0) return true; - if(second.typeOfEntity.compare("author")== 0) + if (second.typeOfEntity.compare("author") == 0) return true; - if(second.typeOfEntity.compare("version")== 0) + if (second.typeOfEntity.compare("version") == 0) return true; - if(second.typeOfEntity.compare("see")== 0) + if (second.typeOfEntity.compare("see") == 0) return true; - if(second.typeOfEntity.compare("since")== 0) + if (second.typeOfEntity.compare("since") == 0) return true; - if(second.typeOfEntity.compare("deprecated")== 0 - )return true; - return false; - } - if(first.typeOfEntity.compare("exception")== 0){ - if(second.typeOfEntity.compare("exception")== 0) - return true; - if(second.typeOfEntity.compare("author")== 0) - return true; - if(second.typeOfEntity.compare("version")== 0) - return true; - if(second.typeOfEntity.compare("see")== 0) - return true; - if(second.typeOfEntity.compare("since")== 0) - return true; - if(second.typeOfEntity.compare("deprecated")== 0) + if (second.typeOfEntity.compare("deprecated") == 0) return true; return false; } - if(first.typeOfEntity.compare("author")== 0){ - if(second.typeOfEntity.compare("author")== 0) + if (first.typeOfEntity.compare("exception") == 0) { + if (second.typeOfEntity.compare("exception") == 0) return true; - if(second.typeOfEntity.compare("version")== 0) + if (second.typeOfEntity.compare("author") == 0) return true; - if(second.typeOfEntity.compare("see")== 0) + if (second.typeOfEntity.compare("version") == 0) return true; - if(second.typeOfEntity.compare("since")== 0) + if (second.typeOfEntity.compare("see") == 0) return true; - if(second.typeOfEntity.compare("deprecated")== 0) + if (second.typeOfEntity.compare("since") == 0) + return true; + if (second.typeOfEntity.compare("deprecated") == 0) return true; return false; } - if(first.typeOfEntity.compare("version")== 0){ - if(second.typeOfEntity.compare("version")== 0) + if (first.typeOfEntity.compare("author") == 0) { + if (second.typeOfEntity.compare("author") == 0) return true; - if(second.typeOfEntity.compare("see")== 0) + if (second.typeOfEntity.compare("version") == 0) return true; - if(second.typeOfEntity.compare("since")== 0) + if (second.typeOfEntity.compare("see") == 0) return true; - if(second.typeOfEntity.compare("deprecated")== 0) + if (second.typeOfEntity.compare("since") == 0) + return true; + if (second.typeOfEntity.compare("deprecated") == 0) return true; return false; } - if(first.typeOfEntity.compare("see")== 0 || first.typeOfEntity.compare("sa")== 0){ - if(second.typeOfEntity.compare("see")== 0) + if (first.typeOfEntity.compare("version") == 0) { + if (second.typeOfEntity.compare("version") == 0) return true; - if(second.typeOfEntity.compare("sa")== 0) + if (second.typeOfEntity.compare("see") == 0) return true; - if(second.typeOfEntity.compare("since")== 0) + if (second.typeOfEntity.compare("since") == 0) return true; - if(second.typeOfEntity.compare("deprecated")== 0) + if (second.typeOfEntity.compare("deprecated") == 0) return true; return false; } - if(first.typeOfEntity.compare("since")== 0){ - if(second.typeOfEntity.compare("since")== 0) + if (first.typeOfEntity.compare("see") == 0 || first.typeOfEntity.compare("sa") == 0) { + if (second.typeOfEntity.compare("see") == 0) return true; - if(second.typeOfEntity.compare("deprecated")== 0) + if (second.typeOfEntity.compare("sa") == 0) + return true; + if (second.typeOfEntity.compare("since") == 0) + return true; + if (second.typeOfEntity.compare("deprecated") == 0) return true; return false; } - if(first.typeOfEntity.compare("deprecated")== 0){ - if(second.typeOfEntity.compare("deprecated")== 0) + if (first.typeOfEntity.compare("since") == 0) { + if (second.typeOfEntity.compare("since") == 0) + return true; + if (second.typeOfEntity.compare("deprecated") == 0) + return true; + return false; + } + if (first.typeOfEntity.compare("deprecated") == 0) { + if (second.typeOfEntity.compare("deprecated") == 0) return true; return false; } return true; } - - diff --git a/Source/DoxygenTranslator/src/DoxygenEntity.h b/Source/DoxygenTranslator/src/DoxygenEntity.h index 4c1ab7ff9..ca42393db 100644 --- a/Source/DoxygenTranslator/src/DoxygenEntity.h +++ b/Source/DoxygenTranslator/src/DoxygenEntity.h @@ -15,7 +15,7 @@ typedef enum { - SIMPLECOMMAND, + SIMPLECOMMAND, IGNOREDSIMPLECOMMAND, COMMANDWORD, IGNOREDCOMMANDWORD, @@ -39,15 +39,15 @@ typedef enum { /* * Structure to represent a doxygen comment entry */ -struct DoxygenEntity{ +struct DoxygenEntity { std::string typeOfEntity; - std::list entityList; + std::list < DoxygenEntity > entityList; std::string data; bool isLeaf; DoxygenEntity(std::string typeEnt); DoxygenEntity(std::string typeEnt, std::string param1); - DoxygenEntity(std::string typeEnt, std::list &entList ); + DoxygenEntity(std::string typeEnt, std::list < DoxygenEntity > &entList); void printEntity(int level); }; @@ -58,7 +58,7 @@ struct DoxygenEntity{ * such as brief descriptions are TAGGED as such */ struct CompareDoxygenEntities { - bool operator()(DoxygenEntity& first, DoxygenEntity& second); + bool operator() (DoxygenEntity & first, DoxygenEntity & second); }; -#endif /*TOKENLIST_H_*/ +#endif diff --git a/Source/DoxygenTranslator/src/DoxygenParser.cpp b/Source/DoxygenTranslator/src/DoxygenParser.cpp index 78072852d..f4bce5445 100644 --- a/Source/DoxygenTranslator/src/DoxygenParser.cpp +++ b/Source/DoxygenTranslator/src/DoxygenParser.cpp @@ -2,88 +2,110 @@ #include "TokenList.h" -DoxygenParser::DoxygenParser() -{ +DoxygenParser::DoxygenParser() { } -DoxygenParser::~DoxygenParser() -{ +DoxygenParser::~DoxygenParser() { } ////////////////////////////////////////// -int noisy = 0; // set this to 1 for extra chatter from the parsing stage. -int addCommand(std::string currCommand, TokenList &tokList, std::list &aNewList); -std::list parse(std::list::iterator endParsingIndex, TokenList &tokList); +int noisy = 0; // set this to 1 for extra chatter from the parsing stage. +int addCommand(std::string currCommand, TokenList & tokList, std::list < DoxygenEntity > &aNewList); +std::list < DoxygenEntity > parse(std::list < Token >::iterator endParsingIndex, TokenList & tokList); ////////////////////////////////////////// -std::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", "throws", "todo", "tparam", "typedef", "union", "until", - "var", "verbatim", "verbinclude", "version", "warning", "weakgroup", "xmlonly", "xrefitem", - "$", "@", "\\","&", "~", "<", ">", "#", "%"}; +std::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", "throws", "todo", "tparam", "typedef", "union", "until", + "var", "verbatim", "verbinclude", "version", "warning", "weakgroup", "xmlonly", "xrefitem", "$", "@", "\\", "&", "~", "<", ">", "#", "%"}; -std::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", "throws", "todo", - "version", "warning", "xrefitem" }; +std::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", "throws", "todo", "version", "warning", "xrefitem"}; /* All of the doxygen commands divided up by how they are parsed */ -std::string simpleCommands[] = {"n", "$", "@", "\\", "&", "~", "<", ">", "#", "%"}; -std::string ignoredSimpleCommands[] = {"nothing at the moment"}; -std::string commandWords[] = {"a", "b", "c", "e", "em", "p", "def", "enum", "example", "package", - "relates", "namespace", "relatesalso","anchor", "dontinclude", "include", "includelineno"}; -std::string ignoredCommandWords[] = {"copydoc", "copybrief", "copydetails", "verbinclude", "htmlinclude"}; -std::string commandLines[] = {"addindex", "fn", "name", "line", "var", "skipline", "typedef", "skip", "until", "property"}; -std::string ignoreCommandLines[] = {"nothing at the moment"}; -std::string commandParagraph[] = {"partofdescription", "return", "remarks", "since", "test", "sa", "see", "pre", "post", "details", "invariant", - "deprecated", "date", "note", "warning", "version", "todo", "bug", "attention", "brief", "author"}; -std::string ignoreCommandParagraphs[] = {"nothing at the moment"}; -std::string commandEndCommands[] = {"code", "dot", "msc", "f$", "f[", "f{environment}{", "htmlonly", "latexonly", "manonly", - "verbatim", "xmlonly", "cond", "if", "ifnot", "link"}; -std::string commandWordParagraphs[] = {"param", "tparam", "throw", "throws", "retval", "exception"}; -std::string commandWordLines[] = {"page", "subsection", "subsubsection", "section", "paragraph", "defgroup"}; -std::string commandWordOWordOWords [] = {"category", "class", "protocol", "interface", "struct", "union"}; -std::string commandOWords[] = {"dir", "file", "cond"}; -std::string commandErrorThrowings[] = {"annotatedclassstd::list", "classhierarchy", "define", "functionindex", "header", - "headerfilestd::list", "inherit", "l", "postheader", "private", "privatesection", "protected", - "protectedsection", "public", "publicsection", "endcode", "enddot", "endmsc", "endhtmlonly", - "endlatexonly", "endmanonly", "endlink", "endverbatim", "endxmlonly", "f]", "f}", "endcond", - "endif"}; -std::string commandUniques[] = {"xrefitem", "arg", "ingroup", "par", "headerfile", "overload", "weakgroup", "ref", -"subpage", "dotfile", "image", "addtogroup", "li"}; +std::string simpleCommands[] = { + "n", "$", "@", "\\", "&", "~", "<", ">", "#", "%"}; + +std::string ignoredSimpleCommands[] = { + "nothing at the moment"}; + +std::string commandWords[] = { + "a", "b", "c", "e", "em", "p", "def", "enum", "example", "package", "relates", "namespace", "relatesalso", "anchor", "dontinclude", "include", "includelineno"}; + +std::string ignoredCommandWords[] = { + "copydoc", "copybrief", "copydetails", "verbinclude", "htmlinclude"}; + +std::string commandLines[] = { + "addindex", "fn", "name", "line", "var", "skipline", "typedef", "skip", "until", "property"}; + +std::string ignoreCommandLines[] = { + "nothing at the moment"}; + +std::string commandParagraph[] = { + "partofdescription", "return", "remarks", "since", "test", "sa", "see", "pre", "post", "details", "invariant", + "deprecated", "date", "note", "warning", "version", "todo", "bug", "attention", "brief", "author"}; + +std::string ignoreCommandParagraphs[] = { + "nothing at the moment"}; + +std::string commandEndCommands[] = { + "code", "dot", "msc", "f$", "f[", "f{environment}{", "htmlonly", "latexonly", "manonly", "verbatim", "xmlonly", "cond", "if", "ifnot", "link"}; + +std::string commandWordParagraphs[] = { + "param", "tparam", "throw", "throws", "retval", "exception"}; + +std::string commandWordLines[] = { + "page", "subsection", "subsubsection", "section", "paragraph", "defgroup"}; + +std::string commandWordOWordOWords[] = { + "category", "class", "protocol", "interface", "struct", "union"}; + +std::string commandOWords[] = { + "dir", "file", "cond"}; + +std::string commandErrorThrowings[] = { + "annotatedclassstd::list", "classhierarchy", "define", "functionindex", "header", + "headerfilestd::list", "inherit", "l", "postheader", "private", "privatesection", "protected", + "protectedsection", "public", "publicsection", "endcode", "enddot", "endmsc", "endhtmlonly", + "endlatexonly", "endmanonly", "endlink", "endverbatim", "endxmlonly", "f]", "f}", "endcond", "endif"}; +std::string commandUniques[] = { + "xrefitem", "arg", "ingroup", "par", "headerfile", "overload", "weakgroup", "ref", "subpage", "dotfile", "image", "addtogroup", "li"}; /* Changes a std::string to all lower case */ -std::string StringToLower(std::string stringToConvert){ - for(unsigned int i=0;i &rootList){ - std::list::iterator p = rootList.begin(); - while (p != rootList.end()){ +void printTree(std::list < DoxygenEntity > &rootList) { + std::list < DoxygenEntity >::iterator p = rootList.begin(); + while (p != rootList.end()) { (*p).printEntity(0); p++; } @@ -116,190 +138,192 @@ void printTree( std::list &rootList){ /* Determines how a command should be handled (what group it belongs to * for parsing rules */ -int commandBelongs(std::string theCommand){ - std::string smallString = StringToLower(theCommand); - //cout << " Looking for command " << theCommand << endl; +int commandBelongs(std::string theCommand) { + std::string smallString = StringToLower(theCommand); + //cout << " Looking for command " << theCommand << endl; unsigned i = 0; - for (i = 0; i < sizeof(simpleCommands)/sizeof(*simpleCommands); i++){ - if(smallString.compare(simpleCommands[i]) == 0) + for (i = 0; i < sizeof(simpleCommands) / sizeof(*simpleCommands); i++) { + if (smallString.compare(simpleCommands[i]) == 0) return SIMPLECOMMAND; } - for (i = 0; i < sizeof(ignoredSimpleCommands)/sizeof(*ignoredSimpleCommands); i++){ - if(smallString.compare(ignoredSimpleCommands[i]) == 0) + for (i = 0; i < sizeof(ignoredSimpleCommands) / sizeof(*ignoredSimpleCommands); i++) { + if (smallString.compare(ignoredSimpleCommands[i]) == 0) return IGNOREDSIMPLECOMMAND; - } - for (i = 0; i < sizeof(commandWords)/sizeof(*commandWords); i++){ - if(smallString.compare( commandWords[i]) == 0) + } + for (i = 0; i < sizeof(commandWords) / sizeof(*commandWords); i++) { + if (smallString.compare(commandWords[i]) == 0) return COMMANDWORD; - } - for (i = 0; i < sizeof(ignoredCommandWords)/sizeof(*ignoredCommandWords); i++){ - if(smallString.compare( ignoredCommandWords[i]) == 0) + } + for (i = 0; i < sizeof(ignoredCommandWords) / sizeof(*ignoredCommandWords); i++) { + if (smallString.compare(ignoredCommandWords[i]) == 0) return IGNOREDCOMMANDWORD; - } - for (i = 0; i < sizeof(commandLines)/sizeof(*commandLines); i++){ - if(smallString.compare( commandLines[i]) == 0) + } + for (i = 0; i < sizeof(commandLines) / sizeof(*commandLines); i++) { + if (smallString.compare(commandLines[i]) == 0) return COMMANDLINE; - } - for (i = 0; i < sizeof(ignoreCommandLines)/sizeof(*ignoreCommandLines); i++){ - if(smallString.compare( ignoreCommandLines[i]) == 0) + } + for (i = 0; i < sizeof(ignoreCommandLines) / sizeof(*ignoreCommandLines); i++) { + if (smallString.compare(ignoreCommandLines[i]) == 0) return IGNOREDCOMMANDLINE; - } - for (i = 0; i < sizeof(commandParagraph)/sizeof(*commandParagraph); i++){ - if(smallString.compare( commandParagraph[i]) == 0) + } + for (i = 0; i < sizeof(commandParagraph) / sizeof(*commandParagraph); i++) { + if (smallString.compare(commandParagraph[i]) == 0) return COMMANDPARAGRAPH; - } - for (i = 0; i < sizeof(ignoreCommandParagraphs)/sizeof(*ignoreCommandParagraphs); i++){ - if(smallString.compare( ignoreCommandParagraphs[i]) == 0) + } + for (i = 0; i < sizeof(ignoreCommandParagraphs) / sizeof(*ignoreCommandParagraphs); i++) { + if (smallString.compare(ignoreCommandParagraphs[i]) == 0) return IGNORECOMMANDPARAGRAPH; - } - for (i = 0; i < sizeof(commandEndCommands)/sizeof(*commandEndCommands); i++){ - if(smallString.compare( commandEndCommands[i]) == 0) + } + for (i = 0; i < sizeof(commandEndCommands) / sizeof(*commandEndCommands); i++) { + if (smallString.compare(commandEndCommands[i]) == 0) return COMMANDENDCOMMAND; - } - for (i = 0; i < sizeof(commandWordParagraphs)/sizeof(*commandWordParagraphs); i++){ - if(smallString.compare( commandWordParagraphs[i]) == 0) + } + for (i = 0; i < sizeof(commandWordParagraphs) / sizeof(*commandWordParagraphs); i++) { + if (smallString.compare(commandWordParagraphs[i]) == 0) return COMMANDWORDPARAGRAPH; - } - for (i = 0; i < sizeof(commandWordLines)/sizeof(*commandWordLines); i++){ - if(smallString.compare( commandWordLines[i]) == 0) + } + for (i = 0; i < sizeof(commandWordLines) / sizeof(*commandWordLines); i++) { + if (smallString.compare(commandWordLines[i]) == 0) return COMMANDWORDLINE; - } - for (i = 0; i < sizeof(commandWordOWordOWords)/sizeof(*commandWordOWordOWords); i++){ - if(smallString.compare( commandWordOWordOWords[i]) == 0) + } + for (i = 0; i < sizeof(commandWordOWordOWords) / sizeof(*commandWordOWordOWords); i++) { + if (smallString.compare(commandWordOWordOWords[i]) == 0) return COMMANDWORDOWORDWORD; - } - for (i = 0; i < sizeof(commandOWords)/sizeof(*commandOWords); i++){ - if(smallString.compare( commandOWords[i]) == 0) + } + for (i = 0; i < sizeof(commandOWords) / sizeof(*commandOWords); i++) { + if (smallString.compare(commandOWords[i]) == 0) return COMMANDOWORD; - } - for (i = 0; i < sizeof(commandErrorThrowings)/sizeof(*commandErrorThrowings); i++){ - if(smallString.compare( commandErrorThrowings[i]) == 0) + } + for (i = 0; i < sizeof(commandErrorThrowings) / sizeof(*commandErrorThrowings); i++) { + if (smallString.compare(commandErrorThrowings[i]) == 0) return COMMANDERRORTHROW; - } - for (i = 0; i < sizeof(commandUniques)/sizeof(*commandUniques); i++){ - if(smallString.compare( commandUniques[i]) == 0) + } + for (i = 0; i < sizeof(commandUniques) / sizeof(*commandUniques); i++) { + if (smallString.compare(commandUniques[i]) == 0) return COMMANDUNIQUE; } - return 0; + return 0; } /* Returns the next word ON THE CURRENT LINE ONLY * if a new line is encountered, returns a blank std::string. * Updates the index it is given if success. */ -std::string getNextWord(TokenList &tokList){ - Token nextToken = tokList.peek(); - if (nextToken.tokenType == PLAINSTRING ){ - nextToken = tokList.next(); - return nextToken.tokenString; - } +std::string getNextWord(TokenList & tokList) { + Token nextToken = tokList.peek(); + if (nextToken.tokenType == PLAINSTRING) { + nextToken = tokList.next(); + return nextToken.tokenString; + } return ""; } /* Returns the location of the end of the line as * an iterator. */ -std::list::iterator getOneLine(TokenList &tokList){ - std::list::iterator endOfLine = tokList.iteratorCopy(); - while(endOfLine!= tokList.end()){ - if ((* endOfLine).tokenType == END_LINE){ - //cout << "REACHED END" << endl; - //endOfLine++; - return endOfLine; - } - //cout << (* endOfLine).toString(); - endOfLine++; - } - - return tokList.end(); +std::list < Token >::iterator getOneLine(TokenList & tokList) { + std::list < Token >::iterator endOfLine = tokList.iteratorCopy(); + while (endOfLine != tokList.end()) { + if ((*endOfLine).tokenType == END_LINE) { + //cout << "REACHED END" << endl; + //endOfLine++; + return endOfLine; + } + //cout << (* endOfLine).toString(); + endOfLine++; } + return tokList.end(); +} + /* Returns a properly formatted std::string * up til ANY command or end of line is encountered. */ -std::string getStringTilCommand(TokenList &tokList){ - std::string description; - if (tokList.peek().tokenType == 0) return ""; - while(tokList.peek().tokenType == PLAINSTRING){ - Token currentToken = tokList.next(); - if(currentToken.tokenType == PLAINSTRING) { - description = description + currentToken.tokenString + " "; - } - } - return description; +std::string getStringTilCommand(TokenList & tokList) { + std::string description; + if (tokList.peek().tokenType == 0) + return ""; + while (tokList.peek().tokenType == PLAINSTRING) { + Token currentToken = tokList.next(); + if (currentToken.tokenType == PLAINSTRING) { + description = description + currentToken.tokenString + " "; + } } + return description; +} /* Returns a properly formatted std::string * up til the command specified is encountered */ //TODO check that this behaves properly for formulas -std::string getStringTilEndCommand(std::string theCommand, TokenList &tokList){ - std::string description; - if (tokList.peek().tokenType == 0) return ""; - while(tokList.peek().tokenString.compare(theCommand) != 0 ){ - Token currentToken = tokList.next(); - description = description + currentToken.tokenString + " "; - } - return description; +std::string getStringTilEndCommand(std::string theCommand, TokenList & tokList) { + std::string description; + if (tokList.peek().tokenType == 0) + return ""; + while (tokList.peek().tokenString.compare(theCommand) != 0) { + Token currentToken = tokList.next(); + description = description + currentToken.tokenString + " "; } + return description; +} /* Returns the end of a Paragraph as an iterator- * Paragraph is defined in Doxygen to be a paragraph of text * separated by either a structural command or a blank line */ -std::list::iterator getEndOfParagraph(TokenList &tokList){ - std::list::iterator endOfParagraph = tokList.iteratorCopy(); - while(endOfParagraph != tokList.end()){ - if ((* endOfParagraph).tokenType == END_LINE){ - endOfParagraph++; - if (endOfParagraph != tokList.end() && (* endOfParagraph).tokenType == END_LINE) { - endOfParagraph++; - //cout << "ENCOUNTERED END OF PARA" << endl; - return endOfParagraph; - } +std::list < Token >::iterator getEndOfParagraph(TokenList & tokList) { + std::list < Token >::iterator endOfParagraph = tokList.iteratorCopy(); + while (endOfParagraph != tokList.end()) { + if ((*endOfParagraph).tokenType == END_LINE) { + endOfParagraph++; + if (endOfParagraph != tokList.end() && (*endOfParagraph).tokenType == END_LINE) { + endOfParagraph++; + //cout << "ENCOUNTERED END OF PARA" << endl; + return endOfParagraph; + } - } else if ((*endOfParagraph).tokenType == COMMAND) { + } else if ((*endOfParagraph).tokenType == COMMAND) { - if (isSectionIndicator((* endOfParagraph).tokenString)) { - return endOfParagraph; - } - else endOfParagraph++; + if (isSectionIndicator((*endOfParagraph).tokenString)) { + return endOfParagraph; + } else + endOfParagraph++; - } else if ((*endOfParagraph).tokenType == PLAINSTRING) { - endOfParagraph++; - } else { - return tokList.end(); - } + } else if ((*endOfParagraph).tokenType == PLAINSTRING) { + endOfParagraph++; + } else { + return tokList.end(); } + } - return tokList.end(); - } + return tokList.end(); +} /* Returns the end of a section, defined as the first blank line OR first encounter of the same * command. Example of this behaviour is \arg * if no end is encountered, returns the last token of the std::list. */ -std::list::iterator getEndOfSection(std::string theCommand, TokenList &tokList){ - std::list::iterator endOfParagraph = tokList.iteratorCopy(); - while(endOfParagraph != tokList.end()){ - if ((* endOfParagraph).tokenType == COMMAND){ - if(theCommand.compare((*endOfParagraph).tokenString) == 0) return endOfParagraph; - else endOfParagraph++; - } - else if((* endOfParagraph).tokenType == PLAINSTRING) { - endOfParagraph++; - } - else if ((* endOfParagraph).tokenType == END_LINE){ - endOfParagraph++; - if ((* endOfParagraph).tokenType == END_LINE){ - endOfParagraph++; - return endOfParagraph; - } - } +std::list < Token >::iterator getEndOfSection(std::string theCommand, TokenList & tokList) { + std::list < Token >::iterator endOfParagraph = tokList.iteratorCopy(); + while (endOfParagraph != tokList.end()) { + if ((*endOfParagraph).tokenType == COMMAND) { + if (theCommand.compare((*endOfParagraph).tokenString) == 0) + return endOfParagraph; + else + endOfParagraph++; + } else if ((*endOfParagraph).tokenType == PLAINSTRING) { + endOfParagraph++; + } else if ((*endOfParagraph).tokenType == END_LINE) { + endOfParagraph++; + if ((*endOfParagraph).tokenType == END_LINE) { + endOfParagraph++; + return endOfParagraph; + } } - return tokList.end(); - } + } + return tokList.end(); +} /* This method is for returning the end of a specific form of doxygen command * that begins with a \command and ends in \endcommand @@ -307,12 +331,12 @@ std::list::iterator getEndOfSection(std::string theCommand, TokenList &to * progressTilEndCommand("endcode", tokenList); * If the end is never encountered, it returns the end of the std::list. */ -std::list::iterator getEndCommand(std::string theCommand, TokenList &tokList){ - std::list::iterator endOfCommand = tokList.iteratorCopy(); - while (endOfCommand!= tokList.end()){ - if ((*endOfCommand).tokenType == COMMAND){ - if (theCommand.compare((* endOfCommand).tokenString) == 0){ - return endOfCommand; +std::list < Token >::iterator getEndCommand(std::string theCommand, TokenList & tokList) { + std::list < Token >::iterator endOfCommand = tokList.iteratorCopy(); + while (endOfCommand != tokList.end()) { + if ((*endOfCommand).tokenType == COMMAND) { + if (theCommand.compare((*endOfCommand).tokenString) == 0) { + return endOfCommand; } endOfCommand++; } @@ -324,9 +348,9 @@ std::list::iterator getEndCommand(std::string theCommand, TokenList &tokL /* A specialty method for commands such as \arg that end at the end of a paragraph OR when another \arg is encountered */ //TODO getTilAnyCommand -std::list::iterator getTilAnyCommand(std::string theCommand, TokenList &tokList){ +std::list < Token >::iterator getTilAnyCommand(std::string theCommand, TokenList & tokList) { #pragma unused(theCommand,tokList) - std::list::iterator anIterator; + std::list < Token >::iterator anIterator; return anIterator; } @@ -338,54 +362,56 @@ std::list::iterator getTilAnyCommand(std::string theCommand, TokenList &t * Plain commands, such as newline etc, they contain no other data * \n \\ \@ \& \$ \# \< \> \% */ -int addSimpleCommand(std::string theCommand, std::list &doxyList){ - if (noisy) cout << "Parsing " << theCommand << endl; +int addSimpleCommand(std::string theCommand, std::list < DoxygenEntity > &doxyList) { + if (noisy) + cout << "Parsing " << theCommand << endl; doxyList.push_back(DoxygenEntity(theCommand)); return 1; } - + /* NOT INCLUDED Simple Commands * Format: @command * Plain commands, such as newline etc, they contain no other data */ -int ignoreSimpleCommand(std::string theCommand, std::list &doxyList){ +int ignoreSimpleCommand(std::string theCommand, std::list < DoxygenEntity > &doxyList) { #pragma unused(doxyList) - if (noisy) cout << "Not Adding " << theCommand << endl; + if (noisy) + cout << "Not Adding " << theCommand << endl; return 1; } - + /* CommandWord * Format: @command * Commands with a single WORD after then such as @b * "a", "b", "c", "e", "em", "p", "def", "enum", "example", "package", * "relates", "namespace", "relatesalso","anchor", "dontinclude", "include", "includelineno" */ -int addCommandWord(std::string theCommand, TokenList &tokList, std::list &doxyList){ - if (noisy) cout << "Parsing " << theCommand << endl; +int addCommandWord(std::string theCommand, TokenList & tokList, std::list < DoxygenEntity > &doxyList) { + if (noisy) + cout << "Parsing " << theCommand << endl; std::string name = getNextWord(tokList); - if (!name.empty()){ + if (!name.empty()) { doxyList.push_back(DoxygenEntity(theCommand, name)); return 1; - } - else - cout << "No word followed " << theCommand << " command. Not added" << endl; + } else + cout << "No word followed " << theCommand << " command. Not added" << endl; return 0; } - + /* NOT INCLUDED CommandWord * Format: @command * Commands with a single WORD after then such as @b * "copydoc", "copybrief", "copydetails", "verbinclude", "htmlinclude" */ -int ignoreCommandWord(std::string theCommand, TokenList &tokList, std::list &doxyList){ +int ignoreCommandWord(std::string theCommand, TokenList & tokList, std::list < DoxygenEntity > &doxyList) { #pragma unused(doxyList) - if (noisy) + if (noisy) cout << "Not Adding " << theCommand << endl; std::string name = getNextWord(tokList); if (!name.empty()) return 1; - else - cout << "WARNING: No word followed " << theCommand << " command." << endl; + else + cout << "WARNING: No word followed " << theCommand << " command." << endl; return 0; } @@ -394,12 +420,12 @@ int ignoreCommandWord(std::string theCommand, TokenList &tokList, std::list &doxyList){ - if (noisy) +int addCommandLine(std::string theCommand, TokenList & tokList, std::list < DoxygenEntity > &doxyList) { + if (noisy) cout << "Parsing " << theCommand << endl; - std::list::iterator endOfLine = getOneLine(tokList); - std::list aNewList = parse(endOfLine, tokList); - doxyList.push_back( DoxygenEntity(theCommand, aNewList)); + std::list < Token >::iterator endOfLine = getOneLine(tokList); + std::list < DoxygenEntity > aNewList = parse(endOfLine, tokList); + doxyList.push_back(DoxygenEntity(theCommand, aNewList)); return 1; } @@ -408,11 +434,11 @@ int addCommandLine(std::string theCommand, TokenList &tokList, std::list &doxyList){ +int ignoreCommandLine(std::string theCommand, TokenList & tokList, std::list < DoxygenEntity > &doxyList) { #pragma unused(doxyList) - if (noisy) + if (noisy) cout << "Not Adding " << theCommand << endl; - std::list::iterator endOfLine = getOneLine(tokList); + std::list < Token >::iterator endOfLine = getOneLine(tokList); tokList.setIterator(endOfLine); return 1; } @@ -423,30 +449,30 @@ int ignoreCommandLine(std::string theCommand, TokenList &tokList, std::list &doxyList){ - if (noisy) +int addCommandParagraph(std::string theCommand, TokenList & tokList, std::list < DoxygenEntity > &doxyList) { + if (noisy) cout << "Parsing " << theCommand << endl; - std::list::iterator endOfParagraph = getEndOfParagraph(tokList); - std::list aNewList; - aNewList = parse(endOfParagraph, tokList); - doxyList.push_back( DoxygenEntity(theCommand, aNewList)); + std::list < Token >::iterator endOfParagraph = getEndOfParagraph(tokList); + std::list < DoxygenEntity > aNewList; + aNewList = parse(endOfParagraph, tokList); + doxyList.push_back(DoxygenEntity(theCommand, aNewList)); return 1; } - + /* CommandParagraph * Format: @command {paragraph} * Commands with a single LINE after then such as @var * */ -int ignoreCommandParagraph(std::string theCommand, TokenList &tokList, std::list &doxyList){ +int ignoreCommandParagraph(std::string theCommand, TokenList & tokList, std::list < DoxygenEntity > &doxyList) { #pragma unused(doxyList) - if (noisy) + if (noisy) cout << "Not Adding " << theCommand << endl; - std::list::iterator endOfParagraph = getEndOfParagraph(tokList); + std::list < Token >::iterator endOfParagraph = getEndOfParagraph(tokList); tokList.setIterator(endOfParagraph); return 1; } - + /* Command EndCommand * Format: @command and ends at @endcommand * Commands that take in a block of text such as @code @@ -454,30 +480,30 @@ int ignoreCommandParagraph(std::string theCommand, TokenList &tokList, std::list * "verbatim", "xmlonly", "cond", "if", "ifnot", "link" * Returns 1 if success, 0 if the endcommand is never encountered. */ -int addCommandEndCommand(std::string theCommand, TokenList &tokList, std::list &doxyList){ - if (noisy) +int addCommandEndCommand(std::string theCommand, TokenList & tokList, std::list < DoxygenEntity > &doxyList) { + if (noisy) cout << "Not Adding " << theCommand << endl; - std::string description = getStringTilEndCommand( "end" + theCommand, tokList); + std::string description = getStringTilEndCommand("end" + theCommand, tokList); doxyList.push_back(DoxygenEntity(theCommand, description)); return 1; } - + /* CommandWordParagraph * Format: @command {paragraph} * Commands such as param * "param", "tparam", "throw", "throws", "retval", "exception" */ -int addCommandWordParagraph(std::string theCommand, TokenList &tokList, std::list &doxyList){ - if (noisy) +int addCommandWordParagraph(std::string theCommand, TokenList & tokList, std::list < DoxygenEntity > &doxyList) { + if (noisy) cout << "Parsing " << theCommand << endl; std::string name = getNextWord(tokList); - if (name.empty()){ - cout << "No word followed " << theCommand << " command. Not added" << endl; + if (name.empty()) { + cout << "No word followed " << theCommand << " command. Not added" << endl; return 0; - } - std::list::iterator endOfParagraph = getEndOfParagraph(tokList); - std::list aNewList; - aNewList = parse(endOfParagraph, tokList); + } + std::list < Token >::iterator endOfParagraph = getEndOfParagraph(tokList); + std::list < DoxygenEntity > aNewList; + aNewList = parse(endOfParagraph, tokList); aNewList.push_front(DoxygenEntity("plainstd::string", name)); doxyList.push_back(DoxygenEntity(theCommand, aNewList)); return 1; @@ -488,16 +514,17 @@ int addCommandWordParagraph(std::string theCommand, TokenList &tokList, std::lis * Commands such as param * "page", "subsection", "subsubsection", "section", "paragraph", "defgroup" */ -int addCommandWordLine(std::string theCommand, TokenList &tokList, std::list &doxyList){ - if (noisy) cout << "Parsing " << theCommand << endl; - std::string name = getNextWord(tokList); - if (name.empty()){ - cout << "No word followed " << theCommand << " command. Not added" << endl; +int addCommandWordLine(std::string theCommand, TokenList & tokList, std::list < DoxygenEntity > &doxyList) { + if (noisy) + cout << "Parsing " << theCommand << endl; + std::string name = getNextWord(tokList); + if (name.empty()) { + cout << "No word followed " << theCommand << " command. Not added" << endl; return 0; - } - std::list::iterator endOfLine = getOneLine(tokList); - std::list aNewList; - aNewList = parse(endOfLine, tokList); + } + std::list < Token >::iterator endOfLine = getOneLine(tokList); + std::list < DoxygenEntity > aNewList; + aNewList = parse(endOfLine, tokList); aNewList.push_front(DoxygenEntity("plainstd::string", name)); doxyList.push_back(DoxygenEntity(theCommand, aNewList)); return 1; @@ -509,21 +536,21 @@ int addCommandWordLine(std::string theCommand, TokenList &tokList, std::list &doxyList){ - if (noisy) +int addCommandWordOWordOWord(std::string theCommand, TokenList & tokList, std::list < DoxygenEntity > &doxyList) { + if (noisy) cout << "Parsing " << theCommand << endl; std::string name = getNextWord(tokList); - if (name.empty()){ - cout << "No word followed " << theCommand << " command. Not added" << endl; - return 0; - } + if (name.empty()) { + cout << "No word followed " << theCommand << " command. Not added" << endl; + return 0; + } std::string headerfile = getNextWord(tokList); std::string headername = getNextWord(tokList); - std::list aNewList; + std::list < DoxygenEntity > aNewList; aNewList.push_back(DoxygenEntity("plainstd::string", name)); - if (!headerfile.empty()) + if (!headerfile.empty()) aNewList.push_back(DoxygenEntity("plainstd::string", headerfile)); - if (!headername.empty()) + if (!headername.empty()) aNewList.push_back(DoxygenEntity("plainstd::string", headername)); doxyList.push_back(DoxygenEntity(theCommand, aNewList)); return 1; @@ -534,241 +561,240 @@ int addCommandWordOWordOWord(std::string theCommand, TokenList &tokList, std::li * Commands such as dir * "dir", "file", "cond" */ -int addCommandOWord(std::string theCommand, TokenList &tokList, std::list &doxyList){ - if (noisy) +int addCommandOWord(std::string theCommand, TokenList & tokList, std::list < DoxygenEntity > &doxyList) { + if (noisy) cout << "Parsing " << theCommand << endl; std::string name = getNextWord(tokList); doxyList.push_back(DoxygenEntity(theCommand, name)); - return 1; + return 1; } /* Commands that should not be encountered (such as PHP only) * goes til the end of line then returns */ -int addCommandErrorThrow(std::string theCommand, TokenList &tokList, std::list &doxyList){ +int addCommandErrorThrow(std::string theCommand, TokenList & tokList, std::list < DoxygenEntity > &doxyList) { #pragma unused(doxyList) - if (noisy) { - cout << "Encountered :" << theCommand << endl; - cout << "This command should not have been encountered. Behaviour past this may be unpredictable " << endl; - } - std::list::iterator endOfLine = getOneLine(tokList); - tokList.setIterator(endOfLine); - return 0; - } + if (noisy) { + cout << "Encountered :" << theCommand << endl; + cout << "This command should not have been encountered. Behaviour past this may be unpredictable " << endl; + } + std::list < Token >::iterator endOfLine = getOneLine(tokList); + tokList.setIterator(endOfLine); + return 0; +} /* Adds the unique commands- different process for each unique command */ -int addCommandUnique(std::string theCommand, TokenList &tokList, std::list &doxyList){ - std::list aNewList; - if (theCommand.compare("arg") == 0 || theCommand.compare("li") == 0){ - std::list::iterator endOfSection = getEndOfSection(theCommand, tokList); - std::list aNewList; - aNewList = parse(endOfSection, tokList); - doxyList.push_back( DoxygenEntity(theCommand, aNewList)); +int addCommandUnique(std::string theCommand, TokenList & tokList, std::list < DoxygenEntity > &doxyList) { + std::list < DoxygenEntity > aNewList; + if (theCommand.compare("arg") == 0 || theCommand.compare("li") == 0) { + std::list < Token >::iterator endOfSection = getEndOfSection(theCommand, tokList); + std::list < DoxygenEntity > aNewList; + aNewList = parse(endOfSection, tokList); + doxyList.push_back(DoxygenEntity(theCommand, aNewList)); } // \xrefitem "(heading)" "(std::list title)" {text} - else if (theCommand.compare("xrefitem") == 0){ + else if (theCommand.compare("xrefitem") == 0) { //TODO Implement xrefitem - if (noisy) + if (noisy) cout << "Not Adding " << theCommand << endl; - std::list::iterator endOfParagraph = getEndOfParagraph(tokList); + std::list < Token >::iterator endOfParagraph = getEndOfParagraph(tokList); tokList.setIterator(endOfParagraph); return 1; } // \ingroup ( [ ]) - else if (theCommand.compare("ingroup") == 0){ + else if (theCommand.compare("ingroup") == 0) { std::string name = getNextWord(tokList); aNewList.push_back(DoxygenEntity("plainstd::string", name)); name = getNextWord(tokList); - if(!name.empty()) + if (!name.empty()) aNewList.push_back(DoxygenEntity("plainstd::string", name)); name = getNextWord(tokList); - if(!name.empty()) + if (!name.empty()) aNewList.push_back(DoxygenEntity("plainstd::string", name)); doxyList.push_back(DoxygenEntity(theCommand, aNewList)); return 1; } // \par [(paragraph title)] { paragraph } - else if (theCommand.compare("par") == 0){ - std::list::iterator endOfLine = getOneLine(tokList); - aNewList = parse(endOfLine, tokList); - std::list aNewList2; + else if (theCommand.compare("par") == 0) { + std::list < Token >::iterator endOfLine = getOneLine(tokList); + aNewList = parse(endOfLine, tokList); + std::list < DoxygenEntity > aNewList2; aNewList2 = parse(endOfLine, tokList); aNewList.splice(aNewList.end(), aNewList2); doxyList.push_back(DoxygenEntity(theCommand, aNewList)); - return 1; + return 1; } // \headerfile [] - else if (theCommand.compare("headerfile") == 0){ - std::list aNewList; + else if (theCommand.compare("headerfile") == 0) { + std::list < DoxygenEntity > aNewList; std::string name = getNextWord(tokList); aNewList.push_back(DoxygenEntity("plainstd::string", name)); name = getNextWord(tokList); - if(!name.empty()) + if (!name.empty()) aNewList.push_back(DoxygenEntity("plainstd::string", name)); doxyList.push_back(DoxygenEntity(theCommand, aNewList)); return 1; } // \overload [(function declaration)] - else if (theCommand.compare("overload") == 0){ - std::list::iterator endOfLine = getOneLine(tokList); - if (endOfLine != tokList.current()){ - std::list aNewList; - aNewList = parse(endOfLine, tokList); + else if (theCommand.compare("overload") == 0) { + std::list < Token >::iterator endOfLine = getOneLine(tokList); + if (endOfLine != tokList.current()) { + std::list < DoxygenEntity > aNewList; + aNewList = parse(endOfLine, tokList); doxyList.push_back(DoxygenEntity(theCommand, aNewList)); - } - else + } else doxyList.push_back(DoxygenEntity(theCommand)); return 1; } // \weakgroup [(title)] - else if (theCommand.compare("weakgroup") == 0){ - if (noisy) cout << "Parsing " << theCommand << endl; - std::string name = getNextWord(tokList); - if (name.empty()){ - cout << "No word followed " << theCommand << " command. Not added" << endl; + else if (theCommand.compare("weakgroup") == 0) { + if (noisy) + cout << "Parsing " << theCommand << endl; + std::string name = getNextWord(tokList); + if (name.empty()) { + cout << "No word followed " << theCommand << " command. Not added" << endl; return 0; } - std::list aNewList; - std::list::iterator endOfLine = getOneLine(tokList); + std::list < DoxygenEntity > aNewList; + std::list < Token >::iterator endOfLine = getOneLine(tokList); if (endOfLine != tokList.current()) { - aNewList = parse(endOfLine, tokList); + aNewList = parse(endOfLine, tokList); } aNewList.push_front(DoxygenEntity("plainstd::string", name)); doxyList.push_back(DoxygenEntity(theCommand, aNewList)); } // \ref ["(text)"] - else if (theCommand.compare("ref") == 0){ + else if (theCommand.compare("ref") == 0) { //TODO Implement ref - if (noisy) + if (noisy) cout << "Not Adding " << theCommand << endl; - std::list::iterator endOfParagraph = getEndOfParagraph(tokList); + std::list < Token >::iterator endOfParagraph = getEndOfParagraph(tokList); tokList.setIterator(endOfParagraph); } // \subpage ["(text)"] - else if (theCommand.compare("subpage") == 0){ + else if (theCommand.compare("subpage") == 0) { //TODO implement subpage - if (noisy) + if (noisy) cout << "Not Adding " << theCommand << endl; - std::list::iterator endOfParagraph = getEndOfParagraph(tokList); + std::list < Token >::iterator endOfParagraph = getEndOfParagraph(tokList); tokList.setIterator(endOfParagraph); } // \dotfile ["caption"] - else if (theCommand.compare("dotfile") == 0){ + else if (theCommand.compare("dotfile") == 0) { //TODO implement dotfile - if (noisy) + if (noisy) cout << "Not Adding " << theCommand << endl; - std::list::iterator endOfParagraph = getEndOfParagraph(tokList); + std::list < Token >::iterator endOfParagraph = getEndOfParagraph(tokList); tokList.setIterator(endOfParagraph); } // \image ["caption"] [=] - else if (theCommand.compare("image") == 0){ - //todo implement image - } + else if (theCommand.compare("image") == 0) { + //todo implement image + } // \addtogroup [(title)] - else if (theCommand.compare("addtogroup") == 0){ - if (noisy) + else if (theCommand.compare("addtogroup") == 0) { + if (noisy) cout << "Parsing " << theCommand << endl; std::string name = getNextWord(tokList); - if (name.empty()){ - cout << "No word followed " << theCommand << " command. Not added" << endl; + if (name.empty()) { + cout << "No word followed " << theCommand << " command. Not added" << endl; return 0; } - std::list aNewList; - std::list::iterator endOfLine = getOneLine(tokList); + std::list < DoxygenEntity > aNewList; + std::list < Token >::iterator endOfLine = getOneLine(tokList); if (endOfLine != tokList.current()) { - aNewList = parse(endOfLine, tokList); + aNewList = parse(endOfLine, tokList); } aNewList.push_front(DoxygenEntity("plainstd::string", name)); doxyList.push_back(DoxygenEntity(theCommand, aNewList)); } return 0; } - + /* 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(std::string commandString, TokenList &tokList,std::list &doxyList){ - std::string theCommand = StringToLower(commandString); - if (theCommand.compare("plainstd::string") == 0){ - std::string nextPhrase = getStringTilCommand( tokList); - if (noisy) cout << "Parsing plain std::string :" << nextPhrase << endl; - doxyList.push_back(DoxygenEntity("plainstd::string", nextPhrase )); - return 1; - } - int commandNumber = commandBelongs(theCommand); - if (commandNumber == SIMPLECOMMAND){ - return addSimpleCommand(theCommand, doxyList); - } - if (commandNumber == IGNOREDSIMPLECOMMAND){ - return ignoreSimpleCommand(theCommand, doxyList); - } - if (commandNumber == COMMANDWORD){ - return addCommandWord(theCommand, tokList, doxyList); - } - if (commandNumber == IGNOREDCOMMANDWORD){ - return ignoreCommandWord(theCommand, tokList, doxyList); - } - if (commandNumber == COMMANDLINE ){ - return addCommandLine(theCommand, tokList, doxyList); - } - if (commandNumber == IGNOREDCOMMANDLINE ){ - return ignoreCommandLine(theCommand, tokList, doxyList); - } - if (commandNumber == COMMANDPARAGRAPH){ - return addCommandParagraph(theCommand, tokList, doxyList); - } - if (commandNumber == IGNORECOMMANDPARAGRAPH){ - return ignoreCommandParagraph(theCommand, tokList, doxyList); - } - if (commandNumber == COMMANDENDCOMMAND){ - return addCommandEndCommand(theCommand, tokList, doxyList); - } - if (commandNumber == COMMANDWORDPARAGRAPH){ - return addCommandWordParagraph(theCommand, tokList, doxyList); - } - if (commandNumber == COMMANDWORDLINE){ - return addCommandWordLine(theCommand, tokList, doxyList); - } - if (commandNumber == COMMANDWORDOWORDWORD){ - return addCommandWordOWordOWord(theCommand, tokList, doxyList); - } - if (commandNumber == COMMANDOWORD){ - return addCommandOWord(theCommand, tokList, doxyList); - } - if (commandNumber == COMMANDERRORTHROW){ - return addCommandErrorThrow(theCommand, tokList, doxyList); - } - if (commandNumber == COMMANDUNIQUE){ +int addCommand(std::string commandString, TokenList & tokList, std::list < DoxygenEntity > &doxyList) { + std::string theCommand = StringToLower(commandString); + if (theCommand.compare("plainstd::string") == 0) { + std::string nextPhrase = getStringTilCommand(tokList); + if (noisy) + cout << "Parsing plain std::string :" << nextPhrase << endl; + doxyList.push_back(DoxygenEntity("plainstd::string", nextPhrase)); + return 1; + } + int commandNumber = commandBelongs(theCommand); + if (commandNumber == SIMPLECOMMAND) { + return addSimpleCommand(theCommand, doxyList); + } + if (commandNumber == IGNOREDSIMPLECOMMAND) { + return ignoreSimpleCommand(theCommand, doxyList); + } + if (commandNumber == COMMANDWORD) { + return addCommandWord(theCommand, tokList, doxyList); + } + if (commandNumber == IGNOREDCOMMANDWORD) { + return ignoreCommandWord(theCommand, tokList, doxyList); + } + if (commandNumber == COMMANDLINE) { + return addCommandLine(theCommand, tokList, doxyList); + } + if (commandNumber == IGNOREDCOMMANDLINE) { + return ignoreCommandLine(theCommand, tokList, doxyList); + } + if (commandNumber == COMMANDPARAGRAPH) { + return addCommandParagraph(theCommand, tokList, doxyList); + } + if (commandNumber == IGNORECOMMANDPARAGRAPH) { + return ignoreCommandParagraph(theCommand, tokList, doxyList); + } + if (commandNumber == COMMANDENDCOMMAND) { + return addCommandEndCommand(theCommand, tokList, doxyList); + } + if (commandNumber == COMMANDWORDPARAGRAPH) { + return addCommandWordParagraph(theCommand, tokList, doxyList); + } + if (commandNumber == COMMANDWORDLINE) { + return addCommandWordLine(theCommand, tokList, doxyList); + } + if (commandNumber == COMMANDWORDOWORDWORD) { + return addCommandWordOWordOWord(theCommand, tokList, doxyList); + } + if (commandNumber == COMMANDOWORD) { + return addCommandOWord(theCommand, tokList, doxyList); + } + if (commandNumber == COMMANDERRORTHROW) { + return addCommandErrorThrow(theCommand, tokList, doxyList); + } + if (commandNumber == COMMANDUNIQUE) { return addCommandUnique(theCommand, tokList, doxyList); - } - - return 0; - } + } -std::list parse(std::list::iterator endParsingIndex, TokenList &tokList){ - std::list aNewList; + return 0; +} + +std::list < DoxygenEntity > parse(std::list < Token >::iterator endParsingIndex, TokenList & tokList) { + std::list < DoxygenEntity > aNewList; int currCommand; - while (tokList.current() != endParsingIndex){ + while (tokList.current() != endParsingIndex) { Token currToken = tokList.peek(); - if(noisy) + if (noisy) cout << "Parsing for phrase starting in:" << currToken.toString() << endl; - if(currToken.tokenType == END_LINE ){ + if (currToken.tokenType == END_LINE) { tokList.next(); - } - else if(currToken.tokenType == COMMAND){ + } else if (currToken.tokenType == COMMAND) { currCommand = findCommand(currToken.tokenString); - if (currCommand < 0 ){ - if(noisy) + if (currCommand < 0) { + if (noisy) cout << "Unidentified Command " << currToken.tokenString << endl; tokList.next(); addCommand(std::string("plainstd::string"), tokList, aNewList); + } else { + tokList.next(); + addCommand(currToken.tokenString, tokList, aNewList); } - else { tokList.next(); - addCommand(currToken.tokenString, tokList, aNewList); - } - } - else if (currToken.tokenType == PLAINSTRING){ + } else if (currToken.tokenType == PLAINSTRING) { addCommand(std::string("plainstd::string"), tokList, aNewList); } break; @@ -776,50 +802,48 @@ std::list parse(std::list::iterator endParsingIndex, Token return aNewList; } -std::list parseRoot(std::list::iterator endParsingIndex, TokenList &tokList){ +std::list < DoxygenEntity > parseRoot(std::list < Token >::iterator endParsingIndex, TokenList & tokList) { - std::list aNewList; + std::list < DoxygenEntity > aNewList; int currCommand; - while (tokList.current() != endParsingIndex){ + while (tokList.current() != endParsingIndex) { Token currToken = tokList.peek(); - if(noisy) { + if (noisy) { cout << "Parsing for phrase starting in:" << currToken.toString() << endl; } - if(currToken.tokenType == END_LINE ){ + if (currToken.tokenType == END_LINE) { tokList.next(); - } - else if(currToken.tokenType == COMMAND){ + } else if (currToken.tokenType == COMMAND) { currCommand = findCommand(currToken.tokenString); - if (currCommand < 0 ){ - if(noisy) { + if (currCommand < 0) { + if (noisy) { cout << "Unidentified Command " << currToken.tokenString << endl; } tokList.next(); addCommand(std::string("partofdescription"), tokList, aNewList); - } else { - tokList.next(); - addCommand(currToken.tokenString, tokList, aNewList); + } else { + tokList.next(); + addCommand(currToken.tokenString, tokList, aNewList); } - } - else if (currToken.tokenType == PLAINSTRING){ + } else if (currToken.tokenType == PLAINSTRING) { addCommand(std::string("partofdescription"), tokList, aNewList); } } return aNewList; } -std::list DoxygenParser::createTree(std::string doxygenBlob){ +std::list < DoxygenEntity > DoxygenParser::createTree(std::string doxygenBlob) { TokenList tokList = TokenList(doxygenBlob); - if(noisy) { + if (noisy) { cout << "---TOKEN LIST---" << endl; tokList.printList(); } - std::list rootList; - rootList = parseRoot( tokList.end(), tokList); - if(noisy) { + std::list < DoxygenEntity > rootList; + rootList = parseRoot(tokList.end(), tokList); + if (noisy) { cout << "PARSED LIST" << endl; printTree(rootList); } diff --git a/Source/DoxygenTranslator/src/DoxygenParser.h b/Source/DoxygenTranslator/src/DoxygenParser.h index 2269e6788..c298a92f3 100644 --- a/Source/DoxygenTranslator/src/DoxygenParser.h +++ b/Source/DoxygenTranslator/src/DoxygenParser.h @@ -3,12 +3,11 @@ #include #include #include "DoxygenEntity.h" -class DoxygenParser -{ +class DoxygenParser { public: DoxygenParser(); virtual ~DoxygenParser(); - std::list createTree(std::string doxygen); + std::list < DoxygenEntity > createTree(std::string doxygen); }; -#endif /*DOXYGENPARSER_H_*/ +#endif diff --git a/Source/DoxygenTranslator/src/DoxygenTranslator.cpp b/Source/DoxygenTranslator/src/DoxygenTranslator.cpp index 025670796..6fe97d298 100644 --- a/Source/DoxygenTranslator/src/DoxygenTranslator.cpp +++ b/Source/DoxygenTranslator/src/DoxygenTranslator.cpp @@ -12,21 +12,21 @@ #include "JavaDocConverter.h" #include "PyDocConverter.h" -bool DoxygenTranslator::getDocumentation(Node *node, DocumentationFormat format, String *&documentation){ - switch(format){ - case JavaDoc: - return JavaDocConverter().getDocumentation(node, documentation); - case PyDoc: - return PyDocConverter().getDocumentation(node, documentation); - default: - return false; +bool DoxygenTranslator::getDocumentation(Node *node, DocumentationFormat format, String *&documentation) { + switch (format) { + case JavaDoc: + return JavaDocConverter().getDocumentation(node, documentation); + case PyDoc: + return PyDocConverter().getDocumentation(node, documentation); + default: + return false; } } -void DoxygenTranslator::printTree(std::list &entityList){ - std::list::iterator p = entityList.begin(); - while (p != entityList.end()){ +void DoxygenTranslator::printTree(std::list < DoxygenEntity > &entityList) { + std::list < DoxygenEntity >::iterator p = entityList.begin(); + while (p != entityList.end()) { (*p).printEntity(0); p++; } -} \ No newline at end of file +} diff --git a/Source/DoxygenTranslator/src/DoxygenTranslator.h b/Source/DoxygenTranslator/src/DoxygenTranslator.h index 4be1e97e3..566b1551d 100644 --- a/Source/DoxygenTranslator/src/DoxygenTranslator.h +++ b/Source/DoxygenTranslator/src/DoxygenTranslator.h @@ -28,14 +28,13 @@ enum DocumentationFormat { * A class to translate doxygen comments attacted to parser nodes * into alternative formats for use in code generated for target languages. */ -class DoxygenTranslator -{ +class DoxygenTranslator { public: /* * Virtual destructor. */ - virtual ~DoxygenTranslator(){} - + virtual ~ DoxygenTranslator() { + } /* * Return the documentation for a given node formated for the correct * documentation system. @@ -45,7 +44,7 @@ public: * @return A bool to indicate if there was documentation to return for the node. */ static bool getDocumentation(Node *node, DocumentationFormat format, String *&documentation); - + protected: /* * Overridden in subclasses to return the documentation formatted for a given @@ -55,11 +54,11 @@ protected: * @return A bool to indicate if there was documentation to return for the node. */ virtual bool getDocumentation(Node *node, String *&documentation) = 0; - + /* * Prints the details of a parsed entity list to stdout (for debugging). */ - void printTree(std::list &entityList); + void printTree(std::list < DoxygenEntity > &entityList); }; -#endif /*DOXYGENTRANSLATOR_H_*/ +#endif diff --git a/Source/DoxygenTranslator/src/Examples/DoxygenTransWTokenizer.cpp b/Source/DoxygenTranslator/src/Examples/DoxygenTransWTokenizer.cpp index dacb31f77..930141c97 100644 --- a/Source/DoxygenTranslator/src/Examples/DoxygenTransWTokenizer.cpp +++ b/Source/DoxygenTranslator/src/Examples/DoxygenTransWTokenizer.cpp @@ -1,7 +1,5 @@ /* 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 @@ -40,8 +38,8 @@ to test. */ int testCodeCrawlingFunctions = 0; int demonstrateParsing = 0; int runExamples = 0; -int noisy = 0; // set this to 1 for extra chatter from the parsing stage. -int addCommand(string commandName, int &startInd, list &doxyList, string doxygenString); +int noisy = 0; // set this to 1 for extra chatter from the parsing stage. +int addCommand(string commandName, int &startInd, list < DoxygenEntity > &doxyList, string doxygenString); ////////////////////////////////////////// @@ -51,162 +49,203 @@ int addCommand(string commandName, int &startInd, list &doxyList // 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 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 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" }; + "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" +}; /* All of the doxygen commands divided up by how they are parsed */ -string simpleCommands[] = {"n", "$", "@", "//", "&", "~", "<", ">", "#", "%"}; -string ignoredSimpleCommands[] = {"nothing at the moment"}; -string commandWords[] = {"a", "b", "c", "e", "em", "p", "def", "enum", "example", "package", - "relates", "namespace", "relatesalso","anchor", "dontinclude", "include", "includelineno"}; -string ignoredCommandWords[] = {"copydoc", "copybrief", "copydetails", "verbinclude", "htmlinclude"}; -string commandLines[] = {"addindex", "fn", "name", "line", "var", "skipline", "typedef", "skip", "until", "property"}; -string ignoreCommandLines[] = {"nothing at the moment"}; -string commandParagraph[] = {"return", "remarks", "since", "test", "sa", "see", "pre", "post", "details", "invariant", - "deprecated", "date", "note", "warning", "version", "todo", "bug", "attention", "brief", "arg", "author"}; -string ignoreCommandParagraphs[] = {"nothing at the moment"}; -string commandEndCommands[] = {"code", "dot", "msc", "f$", "f[", "f{environment}{", "htmlonly", "latexonly", "manonly", - "verbatim", "xmlonly", "cond", "if", "ifnot", "link"}; -string commandWordParagraphs[] = {"param", "tparam", "throw", "retval", "exception"}; -string commandWordLines[] = {"page", "subsection", "subsubsection", "section", "paragraph", "defgroup"}; -string commandWordOWordOWords [] = {"category", "class", "protocol", "interface", "struct", "union"}; -string commandOWords[] = {"dir", "file", "cond"}; -string commandErrorThrowings[] = {"annotatedclasslist", "classhierarchy", "define", "functionindex", "header", - "headerfilelist", "inherit", "l", "postheader", "private", "privatesection", "protected", - "protectedsection", "public", "publicsection", "endcode", "enddot", "endmsc", "endhtmlonly", - "endlatexonly", "endmanonly", "endlink", "endverbatim", "endxmlonly", "f]", "f}", "endcond", - "endif"}; -string commandUniques[] = {"xrefitem", "ingroup", "par", "headerfile", "overload", "weakgroup", "ref", - "subpage", "dotfile", "image", "addtogroup", "li"}; +string simpleCommands[] = { "n", "$", "@", "//", "&", "~", "<", ">", "#", "%" }; +string ignoredSimpleCommands[] = { "nothing at the moment" }; + +string commandWords[] = { "a", "b", "c", "e", "em", "p", "def", "enum", "example", "package", + "relates", "namespace", "relatesalso", "anchor", "dontinclude", "include", "includelineno" +}; +string ignoredCommandWords[] = { "copydoc", "copybrief", "copydetails", "verbinclude", "htmlinclude" }; +string commandLines[] = { "addindex", "fn", "name", "line", "var", "skipline", "typedef", "skip", "until", "property" }; +string ignoreCommandLines[] = { "nothing at the moment" }; + +string commandParagraph[] = { "return", "remarks", "since", "test", "sa", "see", "pre", "post", "details", "invariant", + "deprecated", "date", "note", "warning", "version", "todo", "bug", "attention", "brief", "arg", "author" +}; +string ignoreCommandParagraphs[] = { "nothing at the moment" }; + +string commandEndCommands[] = { "code", "dot", "msc", "f$", "f[", "f{environment}{", "htmlonly", "latexonly", "manonly", + "verbatim", "xmlonly", "cond", "if", "ifnot", "link" +}; +string commandWordParagraphs[] = { "param", "tparam", "throw", "retval", "exception" }; +string commandWordLines[] = { "page", "subsection", "subsubsection", "section", "paragraph", "defgroup" }; +string commandWordOWordOWords[] = { "category", "class", "protocol", "interface", "struct", "union" }; +string commandOWords[] = { "dir", "file", "cond" }; + +string commandErrorThrowings[] = { "annotatedclasslist", "classhierarchy", "define", "functionindex", "header", + "headerfilelist", "inherit", "l", "postheader", "private", "privatesection", "protected", + "protectedsection", "public", "publicsection", "endcode", "enddot", "endmsc", "endhtmlonly", + "endlatexonly", "endmanonly", "endlink", "endverbatim", "endxmlonly", "f]", "f}", "endcond", + "endif" +}; + +string commandUniques[] = { "xrefitem", "ingroup", "par", "headerfile", "overload", "weakgroup", "ref", + "subpage", "dotfile", "image", "addtogroup", "li" +}; //int startIndex = 0; - int isNewLine = 0; - int briefDescExists = 0; +int isNewLine = 0; +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; +list < DoxygenEntity > rootList; /* General (untested) assist methods */ - string StringToLower(string stringToConvert) +string StringToLower(string stringToConvert) +{ + //change each element of the string to lower case - {//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){ - if(endIndex >= doxygenString.length()){ - finalIndex = endIndex; - keepLooping = 0; - } - else 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] == '!' || doxygenString[startIndex] == '\t') ){ - if(doxygenString[counter] == '\n') { - //cout << "Blank line found" << endl; - keepLooping = 0; - finalIndex = counter;} - else{ counter++;} - } +string getStringTilCommand(int &startInd, string doxygenString) { + if (startInd >= 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) { + if (endIndex >= doxygenString.length()) { + finalIndex = endIndex; + keepLooping = 0; + } else 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] == '!' + || doxygenString[startIndex] == '\t')) { + if (doxygenString[counter] == '\n') { + //cout << "Blank line found" << endl; + keepLooping = 0; + finalIndex = counter; + } else { + counter++; + } + } - } - //endIndex = counter; - } - else if (doxygenString[endIndex] == '\\' || doxygenString[endIndex] == '@'){ - finalIndex = endIndex; - keepLooping = 0; - } - else if(endIndex < doxygenString.length() -2 - && string("**/").compare(doxygenString.substr(endIndex , endIndex + 2)) == 0){ - finalIndex = endIndex; - //cout << "3 "; - keepLooping = 0; - } - if(keepLooping){ - //cout << "4 "; - endIndex++; - } - } - //cout << "Done with EndIndex" << endl; - while(doxygenString[startIndex] == '!' || doxygenString[startIndex] == ' ' - || doxygenString[startIndex] == '/' || doxygenString[startIndex] == '*' || doxygenString[startIndex] == '\t') startIndex++; + } + //endIndex = counter; + } else if (doxygenString[endIndex] == '\\' || doxygenString[endIndex] == '@') { + finalIndex = endIndex; + keepLooping = 0; + } else if (endIndex < doxygenString.length() - 2 && string("**/").compare(doxygenString.substr(endIndex, endIndex + 2)) == 0) { + finalIndex = endIndex; + //cout << "3 "; + keepLooping = 0; + } + if (keepLooping) { + //cout << "4 "; + endIndex++; + } + } + //cout << "Done with EndIndex" << endl; + while (doxygenString[startIndex] == '!' || doxygenString[startIndex] == ' ' + || doxygenString[startIndex] == '/' || doxygenString[startIndex] == '*' || doxygenString[startIndex] == '\t') + startIndex++; - for (int i = startIndex; i < endIndex; i++){ + for (int i = startIndex; i < endIndex; i++) { + + if (doxygenString[i] == '\n') { + + while ((doxygenString[i] == '\n' || doxygenString[startIndex] == '\t' || doxygenString[i] == ' ' + || doxygenString[i] == '*' || doxygenString[i] == '/') && endIndex < doxygenString.length() - 1) { + i++; + } + description.append(" "); + } + description.push_back(doxygenString[i]); + //cout << doxygenString[i]; + } + //if(noisy) cout << "Final Index is: " << finalIndex << endl; + startInd = finalIndex; + return description; +} - if (doxygenString[i] == '\n') { - while ((doxygenString[i] == '\n' || doxygenString[startIndex] == '\t'|| doxygenString[i] == ' ' - || doxygenString[i] == '*' || doxygenString[i] == '/')&& endIndex < doxygenString.length() - 1){ - i++; - } - description.append(" "); - } - description.push_back(doxygenString[i]); - //cout << doxygenString[i]; - } - //if(noisy) cout << "Final Index is: " << finalIndex << endl; - startInd = finalIndex; - return description; - } - - /* Returns a Paragraph- defined in Doxygen to be a paragraph of text * seperate by either a structural command or a blank line * This method is VERY messy currently */ //TODO fix getStringTilEndOfParagraph to be more forgiving, work on ' ' characters - string getStringTilEndOfParagraph(int &startInd, string doxygenString){ - if (startInd >= 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){ - if(endIndex >= doxygenString.length()){ - finalIndex = endIndex; - keepLooping = 0; - } - else 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[startIndex] == '\t' || doxygenString[counter] == '\n'|| doxygenString[counter] == '/' - || doxygenString[counter] == '!') ){ - if(doxygenString[counter] == '\n') { - //cout << "Blank line found" << endl; - keepLooping = 0; - finalIndex = counter;} - else{ counter++;} - } +string getStringTilEndOfParagraph(int &startInd, string doxygenString) { + if (startInd >= 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) { + if (endIndex >= doxygenString.length()) { + finalIndex = endIndex; + keepLooping = 0; + } else 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[startIndex] == '\t' + || doxygenString[counter] == '\n' || doxygenString[counter] == '/' + || doxygenString[counter] == '!')) { + if (doxygenString[counter] == '\n') { + //cout << "Blank line found" << endl; + keepLooping = 0; + finalIndex = counter; + } else { + counter++; + } + } - } - //endIndex = counter; - } - //todo this fix for not immediately exciting while parsing a paragraph seems somewhat cheap - else if (endIndex != startInd && doxygenString[endIndex] == '\\' || doxygenString[endIndex] == '@'){ - spareIndex = endIndex +1; - - if (isSectionIndicator(getNextWord(spareIndex, doxygenString))) { - keepLooping = 0; - finalIndex = endIndex;} - } - else if(endIndex < doxygenString.length() - 1 - && string("*/").compare(doxygenString.substr(endIndex , endIndex + 1)) == 0){ - keepLooping = 0; - finalIndex = endIndex; - } - if(keepLooping){ - endIndex++; - } - } - //cout << "Done with EndIndex" << endl; - while(doxygenString[startIndex] == '!' || doxygenString[startIndex] == ' ' || doxygenString[startIndex] == '\t' - || doxygenString[startIndex] == '/' || doxygenString[startIndex] == '*') startIndex++; + } + //endIndex = counter; + } + //todo this fix for not immediately exciting while parsing a paragraph seems somewhat cheap + else if (endIndex != startInd && doxygenString[endIndex] == '\\' || doxygenString[endIndex] == '@') { + spareIndex = endIndex + 1; - for (int i = startIndex; i < endIndex; i++){ + if (isSectionIndicator(getNextWord(spareIndex, doxygenString))) { + keepLooping = 0; + finalIndex = endIndex; + } + } else if (endIndex < doxygenString.length() - 1 && string("*/").compare(doxygenString.substr(endIndex, endIndex + 1)) == 0) { + keepLooping = 0; + finalIndex = endIndex; + } + if (keepLooping) { + endIndex++; + } + } + //cout << "Done with EndIndex" << endl; + while (doxygenString[startIndex] == '!' || doxygenString[startIndex] == ' ' || doxygenString[startIndex] == '\t' + || doxygenString[startIndex] == '/' || doxygenString[startIndex] == '*') + startIndex++; - if (doxygenString[i] == '\n') { + for (int i = startIndex; i < endIndex; i++) { - while ((doxygenString[i] == '\n' || doxygenString[startIndex] == '\t' || doxygenString[i] == ' ' ||doxygenString[startIndex] == '!' - || doxygenString[i] == '*' || doxygenString[i] == '/')&& endIndex < doxygenString.length() - 1){ - i++; - } - description.append(" "); - } - description.push_back(doxygenString[i]); - //cout << doxygenString[i]; - } - startInd = finalIndex; - return description; - } + if (doxygenString[i] == '\n') { + + while ((doxygenString[i] == '\n' || doxygenString[startIndex] == '\t' || doxygenString[i] == ' ' || doxygenString[startIndex] == '!' + || 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 @@ -440,263 +488,280 @@ string getStringTilCommand(int &startInd, string doxygenString){ * 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, string doxygenString){ - int endIndex = startInd; - while (endIndex < doxygenString.length()){ - if (doxygenString[endIndex] == '\\' || 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; - } +int progressTilEndCommand(string theCommand, int &startInd, string doxygenString) { + int endIndex = startInd; + while (endIndex < doxygenString.length()) { + if (doxygenString[endIndex] == '\\' || 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; +} /* A specialty method for commands such as \arg that end at the end of a paragraph OR when another \arg is encountered */ - - string getStringTilAnyCommand(string theCommand, int &startInd, string doxygenString){ - if (startInd >= 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){ - if(endIndex >= theCommand.length()){ - finalIndex = endIndex; - keepLooping = 0; - } - else 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] == '!' || doxygenString[startIndex] == '\t') ){ - if(doxygenString[counter] == '\n') { - //cout << "Blank line found" << endl; - keepLooping = 0; - finalIndex = counter;} - else{ counter++;} - } - } - //endIndex = counter; - } - else if (doxygenString[endIndex] == '\\' || doxygenString[endIndex] == '@'){ - //cout << "2 "; - spareIndex = endIndex; - if (endIndex + theCommand.length() < theCommand.length() - && theCommand.compare(doxygenString.substr(endIndex, theCommand.length())) == 0) 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] == '*' || doxygenString[startIndex] == '\t') startIndex++; +string getStringTilAnyCommand(string theCommand, int &startInd, string doxygenString) { + if (startInd >= 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) { + if (endIndex >= theCommand.length()) { + finalIndex = endIndex; + keepLooping = 0; + } else 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] == '!' + || doxygenString[startIndex] == '\t')) { + if (doxygenString[counter] == '\n') { + //cout << "Blank line found" << endl; + keepLooping = 0; + finalIndex = counter; + } else { + counter++; + } + } - for (int i = startIndex; i < endIndex; i++){ + } + //endIndex = counter; + } else if (doxygenString[endIndex] == '\\' || doxygenString[endIndex] == '@') { + //cout << "2 "; + spareIndex = endIndex; + if (endIndex + theCommand.length() < theCommand.length() + && theCommand.compare(doxygenString.substr(endIndex, theCommand.length())) == 0) + 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] == '*' || doxygenString[startIndex] == '\t') + startIndex++; - if (doxygenString[i] == '\n') { + for (int i = startIndex; i < endIndex; i++) { - while ((doxygenString[i] == '\n' || doxygenString[i] == ' ' || doxygenString[startIndex] == '\t' - || doxygenString[i] == '*' || doxygenString[i] == '/')&& endIndex < doxygenString.length() - 1){ - i++; - } - description.append(" "); - } - description.push_back(doxygenString[i]); - //cout << doxygenString[i]; - } - startInd = finalIndex; - return description; - } + if (doxygenString[i] == '\n') { + + while ((doxygenString[i] == '\n' || doxygenString[i] == ' ' || doxygenString[startIndex] == '\t' + || doxygenString[i] == '*' || doxygenString[i] == '/') && endIndex < doxygenString.length() - 1) { + i++; + } + description.append(" "); + } + description.push_back(doxygenString[i]); + //cout << doxygenString[i]; + } + startInd = finalIndex; + return description; +} /* prints the parse tree * */ - void printTree(){ +void printTree() { - list::iterator p = rootList.begin(); - while (p != rootList.end()){ - (*p).printEntity(0); - p++; - } + list < DoxygenEntity >::iterator p = rootList.begin(); + while (p != rootList.end()) { + (*p).printEntity(0); + p++; + } - } - - - - list parse(int startInd, string doxygenString){ - string currWord; - int startIndex = startInd; - int savedIndex; - list aNewList; - int endIndex = doxygenString.length(); - int currCommand; - while (startIndex < endIndex){ - savedIndex = startIndex; - currWord = getNextWord(startIndex, doxygenString); - if(noisy) cout << "Parsing for phrase starting in:" << currWord << endl; - if(currWord == ""){ - if (startIndex < endIndex) startIndex++; - } - else if(currWord[0] == '\\' || currWord[0] == '@'){ - currWord = currWord.substr(1, currWord.length() - 1); - currCommand = findCommand(currWord); - if (currCommand < 0 ){ if(noisy) cout << "BAD COMMAND: " << currWord << endl;} - //cout << "Command: " << currWord << " " << currCommand << endl; - else addCommand(currWord, startIndex, aNewList, doxygenString); - } - else{ - startIndex = savedIndex; - addCommand(string("plainstd::string"), startIndex, aNewList, doxygenString); +} - } - } - return aNewList; - } - + +list < DoxygenEntity > parse(int startInd, string doxygenString) { + string currWord; + int startIndex = startInd; + int savedIndex; + list < DoxygenEntity > aNewList; + int endIndex = doxygenString.length(); + int currCommand; + while (startIndex < endIndex) { + savedIndex = startIndex; + currWord = getNextWord(startIndex, doxygenString); + if (noisy) + cout << "Parsing for phrase starting in:" << currWord << endl; + if (currWord == "") { + if (startIndex < endIndex) + startIndex++; + } else if (currWord[0] == '\\' || currWord[0] == '@') { + currWord = currWord.substr(1, currWord.length() - 1); + currCommand = findCommand(currWord); + if (currCommand < 0) { + if (noisy) + cout << "BAD COMMAND: " << currWord << endl; + } + //cout << "Command: " << currWord << " " << currCommand << endl; + else + addCommand(currWord, startIndex, aNewList, doxygenString); + } else { + startIndex = savedIndex; + addCommand(string("plainstd::string"), startIndex, aNewList, doxygenString); + + } + } + + return aNewList; +} + /* Method for Adding a Simple Command * Format: @command * Plain commands, such as newline etc, they contain no other data * \n \\ \@ \& \$ \# \< \> \% */ - int addSimpleCommand(string theCommand, int &startInd, list &doxyList, string doxygenString){ - - if (noisy) cout << "Parsing " << theCommand << endl; - doxyList.push_back(DoxygenEntity(theCommand)); - return 1; - } - +int addSimpleCommand(string theCommand, int &startInd, list < DoxygenEntity > &doxyList, string doxygenString) { + + if (noisy) + cout << "Parsing " << theCommand << endl; + doxyList.push_back(DoxygenEntity(theCommand)); + return 1; +} + /* NOT INCLUDED Simple Commands * Format: @command * Plain commands, such as newline etc, they contain no other data */ - int ignoreSimpleCommand(string theCommand, int &startInd, list &doxyList, string doxygenString){ - - if (noisy) cout << "Not Adding " << theCommand << endl; - return 1; - } - +int ignoreSimpleCommand(string theCommand, int &startInd, list < DoxygenEntity > &doxyList, string doxygenString) { + + if (noisy) + cout << "Not Adding " << theCommand << endl; + return 1; +} + /* CommandWord * Format: @command * Commands with a single WORD after then such as @b * "a", "b", "c", "e", "em", "p", "def", "enum", "example", "package", * "relates", "namespace", "relatesalso","anchor", "dontinclude", "include", "includelineno" */ - int addCommandWord(string theCommand, int &startInd, list &doxyList, string doxygenString){ - if (noisy) cout << "Parsing " << theCommand << endl; - string name = getNextWord(startInd, doxygenString); - if (!name.empty()){ - doxyList.push_back(DoxygenEntity(theCommand, name)); - return 1; - } - else cout << "No word followed " << theCommand << " command. Not added" << endl; - return 0; - } +int addCommandWord(string theCommand, int &startInd, list < DoxygenEntity > &doxyList, string doxygenString) { + if (noisy) + cout << "Parsing " << theCommand << endl; + string name = getNextWord(startInd, doxygenString); + if (!name.empty()) { + doxyList.push_back(DoxygenEntity(theCommand, name)); + return 1; + } else + cout << "No word followed " << theCommand << " command. Not added" << endl; + return 0; +} + /* NOT INCLUDED CommandWord * Format: @command * Commands with a single WORD after then such as @b * "copydoc", "copybrief", "copydetails", "verbinclude", "htmlinclude" */ - int ignoreCommandWord(string theCommand, int &startInd, list &doxyList, string doxygenString){ - if (noisy) cout << "Not Adding " << theCommand << endl; - string name = getNextWord(startInd, doxygenString); - if (!name.empty()){ - return 1; - } - else cout << "WARNING: No word followed " << theCommand << " command." << endl; - return 0; - } - +int ignoreCommandWord(string theCommand, int &startInd, list < DoxygenEntity > &doxyList, string doxygenString) { + if (noisy) + cout << "Not Adding " << theCommand << endl; + string name = getNextWord(startInd, doxygenString); + if (!name.empty()) { + return 1; + } else + cout << "WARNING: No word followed " << theCommand << " command." << endl; + return 0; +} + /* CommandLine * Format: @command (line) * Commands with a single LINE after then such as @var * "addindex", "fn", "name", "line", "var", "skipline", "typedef", "skip", "until", "property" */ - int addCommandLine(string theCommand, int &startInd, list &doxyList, string doxygenString){ - if (noisy) cout << "Parsing " << theCommand << endl; - string line = getOneLine(startInd, doxygenString); - if(!line.empty()){ - int placement = 0; - list aNewList; - aNewList = parse(placement, line); - doxyList.push_back( DoxygenEntity(theCommand, aNewList)); - return 1; - } - else cout << "No line followed " << theCommand << " command. Not added" << endl; - return 0; - } - +int addCommandLine(string theCommand, int &startInd, list < DoxygenEntity > &doxyList, string doxygenString) { + if (noisy) + cout << "Parsing " << theCommand << endl; + string line = getOneLine(startInd, doxygenString); + if (!line.empty()) { + int placement = 0; + list < DoxygenEntity > aNewList; + aNewList = parse(placement, line); + doxyList.push_back(DoxygenEntity(theCommand, aNewList)); + return 1; + } else + cout << "No line followed " << theCommand << " command. Not added" << endl; + return 0; +} + /* NOT INCLUDED CommandLine * Format: @command (line) * Commands with a single LINE after then such as @var * */ - int ignoreCommandLine(string theCommand, int &startInd, list &doxyList, string doxygenString){ - if (noisy) cout << "Not Adding " << theCommand << endl; - string line = getOneLine(startInd, doxygenString); - if(!line.empty()){ - return 1; - } - else cout << "WARNING: No line followed " << theCommand << " command." << endl; - return 0; - } - +int ignoreCommandLine(string theCommand, int &startInd, list < DoxygenEntity > &doxyList, string doxygenString) { + if (noisy) + cout << "Not Adding " << theCommand << endl; + string line = getOneLine(startInd, doxygenString); + if (!line.empty()) { + return 1; + } else + cout << "WARNING: No line followed " << theCommand << " command." << endl; + return 0; +} + /* CommandParagraph * Format: @command {paragraph} * Commands with a single paragraph after then such as @return * "return", "remarks", "since", "test", "sa", "see", "pre", "post", "details", "invariant", * "deprecated", "date", "note", "warning", "version", "todo", "bug", "attention", "brief", "arg", "author" */ - int addCommandParagraph(string theCommand, int &startInd, list &doxyList, string doxygenString){ - if (noisy) cout << "Parsing " << theCommand << endl; - string restOfParagraph = getStringTilEndOfParagraph(startInd, doxygenString); - if(!restOfParagraph.empty()){ - int placement = 0; - list aNewList; - aNewList = parse(placement, restOfParagraph); - doxyList.push_back( DoxygenEntity(theCommand, aNewList)); - return 1; - } - else cout << "No line followed " << theCommand << " command. Not added" << endl; - return 0; - } +int addCommandParagraph(string theCommand, int &startInd, list < DoxygenEntity > &doxyList, string doxygenString) { + if (noisy) + cout << "Parsing " << theCommand << endl; + string restOfParagraph = getStringTilEndOfParagraph(startInd, doxygenString); + if (!restOfParagraph.empty()) { + int placement = 0; + list < DoxygenEntity > aNewList; + aNewList = parse(placement, restOfParagraph); + doxyList.push_back(DoxygenEntity(theCommand, aNewList)); + return 1; + } else + cout << "No line followed " << theCommand << " command. Not added" << endl; + return 0; +} + /* CommandParagraph * Format: @command {paragraph} * Commands with a single LINE after then such as @var * */ - int ignoreCommandParagraph(string theCommand, int &startInd, list &doxyList, string doxygenString){ - if (noisy) cout << "Not Adding " << theCommand << endl; - string restOfParagraph = getStringTilEndOfParagraph(startInd, doxygenString); - if(!restOfParagraph.empty()){ - return 1; - } - else cout << "WARNING: No line followed " << theCommand << " command." << endl; - return 0; - } +int ignoreCommandParagraph(string theCommand, int &startInd, list < DoxygenEntity > &doxyList, string doxygenString) { + if (noisy) + cout << "Not Adding " << theCommand << endl; + string restOfParagraph = getStringTilEndOfParagraph(startInd, doxygenString); + if (!restOfParagraph.empty()) { + return 1; + } else + cout << "WARNING: No line followed " << theCommand << " command." << endl; + return 0; +} + /* Command EndCommand * Format: @command and ends at @endcommand * Commands that take in a block of text such as @code @@ -704,221 +769,235 @@ string getStringTilCommand(int &startInd, string doxygenString){ * "verbatim", "xmlonly", "cond", "if", "ifnot", "link" * Returns 1 if success, 0 if the endcommand is never encountered. */ - - int ignoreCommandEndCommand(string theCommand, int &startInd, list &doxyList, string doxygenString){ - if (noisy) cout << "Not Adding " << theCommand << endl; - return progressTilEndCommand( "end" + theCommand, startInd, doxygenString); - - } - + +int ignoreCommandEndCommand(string theCommand, int &startInd, list < DoxygenEntity > &doxyList, string doxygenString) { + if (noisy) + cout << "Not Adding " << theCommand << endl; + return progressTilEndCommand("end" + theCommand, startInd, doxygenString); + +} + /* CommandWordParagraph * Format: @command {paragraph} * Commands such as param * "param", "tparam", "throw", "retval", "exception" */ - int addCommandWordParagraph(string theCommand, int &startInd, list &doxyList, string doxygenString){ - if (noisy) cout << "Parsing " << theCommand << endl; - string name = getNextWord(startInd, doxygenString); - if (name.empty()){ - cout << "No word followed " << theCommand << " command. Not added" << endl; - return 0; - } - string restOfParagraph = getStringTilEndOfParagraph(startInd, doxygenString); - int placement = 0; - if(!restOfParagraph.empty()){ - list aNewList; - aNewList = parse(placement, restOfParagraph); - aNewList.push_front(DoxygenEntity("plainstd::string", name)); - doxyList.push_back(DoxygenEntity(theCommand, aNewList)); - return 1; - } - else cout << "No paragraph followed " << theCommand << " command. Not added" << endl; - return 0; +int addCommandWordParagraph(string theCommand, int &startInd, list < DoxygenEntity > &doxyList, string doxygenString) { + if (noisy) + cout << "Parsing " << theCommand << endl; + string name = getNextWord(startInd, doxygenString); + if (name.empty()) { + cout << "No word followed " << theCommand << " command. Not added" << endl; + return 0; } + string restOfParagraph = getStringTilEndOfParagraph(startInd, doxygenString); + int placement = 0; + if (!restOfParagraph.empty()) { + list < DoxygenEntity > aNewList; + aNewList = parse(placement, restOfParagraph); + aNewList.push_front(DoxygenEntity("plainstd::string", name)); + doxyList.push_back(DoxygenEntity(theCommand, aNewList)); + return 1; + } else + cout << "No paragraph followed " << theCommand << " command. Not added" << endl; + return 0; +} + /* CommandWordLine * Format: @command (line) * Commands such as param * "page", "subsection", "subsubsection", "section", "paragraph", "defgroup" */ - int addCommandWordLine(string theCommand, int &startInd, list &doxyList, string doxygenString){ - if (noisy) cout << "Parsing " << theCommand << endl; - string name = getNextWord(startInd, doxygenString); - if (name.empty()){ - cout << "No word followed " << theCommand << " command. Not added" << endl; - return 0; - } - string restOfLine = getStringTilEndOfParagraph(startInd, doxygenString); - int placement = 0; - if(!restOfLine.empty()){ - list aNewList; - aNewList = parse(placement, restOfLine); - aNewList.push_front(DoxygenEntity("plainstd::string", name)); - doxyList.push_back(DoxygenEntity(theCommand, aNewList)); - return 1; - } - else cout << "No line followed " << theCommand << " command. Not added" << endl; - return 0; +int addCommandWordLine(string theCommand, int &startInd, list < DoxygenEntity > &doxyList, string doxygenString) { + if (noisy) + cout << "Parsing " << theCommand << endl; + string name = getNextWord(startInd, doxygenString); + if (name.empty()) { + cout << "No word followed " << theCommand << " command. Not added" << endl; + return 0; } - + string restOfLine = getStringTilEndOfParagraph(startInd, doxygenString); + int placement = 0; + if (!restOfLine.empty()) { + list < DoxygenEntity > aNewList; + aNewList = parse(placement, restOfLine); + aNewList.push_front(DoxygenEntity("plainstd::string", name)); + doxyList.push_back(DoxygenEntity(theCommand, aNewList)); + return 1; + } else + cout << "No line followed " << theCommand << " command. Not added" << endl; + return 0; +} + /* Command Word Optional Word Optional Word * Format: @command [] [] * Commands such as class * "category", "class", "protocol", "interface", "struct", "union" */ - int addCommandWordOWordOWord(string theCommand, int &startInd, list &doxyList, string doxygenString){ - if (noisy) cout << "Parsing " << theCommand << endl; - string name = getNextWord(startInd, doxygenString); - if (name.empty()){ - cout << "No word followed " << theCommand << " command. Not added" << endl; - return 0; - } - string headerfile = getNextWord(startInd, doxygenString); - string headername = getNextWord(startInd, doxygenString); - list aNewList; - aNewList.push_back(DoxygenEntity("plainstd::string", name)); - if (!headerfile.empty()) aNewList.push_back(DoxygenEntity("plainstd::string", headerfile)); - if (!headername.empty()) aNewList.push_back(DoxygenEntity("plainstd::string", headername)); - doxyList.push_back(DoxygenEntity(theCommand, aNewList)); - return 1; +int addCommandWordOWordOWord(string theCommand, int &startInd, list < DoxygenEntity > &doxyList, string doxygenString) { + if (noisy) + cout << "Parsing " << theCommand << endl; + string name = getNextWord(startInd, doxygenString); + if (name.empty()) { + cout << "No word followed " << theCommand << " command. Not added" << endl; + return 0; } - + string headerfile = getNextWord(startInd, doxygenString); + string headername = getNextWord(startInd, doxygenString); + list < DoxygenEntity > aNewList; + aNewList.push_back(DoxygenEntity("plainstd::string", name)); + if (!headerfile.empty()) + aNewList.push_back(DoxygenEntity("plainstd::string", headerfile)); + if (!headername.empty()) + aNewList.push_back(DoxygenEntity("plainstd::string", headername)); + doxyList.push_back(DoxygenEntity(theCommand, aNewList)); + return 1; +} + /* Command Optional Word * Format: @command [] * Commands such as dir * "dir", "file", "cond" */ - int addCommandOWord(string theCommand, int &startInd, list &doxyList, string doxygenString){ - if (noisy) cout << "Parsing " << theCommand << endl; - string name = getNextWord(startInd, doxygenString); - doxyList.push_back(DoxygenEntity(theCommand, name)); - return 1; - } - +int addCommandOWord(string theCommand, int &startInd, list < DoxygenEntity > &doxyList, string doxygenString) { + if (noisy) + cout << "Parsing " << theCommand << endl; + string name = getNextWord(startInd, doxygenString); + doxyList.push_back(DoxygenEntity(theCommand, name)); + return 1; +} + /* 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(string commandString, int &startInd, list &doxyList, string doxygenString){ - string theCommand = StringToLower(commandString); - string voidArray[] = {""}; - /* @command */ +int addCommand(string commandString, int &startInd, list < DoxygenEntity > &doxyList, string doxygenString) { + string theCommand = StringToLower(commandString); + string voidArray[] = { "" }; + /* @command */ - - if (theCommand.compare("plainstd::string") == 0){ - string nextPhrase = getStringTilCommand(startInd, doxygenString); - if (noisy) cout << "Parsing plain string :" << nextPhrase << endl; - doxyList.push_back(DoxygenEntity("plainstd::string", nextPhrase )); - return 1; - } - int commandNumber = commandBelongs(theCommand); - if (commandNumber == SIMPLECOMMAND){ - return addSimpleCommand(theCommand, startInd,doxyList, doxygenString); - } - if (commandNumber == IGNOREDSIMPLECOMMAND){ - return ignoreSimpleCommand(theCommand, startInd,doxyList, doxygenString); - } - if (commandNumber == COMMANDWORD){ - return addCommandWord(theCommand, startInd,doxyList, doxygenString); - } - if (commandNumber == IGNOREDCOMMANDWORD){ - return ignoreCommandWord(theCommand, startInd,doxyList, doxygenString); - } - if (commandNumber == COMMANDLINE ){ - return addCommandLine(theCommand, startInd,doxyList, doxygenString); - } - if (commandNumber == IGNOREDCOMMANDLINE ){ - return ignoreCommandLine(theCommand, startInd,doxyList, doxygenString); - } - if (commandNumber == COMMANDPARAGRAPH){ - return addCommandParagraph(theCommand, startInd,doxyList, doxygenString); - } - if (commandNumber == IGNORECOMMANDPARAGRAPH){ - return ignoreCommandParagraph(theCommand, startInd,doxyList, doxygenString); - } - if (commandNumber == COMMANDENDCOMMAND){ - return ignoreCommandEndCommand(theCommand, startInd,doxyList, doxygenString); - } - if (commandNumber == COMMANDWORDPARAGRAPH){ - return addCommandWordParagraph(theCommand, startInd,doxyList, doxygenString); - } - if (commandNumber == COMMANDWORDLINE){ - return addCommandWordLine(theCommand, startInd,doxyList, doxygenString); - } - if (commandNumber == COMMANDWORDOWORDWORD){ - return addCommandWordOWordOWord(theCommand, startInd,doxyList, doxygenString); - } - if (commandNumber == COMMANDOWORD){ - return addCommandOWord(theCommand, startInd,doxyList, doxygenString); - } - if (commandNumber == COMMANDERRORTHROW){ - return 0; - } - if (commandNumber == COMMANDUNIQUE){ - return 0; - } - - return 0; - } - - int weirdTest(){ - string doxygenString = "this is a test."; - string restOfParagraph; - int startIndex = 0; - restOfParagraph = getStringTilEndOfParagraph(startIndex , doxygenString); - cout << restOfParagraph<< " " << startIndex << endl; - - startIndex = 0; - restOfParagraph = getStringTilCommand(startIndex, doxygenString); - cout << restOfParagraph<< " " << startIndex << endl; - } - + if (theCommand.compare("plainstd::string") == 0) { + string nextPhrase = getStringTilCommand(startInd, doxygenString); + if (noisy) + cout << "Parsing plain string :" << nextPhrase << endl; + doxyList.push_back(DoxygenEntity("plainstd::string", nextPhrase)); + return 1; + } + int commandNumber = commandBelongs(theCommand); + if (commandNumber == SIMPLECOMMAND) { + return addSimpleCommand(theCommand, startInd, doxyList, doxygenString); + } + if (commandNumber == IGNOREDSIMPLECOMMAND) { + return ignoreSimpleCommand(theCommand, startInd, doxyList, doxygenString); + } + if (commandNumber == COMMANDWORD) { + return addCommandWord(theCommand, startInd, doxyList, doxygenString); + } + if (commandNumber == IGNOREDCOMMANDWORD) { + return ignoreCommandWord(theCommand, startInd, doxyList, doxygenString); + } + if (commandNumber == COMMANDLINE) { + return addCommandLine(theCommand, startInd, doxyList, doxygenString); + } + if (commandNumber == IGNOREDCOMMANDLINE) { + return ignoreCommandLine(theCommand, startInd, doxyList, doxygenString); + } + if (commandNumber == COMMANDPARAGRAPH) { + return addCommandParagraph(theCommand, startInd, doxyList, doxygenString); + } + if (commandNumber == IGNORECOMMANDPARAGRAPH) { + return ignoreCommandParagraph(theCommand, startInd, doxyList, doxygenString); + } + if (commandNumber == COMMANDENDCOMMAND) { + return ignoreCommandEndCommand(theCommand, startInd, doxyList, doxygenString); + } + if (commandNumber == COMMANDWORDPARAGRAPH) { + return addCommandWordParagraph(theCommand, startInd, doxyList, doxygenString); + } + if (commandNumber == COMMANDWORDLINE) { + return addCommandWordLine(theCommand, startInd, doxyList, doxygenString); + } + if (commandNumber == COMMANDWORDOWORDWORD) { + return addCommandWordOWordOWord(theCommand, startInd, doxyList, doxygenString); + } + if (commandNumber == COMMANDOWORD) { + return addCommandOWord(theCommand, startInd, doxyList, doxygenString); + } + if (commandNumber == COMMANDERRORTHROW) { + return 0; + } + if (commandNumber == COMMANDUNIQUE) { + return 0; + } + + return 0; +} + +int weirdTest() { + string doxygenString = "this is a test."; + string restOfParagraph; + int startIndex = 0; + restOfParagraph = getStringTilEndOfParagraph(startIndex, doxygenString); + cout << restOfParagraph << " " << startIndex << endl; + + startIndex = 0; + restOfParagraph = getStringTilCommand(startIndex, doxygenString); + cout << restOfParagraph << " " << startIndex << endl; +} + + + +int doRunExamples() { + string line; + string filename; + string exampleNames[] = { "Examples/Example1", "Examples/Example2", "Examples/Example3", "Examples/Example4", "Examples/Example5" }; + int placement; + string doxygenString; + ifstream doxCommentFile; + for (int i = 0; i < 5; i++) { + doxCommentFile.open(exampleNames[i].c_str()); + doxCommentFile >> doxygenString; + while (getline(doxCommentFile, line)) { + doxygenString += line + "\n"; + } + doxCommentFile.close(); + placement = 0; + cout << "---RAW CODE---" << endl << doxygenString << endl << endl; + //clearFluff(placement, doxygenString); + //rootList = parse(placement, doxygenString); + TokenList tokList = TokenList(doxygenString); + tokList.printList(); + cout << "---THE TREE---" << endl; + printTree(); + } + return 1; +} + - int doRunExamples(){ - string line; - string filename; - string exampleNames[] = {"Examples/Example1","Examples/Example2", "Examples/Example3", "Examples/Example4", "Examples/Example5"}; - int placement; - string doxygenString; - ifstream doxCommentFile; - for (int i = 0; i < 5; i++){ - doxCommentFile.open(exampleNames[i].c_str()); - doxCommentFile >> doxygenString; - while(getline(doxCommentFile, line)){ - doxygenString += line + "\n";} - doxCommentFile.close(); - placement = 0; - cout << "---RAW CODE---" << endl << doxygenString << endl< */ -#define POUND_COMMAND 236 /* \# */ -#define PERCENT_COMMAND 237 /* \% */ +#define PROTOCOL 194 /* \protocol */ +#define PUBLIC 195 /* \public (PHP only) */ +#define PUBLICSECTION 196 /* \publicsection (PHP only) */ +#define REF 197 /* \ref */ +#define RELATES 198 /* \relates */ +#define RELATESALSO 199 /* \relatesalso */ +#define REMARKS 200 /* \remarks */ +#define RETURN_COMMAND 201 /* \return */ +#define RETVAL 202 /* \retval */ +#define SA 203 /* \sa */ +#define SECTION 204 /* \section */ +#define SEE 205 /* \see */ +#define SHOWINITIALIZER 206 /* \showinitializer */ +#define SINCE 207 /* \since */ +#define SKIP 208 /* \skip */ +#define SKIPLINE 209 /* \skipline */ +#define STRUCT 210 /* \struct */ +#define SUBPAGE 211 /* \subpage */ +#define SUBSECTION 212 /* \subsection */ +#define SUBSUBSECTION 213 /* \subsubsection */ +#define TEST 214 /* \test */ +#define THROW_COMMAND 215 /* \throw */ +#define TODO_COMMAND 216 /* \todo */ +#define TPARAM_COMMAND 217 /* \tparam */ +#define TYPEDEF_COMMAND 218 /* \typedef */ +#define UNION_COMMAND 219 /* \union */ +#define UNTIL_COMMAND 220 /* \until */ +#define VAR_COMMAND 221 /* \var */ +#define VERBATIM 222 /* \verbatim */ +#define VERBININCLUDE 223 /* \verbinclude */ +#define VERSION 224 /* \version */ +#define WARNING 225 /* \warning */ +#define WEAKGROUP 226 /* \weakgroup */ +#define XMLONLY 227 /* \xmlonly */ +#define XREFITEM 228 /* \xrefitem */ +#define DOLLAR_COMMAND 229 /* \$ */ +#define AT_COMMAND 230 /* \@ */ +#define SLASH_COMMAND 231 /* \\ */ +#define AND_COMMAND 232 /* \& */ +#define TILDE_COMMAND 233 /* \~ */ +#define LEFTANGLEBRACKET 234 /* \< */ +#define RIGHTANGLEBRACKET 235 /* \> */ +#define POUND_COMMAND 236 /* \# */ +#define PERCENT_COMMAND 237 /* \% */ -#endif /*TRANSLATOR_H_*/ +#endif diff --git a/Source/DoxygenTranslator/src/JavaDocConverter.cpp b/Source/DoxygenTranslator/src/JavaDocConverter.cpp index 33a62ff77..9de2f99f3 100644 --- a/Source/DoxygenTranslator/src/JavaDocConverter.cpp +++ b/Source/DoxygenTranslator/src/JavaDocConverter.cpp @@ -1,42 +1,43 @@ #include "JavaDocConverter.h" #include "DoxygenParser.h" #include -#define APPROX_LINE_LENGTH 64//characters per line allowed -#define TAB_SIZE 8//characters per line allowed +#define APPROX_LINE_LENGTH 64 //characters per line allowed +#define TAB_SIZE 8 //characters per line allowed int printSortedTree2 = 0; //TODO {@link} {@linkplain} {@docRoot}, and other useful doxy commands that are not a javadoc tag -std::string JavaDocConverter::formatCommand(std::string unformattedLine, int indent){ +std::string JavaDocConverter::formatCommand(std::string unformattedLine, int indent) { std::string formattedLines = "\n * "; int lastPosition = 0; int i = 0; - int isFirstLine = 1; - while (i != -1 && i < (int)unformattedLine.length()){ + int isFirstLine = 1; + while (i != -1 && i < (int) unformattedLine.length()) { lastPosition = i; - if (isFirstLine){ - i+=APPROX_LINE_LENGTH; + if (isFirstLine) { + i += APPROX_LINE_LENGTH; } else { - i+=APPROX_LINE_LENGTH - indent*TAB_SIZE; + i += APPROX_LINE_LENGTH - indent * TAB_SIZE; } i = unformattedLine.find(" ", i); - if (i > 0 && i + 1 < (int)unformattedLine.length()){ - if (!isFirstLine) for (int j = 0; j < indent; j++) { - formattedLines.append("\t"); + if (i > 0 && i + 1 < (int) unformattedLine.length()) { + if (!isFirstLine) + for (int j = 0; j < indent; j++) { + formattedLines.append("\t"); } else { - isFirstLine = 0; + isFirstLine = 0; } formattedLines.append(unformattedLine.substr(lastPosition, i - lastPosition + 1)); formattedLines.append("\n *"); } } - if (lastPosition < (int)unformattedLine.length()){ + if (lastPosition < (int) unformattedLine.length()) { if (!isFirstLine) { - for (int j = 0; j < indent; j++) { - formattedLines.append("\t"); - } + for (int j = 0; j < indent; j++) { + formattedLines.append("\t"); + } } formattedLines.append(unformattedLine.substr(lastPosition, unformattedLine.length() - lastPosition)); } @@ -47,57 +48,47 @@ std::string JavaDocConverter::formatCommand(std::string unformattedLine, int ind /* Contains the conversions for tags * could probably be much more efficient... */ -std::string JavaDocConverter::javaDocFormat(DoxygenEntity &doxygenEntity){ - if(doxygenEntity.typeOfEntity.compare("partofdescription") == 0){ - return doxygenEntity.data; - } - if (doxygenEntity.typeOfEntity.compare("plainstd::string") == 0){ - return doxygenEntity.data; +std::string JavaDocConverter::javaDocFormat(DoxygenEntity & doxygenEntity) { + if (doxygenEntity.typeOfEntity.compare("partofdescription") == 0) { + return doxygenEntity.data; } - else if (doxygenEntity.typeOfEntity.compare("b") == 0){ + if (doxygenEntity.typeOfEntity.compare("plainstd::string") == 0) { + return doxygenEntity.data; + } else if (doxygenEntity.typeOfEntity.compare("b") == 0) { return "" + doxygenEntity.data + ""; - } - else if (doxygenEntity.typeOfEntity.compare("c") == 0){ + } else if (doxygenEntity.typeOfEntity.compare("c") == 0) { return "" + doxygenEntity.data + ""; - } - else if (doxygenEntity.typeOfEntity.compare("@") == 0){ + } else if (doxygenEntity.typeOfEntity.compare("@") == 0) { return "@"; - } - else if (doxygenEntity.typeOfEntity.compare("\\") == 0){ + } else if (doxygenEntity.typeOfEntity.compare("\\") == 0) { return "\\"; - } - else if (doxygenEntity.typeOfEntity.compare("<") == 0){ + } else if (doxygenEntity.typeOfEntity.compare("<") == 0) { return "<"; - } - else if (doxygenEntity.typeOfEntity.compare(">") == 0){ + } else if (doxygenEntity.typeOfEntity.compare(">") == 0) { return ">"; - } - else if (doxygenEntity.typeOfEntity.compare("&") == 0){ + } else if (doxygenEntity.typeOfEntity.compare("&") == 0) { return "&"; - } - else if (doxygenEntity.typeOfEntity.compare("#") == 0){ + } else if (doxygenEntity.typeOfEntity.compare("#") == 0) { return "#"; - } - else if (doxygenEntity.typeOfEntity.compare("%") == 0){ + } else if (doxygenEntity.typeOfEntity.compare("%") == 0) { return "%"; - } - else if (doxygenEntity.typeOfEntity.compare("~") == 0){ + } else if (doxygenEntity.typeOfEntity.compare("~") == 0) { return "~"; } return ""; } -std::string JavaDocConverter::translateSubtree( DoxygenEntity &doxygenEntity){ +std::string JavaDocConverter::translateSubtree(DoxygenEntity & doxygenEntity) { std::string returnedString; - if (doxygenEntity.isLeaf) { + if (doxygenEntity.isLeaf) { return javaDocFormat(doxygenEntity) + " "; } else { returnedString += javaDocFormat(doxygenEntity); - std::list::iterator p = doxygenEntity.entityList.begin(); + std::list < DoxygenEntity >::iterator p = doxygenEntity.entityList.begin(); - while (p != doxygenEntity.entityList.end()){ - returnedString+= translateSubtree(*p); + while (p != doxygenEntity.entityList.end()) { + returnedString += translateSubtree(*p); p++; } } @@ -105,45 +96,43 @@ std::string JavaDocConverter::translateSubtree( DoxygenEntity &doxygenEntity){ } -std::string JavaDocConverter::translateEntity(DoxygenEntity &doxyEntity){ +std::string JavaDocConverter::translateEntity(DoxygenEntity & doxyEntity) { if (doxyEntity.typeOfEntity.compare("partofdescription") == 0) { return formatCommand(std::string(translateSubtree(doxyEntity)), 0); } - if ((doxyEntity.typeOfEntity.compare("brief") == 0) || - (doxyEntity.typeOfEntity.compare("details") == 0)) { + if ((doxyEntity.typeOfEntity.compare("brief") == 0) || (doxyEntity.typeOfEntity.compare("details") == 0)) { return formatCommand(std::string(translateSubtree(doxyEntity)), 0) + "\n * "; - } else if(doxyEntity.typeOfEntity.compare("plainstd::string")== 0 || - doxyEntity.typeOfEntity.compare("deprecated")== 0 || - doxyEntity.typeOfEntity.compare("brief")== 0) { + } else if (doxyEntity.typeOfEntity.compare("plainstd::string") == 0 || + doxyEntity.typeOfEntity.compare("deprecated") == 0 || + doxyEntity.typeOfEntity.compare("brief") == 0) { return formatCommand(doxyEntity.data, 0) + "\n * "; - } else if(doxyEntity.typeOfEntity.compare("see") == 0) { - return formatCommand(std::string("@" + doxyEntity.typeOfEntity + "\t\t" + - translateSubtree(doxyEntity)), 2); + } else if (doxyEntity.typeOfEntity.compare("see") == 0) { + return formatCommand(std::string("@" + doxyEntity.typeOfEntity + "\t\t" + translateSubtree(doxyEntity)), 2); - } else if(doxyEntity.typeOfEntity.compare("return")== 0 - || doxyEntity.typeOfEntity.compare("author")== 0 - || doxyEntity.typeOfEntity.compare("param")== 0 - || doxyEntity.typeOfEntity.compare("throw")== 0 - || doxyEntity.typeOfEntity.compare("throws")== 0 - || doxyEntity.typeOfEntity.compare("since")== 0 - || doxyEntity.typeOfEntity.compare("version")== 0 - || doxyEntity.typeOfEntity.compare("exception") == 0 - || doxyEntity.typeOfEntity.compare("deprecated") == 0){ + } else if (doxyEntity.typeOfEntity.compare("return") == 0 + || doxyEntity.typeOfEntity.compare("author") == 0 + || doxyEntity.typeOfEntity.compare("param") == 0 + || doxyEntity.typeOfEntity.compare("throw") == 0 + || doxyEntity.typeOfEntity.compare("throws") == 0 + || doxyEntity.typeOfEntity.compare("since") == 0 + || doxyEntity.typeOfEntity.compare("version") == 0 + || doxyEntity.typeOfEntity.compare("exception") == 0 + || doxyEntity.typeOfEntity.compare("deprecated") == 0) { // this 'if' is a hack - convert doxyEntity.typeOfEntity at the time of parsing - if (doxyEntity.typeOfEntity.compare("throw")== 0) { + if (doxyEntity.typeOfEntity.compare("throw") == 0) { doxyEntity.typeOfEntity = "throws"; } return formatCommand(std::string("@" + doxyEntity.typeOfEntity + "\t" + translateSubtree(doxyEntity)), 2); - } else if(doxyEntity.typeOfEntity.compare("sa")== 0) { + } else if (doxyEntity.typeOfEntity.compare("sa") == 0) { return formatCommand(std::string("@see\t\t" + translateSubtree(doxyEntity)), 2); } else { - return formatCommand(javaDocFormat(doxyEntity), 0 ); + return formatCommand(javaDocFormat(doxyEntity), 0); } return ""; @@ -157,31 +146,31 @@ bool JavaDocConverter::getDocumentation(Node *node, String *&documentation) { if (documentation == NULL) { return false; } - - std::list entityList = DoxygenParser().createTree(Char(documentation)); - // entityList.sort(CompareDoxygenEntities()); sorting currently not used, - // see CompareDoxygenEntities::operator() in DoxygenEntity.cpp - - if(debug){ + std::list < DoxygenEntity > entityList = DoxygenParser().createTree(Char(documentation)); + + // entityList.sort(CompareDoxygenEntities()); sorting currently not used, + // see CompareDoxygenEntities::operator() in DoxygenEntity.cpp + + if (debug) { std::cout << "---RESORTED LIST---" << std::endl; printTree(entityList); } std::string javaDocString = "/**"; - - for(std::list::iterator entityIterator = entityList.begin(); entityIterator != entityList.end();){ + + for (std::list < DoxygenEntity >::iterator entityIterator = entityList.begin(); entityIterator != entityList.end();) { javaDocString += translateEntity(*entityIterator); entityIterator++; } javaDocString += "\n */\n"; - - if(debug){ + + if (debug) { std::cout << "\n---RESULT IN JAVADOC---" << std::endl; - std::cout << javaDocString; + std::cout << javaDocString; } - + documentation = NewString(javaDocString.c_str()); return true; } diff --git a/Source/DoxygenTranslator/src/JavaDocConverter.h b/Source/DoxygenTranslator/src/JavaDocConverter.h index 8651bb1cf..d898265ba 100644 --- a/Source/DoxygenTranslator/src/JavaDocConverter.h +++ b/Source/DoxygenTranslator/src/JavaDocConverter.h @@ -15,20 +15,20 @@ /* * A class to translate doxygen comments into JavaDoc style comments. */ -class JavaDocConverter : public DoxygenTranslator -{ +class JavaDocConverter : public DoxygenTranslator { public: - JavaDocConverter() : debug( false ){} + JavaDocConverter() : debug(false) { + } virtual bool getDocumentation(Node *node, String *&documentation); - + protected: std::string formatCommand(std::string unformattedLine, int indent); - std::string translateEntity(DoxygenEntity &doxyEntity); - std::string javaDocFormat(DoxygenEntity &doxygenEntity); - std::string translateSubtree( DoxygenEntity &doxygenEntity); - + std::string translateEntity(DoxygenEntity & doxyEntity); + std::string javaDocFormat(DoxygenEntity & doxygenEntity); + std::string translateSubtree(DoxygenEntity & doxygenEntity); + private: bool debug; }; -#endif /*JAVADOCCONVERTER_H_*/ +#endif diff --git a/Source/DoxygenTranslator/src/PyDocConverter.cpp b/Source/DoxygenTranslator/src/PyDocConverter.cpp index 6418ee73c..44dec4cbf 100644 --- a/Source/DoxygenTranslator/src/PyDocConverter.cpp +++ b/Source/DoxygenTranslator/src/PyDocConverter.cpp @@ -14,25 +14,25 @@ #include //TODO {@link} {@linkplain} {@docRoot}, and other useful doxy commands that are not a pydoc tag -PyDocConverter::PyDocConverter(){ - debug = 1; +PyDocConverter::PyDocConverter() { + debug = 1; } -std::string PyDocConverter::formatParam(Node *n, DoxygenEntity &doxygenEntity) { +std::string PyDocConverter::formatParam(Node *n, DoxygenEntity & doxygenEntity) { ParmList *plist = CopyParmList(Getattr(n, "parms")); Parm *p = NULL; - - DoxygenEntity& paramNameEntity = *doxygenEntity.entityList.begin(); - DoxygenEntity& paramDescriptionEntity = *(++doxygenEntity.entityList.begin()); - + + DoxygenEntity & paramNameEntity = *doxygenEntity.entityList.begin(); + DoxygenEntity & paramDescriptionEntity = *(++doxygenEntity.entityList.begin()); + std::string result; std::string paramDescription = justifyString(paramDescriptionEntity.data, DOC_PARAM_STRING_LENGTH); - + for (p = plist; p;) { - if(Char(Getattr(p, "name")) == paramNameEntity.data) { + if (Char(Getattr(p, "name")) == paramNameEntity.data) { std::string name = Char(Swig_name_make(n, 0, Getattr(p, "name"), 0, 0)); std::string type = Char(Swig_name_make(n, 0, Getattr(p, "type"), 0, 0)); - + result = name + " (" + type + ") "; result.resize(DOC_PARAM_STRING_LENGTH - 3, ' '); result += "-- " + paramDescription.substr(DOC_PARAM_STRING_LENGTH); @@ -45,162 +45,158 @@ std::string PyDocConverter::formatParam(Node *n, DoxygenEntity &doxygenEntity) { return result; } -std::string PyDocConverter::formatReturnDescription(Node *node, DoxygenEntity &doxygenEntity){ +std::string PyDocConverter::formatReturnDescription(Node *node, DoxygenEntity & doxygenEntity) { #pragma unused(node) return "\nResult:\n" + justifyString(translateSubtree(doxygenEntity)); } -std::string PyDocConverter::justifyString(std::string documentString, int indent, int maxWidth){ +std::string PyDocConverter::justifyString(std::string documentString, int indent, int maxWidth) { std::ostringstream formattedString; std::string currentLine; - - for(std::string::iterator stringPosition = documentString.begin(); stringPosition != documentString.end(); ++stringPosition) - { - if(currentLine.length() == 0) + + for (std::string::iterator stringPosition = documentString.begin(); stringPosition != documentString.end(); ++stringPosition) { + if (currentLine.length() == 0) currentLine.resize(indent, ' '); - + currentLine += *stringPosition; - - if(*stringPosition == ' ' && (int)currentLine.size() >= maxWidth || (stringPosition + 1) == documentString.end()) - { + + if (*stringPosition == ' ' && (int) currentLine.size() >= maxWidth || (stringPosition + 1) == documentString.end()) { formattedString << currentLine << std::endl; currentLine = ""; } } - + return formattedString.str(); } -std::string PyDocConverter::translateSubtree( DoxygenEntity &doxygenEntity){ +std::string PyDocConverter::translateSubtree(DoxygenEntity & doxygenEntity) { std::string returnedString; if (doxygenEntity.isLeaf) return doxygenEntity.data + " "; else { returnedString += doxygenEntity.data; - std::list::iterator p = doxygenEntity.entityList.begin(); - while (p != doxygenEntity.entityList.end()){ - returnedString+= translateSubtree(*p); + std::list < DoxygenEntity >::iterator p = doxygenEntity.entityList.begin(); + while (p != doxygenEntity.entityList.end()) { + returnedString += translateSubtree(*p); p++; } } return returnedString; } -std::string PyDocConverter::translateEntity(Node *n, DoxygenEntity &doxyEntity){ - if(doxyEntity.typeOfEntity.compare("partofdescription") == 0) +std::string PyDocConverter::translateEntity(Node *n, DoxygenEntity & doxyEntity) { + if (doxyEntity.typeOfEntity.compare("partofdescription") == 0) return justifyString(std::string(translateSubtree(doxyEntity)), 0); - + if ((doxyEntity.typeOfEntity.compare("brief") == 0) - ||(doxyEntity.typeOfEntity.compare("details") == 0)) + || (doxyEntity.typeOfEntity.compare("details") == 0)) return justifyString(std::string(translateSubtree(doxyEntity)), 0) + "\n"; - - if(doxyEntity.typeOfEntity.compare("plainstd::string") == 0 - || doxyEntity.typeOfEntity.compare("deprecated") == 0 - || doxyEntity.typeOfEntity.compare("brief") == 0) + + if (doxyEntity.typeOfEntity.compare("plainstd::string") == 0 + || doxyEntity.typeOfEntity.compare("deprecated") == 0 + || doxyEntity.typeOfEntity.compare("brief") == 0) return justifyString(doxyEntity.data, 0) + "\n"; - - if(doxyEntity.typeOfEntity.compare("param") == 0) + + if (doxyEntity.typeOfEntity.compare("param") == 0) return formatParam(n, doxyEntity); - - if(doxyEntity.typeOfEntity.compare("return") == 0) + + if (doxyEntity.typeOfEntity.compare("return") == 0) return formatReturnDescription(n, doxyEntity); - if(doxyEntity.typeOfEntity.compare("author") == 0 - || doxyEntity.typeOfEntity.compare("param") == 0 - || doxyEntity.typeOfEntity.compare("since") == 0 - || doxyEntity.typeOfEntity.compare("version") == 0 - || doxyEntity.typeOfEntity.compare("exception") == 0 - || doxyEntity.typeOfEntity.compare("deprecated") == 0 - || doxyEntity.typeOfEntity.compare("sa") == 0) + if (doxyEntity.typeOfEntity.compare("author") == 0 + || doxyEntity.typeOfEntity.compare("param") == 0 + || doxyEntity.typeOfEntity.compare("since") == 0 + || doxyEntity.typeOfEntity.compare("version") == 0 + || doxyEntity.typeOfEntity.compare("exception") == 0 + || doxyEntity.typeOfEntity.compare("deprecated") == 0 + || doxyEntity.typeOfEntity.compare("sa") == 0) return ""; return justifyString(doxyEntity.data); } -std::string PyDocConverter::processEntityList(Node *n, std::list& entityList){ +std::string PyDocConverter::processEntityList(Node *n, std::list < DoxygenEntity > &entityList) { std::string result; bool inParamsSection = false; - - for(std::list::iterator entityIterator = entityList.begin(); entityIterator != entityList.end();){ - if(entityIterator->typeOfEntity.compare("param") == 0 && !inParamsSection){ + + for (std::list < DoxygenEntity >::iterator entityIterator = entityList.begin(); entityIterator != entityList.end();) { + if (entityIterator->typeOfEntity.compare("param") == 0 && !inParamsSection) { inParamsSection = true; result += "\nArguments:\n"; - } - else if(entityIterator->typeOfEntity.compare("param") != 0 && inParamsSection) + } else if (entityIterator->typeOfEntity.compare("param") != 0 && inParamsSection) inParamsSection = false; - + result += translateEntity(n, *entityIterator); entityIterator++; - } - + } + return result; } -bool PyDocConverter::getDocumentation(Node *n, String *&documentation){ +bool PyDocConverter::getDocumentation(Node *n, String *&documentation) { std::string pyDocString, result; - + // for overloaded functions we must concat documentation for underlying overloads - if(Checkattr(n, "kind", "function") && Getattr(n, "sym:overloaded")){ + if (Checkattr(n, "kind", "function") && Getattr(n, "sym:overloaded")) { // rewind to the first overload while (Getattr(n, "sym:previousSibling")) n = Getattr(n, "sym:previousSibling"); - - std::vector allDocumentation; - + + std::vector < std::string > allDocumentation; + // for each real method (not a generated overload) append the documentation - while(n){ - documentation = Getattr(n,"DoxygenComment"); - if(!Swig_is_generated_overload(n) && documentation){ - std::list entityList = DoxygenParser().createTree(Char(documentation)); + while (n) { + documentation = Getattr(n, "DoxygenComment"); + if (!Swig_is_generated_overload(n) && documentation) { + std::list < DoxygenEntity > entityList = DoxygenParser().createTree(Char(documentation)); allDocumentation.push_back(processEntityList(n, entityList)); } n = Getattr(n, "sym:nextSibling"); } - + // construct final documentation string - if(allDocumentation.size() > 1){ + if (allDocumentation.size() > 1) { std::ostringstream concatDocString; - for(int realOverloadCount = 0; realOverloadCount < (int)allDocumentation.size(); realOverloadCount++){ + for (int realOverloadCount = 0; realOverloadCount < (int) allDocumentation.size(); realOverloadCount++) { concatDocString << generateDivider(); concatDocString << "Overload " << (realOverloadCount + 1) << ":" << std::endl; concatDocString << generateDivider(); concatDocString << allDocumentation[realOverloadCount] << std::endl; } pyDocString = concatDocString.str(); - } - else if (allDocumentation.size() == 1) { + } else if (allDocumentation.size() == 1) { pyDocString = *(allDocumentation.begin()); } - } + } // for other nodes just process as normal else { - documentation = Getattr(n,"DoxygenComment"); - if(documentation != NULL){ - std::list entityList = DoxygenParser().createTree(Char(documentation)); + documentation = Getattr(n, "DoxygenComment"); + if (documentation != NULL) { + std::list < DoxygenEntity > entityList = DoxygenParser().createTree(Char(documentation)); pyDocString = processEntityList(n, entityList); } } - + // if we got something log the result and construct DOH string to return - if(pyDocString.length()) { + if (pyDocString.length()) { result = "\"\"\"\n" + pyDocString + "\"\"\"\n"; - - if(debug){ + + if (debug) { std::cout << "\n---RESULT IN PYDOC---" << std::endl; std::cout << result; std::cout << std::endl; } - + documentation = NewString(result.c_str()); return true; } - + return false; } -std::string PyDocConverter::generateDivider(){ +std::string PyDocConverter::generateDivider() { std::ostringstream dividerString; - for(int i = 0; i < DOC_STRING_LENGTH; i++) + for (int i = 0; i < DOC_STRING_LENGTH; i++) dividerString << '-'; dividerString << std::endl; return dividerString.str(); diff --git a/Source/DoxygenTranslator/src/PyDocConverter.h b/Source/DoxygenTranslator/src/PyDocConverter.h index 500e39fe8..5680480fc 100644 --- a/Source/DoxygenTranslator/src/PyDocConverter.h +++ b/Source/DoxygenTranslator/src/PyDocConverter.h @@ -16,38 +16,37 @@ #include "DoxygenEntity.h" #include "DoxygenTranslator.h" -#define DOC_STRING_LENGTH 64 // characters per line allowed -#define DOC_PARAM_STRING_LENGTH 30 // characters reserved for param name / type +#define DOC_STRING_LENGTH 64 // characters per line allowed +#define DOC_PARAM_STRING_LENGTH 30 // characters reserved for param name / type -class PyDocConverter : public DoxygenTranslator -{ +class PyDocConverter : public DoxygenTranslator { public: PyDocConverter(); bool getDocumentation(Node *node, String *&documentation); - + protected: - + /* * Process the contents of the entity list producing a documentation string. * @param node The parse tree node that the entity list relates to. * @param entityList The entity list to process */ - std::string processEntityList(Node *node, std::list& entityList); - + std::string processEntityList(Node *node, std::list < DoxygenEntity > &entityList); + /* * Format the doxygen comment relating to a function or method parameter * @param node The parse tree node that the parameter relates to. * @param doxygenEntity The doxygen entity relating to the parameter docstring. */ - std::string formatParam(Node *node, DoxygenEntity &doxygenEntity); - + std::string formatParam(Node *node, DoxygenEntity & doxygenEntity); + /* * Format the doxygen comment relating to the return value for a method or function. * @param node The parse tree node that the parameter relates to. * @param doxygenEntity The doxygen entity relating to the parameter docstring. */ - std::string formatReturnDescription(Node *node, DoxygenEntity &doxygenEntity); - + std::string formatReturnDescription(Node *node, DoxygenEntity & doxygenEntity); + /* * Format a string so it is justified and split over several lines * not exeeding a given length. @@ -56,17 +55,17 @@ protected: * @param maxWidth The approximate maximum line width. */ std::string justifyString(std::string unformattedLine, int indent = 0, int maxWidth = DOC_STRING_LENGTH); - - std::string translateSubtree( DoxygenEntity &doxygenEntity); - std::string translateEntity(Node *n, DoxygenEntity &doxyEntity); - + + std::string translateSubtree(DoxygenEntity & doxygenEntity); + std::string translateEntity(Node *n, DoxygenEntity & doxyEntity); + /* * Utility method to generate a diving line for a documentation string. */ std::string generateDivider(); - + private: bool debug; }; -#endif /*PYDOCCONVERTER_H_*/ +#endif diff --git a/Source/DoxygenTranslator/src/Token.cpp b/Source/DoxygenTranslator/src/Token.cpp index 2ac03afe5..f7c02b021 100644 --- a/Source/DoxygenTranslator/src/Token.cpp +++ b/Source/DoxygenTranslator/src/Token.cpp @@ -3,27 +3,26 @@ using namespace std; -Token::Token(int tType, string tString) -{ - tokenType = tType; - tokenString = tString; +Token::Token(int tType, string tString) { + tokenType = tType; + tokenString = tString; } -string Token::toString() -{ - if (tokenType == END_LINE){ - return "{END OF LINE}"; - } - if (tokenType == PARAGRAPH_END){ - return "{END OF PARAGRAPH}"; - } - if (tokenType == PLAINSTRING){ - return "{PLAINSTRING :" + tokenString + "}"; - } - if (tokenType == COMMAND){ - return "{COMMAND : " + tokenString+ "}"; - } - return ""; +string Token::toString() { + if (tokenType == END_LINE) { + return "{END OF LINE}"; + } + if (tokenType == PARAGRAPH_END) { + return "{END OF PARAGRAPH}"; + } + if (tokenType == PLAINSTRING) { + return "{PLAINSTRING :" + tokenString + "}"; + } + if (tokenType == COMMAND) { + return "{COMMAND : " + tokenString + "}"; + } + return ""; } -Token:: ~Token(){} +Token::~Token() { +} diff --git a/Source/DoxygenTranslator/src/Token.h b/Source/DoxygenTranslator/src/Token.h index cf28c90b7..4ae44b65f 100644 --- a/Source/DoxygenTranslator/src/Token.h +++ b/Source/DoxygenTranslator/src/Token.h @@ -4,15 +4,14 @@ using namespace std; -class Token -{ +class Token { public: - Token(int tType, string tString); - ~Token(); + Token(int tType, string tString); + ~Token(); - int tokenType; /* currently can be END_LINE, PLAINSTRING, or COMMAND */ - string tokenString; /* the data , such as param for @param*/ - string toString(); + int tokenType; /* currently can be END_LINE, PLAINSTRING, or COMMAND */ + string tokenString; /* the data , such as param for @param */ + string toString(); }; -#endif /*TOKEN_H_*/ +#endif diff --git a/Source/DoxygenTranslator/src/TokenList.cpp b/Source/DoxygenTranslator/src/TokenList.cpp index 9efd7e9ef..8eeef97b2 100644 --- a/Source/DoxygenTranslator/src/TokenList.cpp +++ b/Source/DoxygenTranslator/src/TokenList.cpp @@ -5,165 +5,161 @@ #include #include "Token.h" #include "DoxygenEntity.h" -#define TOKENSPERLINE 8; //change this to change the printing behaviour of the token list +#define TOKENSPERLINE 8; //change this to change the printing behaviour of the token list using namespace std; int noisy2 = 0; /* The tokenizer*/ -TokenList::TokenList(const std::string &doxygenStringConst){ - size_t commentPos; - string doxygenString = doxygenStringConst; +TokenList::TokenList(const std::string & doxygenStringConst) { + size_t commentPos; + string doxygenString = doxygenStringConst; - /* Comment start tokens are replaced in parser.y, see doxygen_comment and - doxygen_post_comment_item - do { - commentPos = doxygenString.find("///<"); - if (commentPos != string::npos) { - doxygenString.replace(commentPos, 4, " "); - continue; - } - commentPos = doxygenString.find("/**<"); - if (commentPos != string::npos) { - doxygenString.replace(commentPos, 4, " "); - continue; - } - commentPos = doxygenString.find("/*!<"); - if (commentPos != string::npos) { - doxygenString.replace(commentPos, 4, " "); - continue; - } - commentPos = doxygenString.find("//!<"); - if (commentPos != string::npos) { - doxygenString.replace(commentPos, 4, " "); - continue; - } - break; - } while (true); */ + /* Comment start tokens are replaced in parser.y, see doxygen_comment and + doxygen_post_comment_item + do { + commentPos = doxygenString.find("///<"); + if (commentPos != string::npos) { + doxygenString.replace(commentPos, 4, " "); + continue; + } + commentPos = doxygenString.find("/**<"); + if (commentPos != string::npos) { + doxygenString.replace(commentPos, 4, " "); + continue; + } + commentPos = doxygenString.find("/*!<"); + if (commentPos != string::npos) { + doxygenString.replace(commentPos, 4, " "); + continue; + } + commentPos = doxygenString.find("//!<"); + if (commentPos != string::npos) { + doxygenString.replace(commentPos, 4, " "); + continue; + } + break; + } while (true); + */ - size_t currentIndex = 0; - size_t nextIndex = 0; + size_t currentIndex = 0; + size_t nextIndex = 0; - string currentWord; + string currentWord; - while (currentIndex < doxygenString.length()){ + while (currentIndex < doxygenString.length()) { - if(doxygenString[currentIndex] == '\n'){ - m_tokenList.push_back(Token(END_LINE, currentWord)); - currentIndex++; - } + if (doxygenString[currentIndex] == '\n') { + m_tokenList.push_back(Token(END_LINE, currentWord)); + currentIndex++; + } + // skip WS, except \n + while (currentIndex < doxygenString.length() && (doxygenString[currentIndex] == ' ' || doxygenString[currentIndex] == '\t')) + currentIndex++; - // skip WS, except \n - while(currentIndex < doxygenString.length() && (doxygenString[currentIndex] == ' ' - || doxygenString[currentIndex]== '\t')) currentIndex ++; + if (currentIndex < doxygenString.length()) { - if (currentIndex < doxygenString.length()) { + nextIndex = currentIndex; - nextIndex = currentIndex; + // skip non WS + while (nextIndex < doxygenString.length() && (doxygenString[nextIndex] != ' ' && doxygenString[nextIndex] != '\t' && doxygenString[nextIndex] != '\n')) + nextIndex++; - // skip non WS - while (nextIndex < doxygenString.length() && (doxygenString[nextIndex] != ' ' - && doxygenString[nextIndex] != '\t' && doxygenString[nextIndex]!= '\n')) - nextIndex++; + // now we have a token + currentWord = doxygenString.substr(currentIndex, nextIndex - currentIndex); - // now we have a token - currentWord = doxygenString.substr(currentIndex, nextIndex-currentIndex); + if (noisy2) + cout << "Current Word: " << currentWord << endl; - if(noisy2) - cout << "Current Word: " << currentWord << endl; + if (currentWord[0] == '@' || currentWord[0] == '\\') { + // it is doxygen command + currentWord = currentWord.substr(1, currentWord.length() - 1); + m_tokenList.push_back(Token(COMMAND, currentWord)); - if (currentWord[0] == '@' || currentWord[0] == '\\'){ - // it is doxygen command - currentWord = currentWord.substr(1, currentWord.length()-1); - m_tokenList.push_back(Token(COMMAND, currentWord)); + } else if (currentWord[0] == '\n') { - } else if (currentWord[0] == '\n'){ + m_tokenList.push_back(Token(END_LINE, currentWord)); - m_tokenList.push_back(Token(END_LINE, currentWord)); - - } - else if (currentWord[0] == '*' || currentWord[0] == '/' ||currentWord[0] == '!'){ - - bool isPlainString = false; + } else if (currentWord[0] == '*' || currentWord[0] == '/' || currentWord[0] == '!') { - if (currentWord.length() > 1) { + bool isPlainString = false; - for(size_t i = 1; i < currentWord.length(); i++){ - if (currentWord[i] != '*' && currentWord[i] != '/' && - currentWord[i] != '!') { - isPlainString = true; - break; - } - } - } - - if(isPlainString) - m_tokenList.push_back(Token(PLAINSTRING, currentWord)); + if (currentWord.length() > 1) { - } else if (!currentWord.empty()) { - m_tokenList.push_back(Token(PLAINSTRING, currentWord)); - } - currentIndex = nextIndex; - } + for (size_t i = 1; i < currentWord.length(); i++) { + if (currentWord[i] != '*' && currentWord[i] != '/' && currentWord[i] != '!') { + isPlainString = true; + break; + } + } } - m_tokenListIter = m_tokenList.begin(); + if (isPlainString) + m_tokenList.push_back(Token(PLAINSTRING, currentWord)); + + } else if (!currentWord.empty()) { + m_tokenList.push_back(Token(PLAINSTRING, currentWord)); + } + currentIndex = nextIndex; + } + } + + m_tokenListIter = m_tokenList.begin(); } -TokenList:: ~TokenList(){ +TokenList::~TokenList() { } -Token TokenList::peek(){ - if(m_tokenListIter!= m_tokenList.end()){ - Token returnedToken = (*m_tokenListIter); - return returnedToken; - } - else - return Token(0, ""); -} - - -Token TokenList::next(){ - if(m_tokenListIter != m_tokenList.end()){ - Token returnedToken = (*m_tokenListIter); - m_tokenListIter++; - return (returnedToken); - } - else - return Token(0, ""); -} - - -list::iterator TokenList::end(){ - return m_tokenList.end(); +Token TokenList::peek() { + if (m_tokenListIter != m_tokenList.end()) { + Token returnedToken = (*m_tokenListIter); + return returnedToken; + } else + return Token(0, ""); } -list::iterator TokenList::current(){ +Token TokenList::next() { + if (m_tokenListIter != m_tokenList.end()) { + Token returnedToken = (*m_tokenListIter); + m_tokenListIter++; + return (returnedToken); + } else + return Token(0, ""); +} + + +list < Token >::iterator TokenList::end() { + return m_tokenList.end(); +} + + +list < Token >::iterator TokenList::current() { return m_tokenListIter; } -list::iterator TokenList::iteratorCopy(){ +list < Token >::iterator TokenList::iteratorCopy() { return m_tokenListIter; } -void TokenList::setIterator(list::iterator newPosition){ +void TokenList::setIterator(list < Token >::iterator newPosition) { m_tokenListIter = newPosition; } -void TokenList::printList(){ - list::iterator p = m_tokenList.begin(); - int i = 1; - int b = 0; - while (p != m_tokenList.end()){ - cout << (*p).toString() << " "; - b = i%TOKENSPERLINE; - if (b == 0) cout << endl; - p++; i++; - } +void TokenList::printList() { + list < Token >::iterator p = m_tokenList.begin(); + int i = 1; + int b = 0; + while (p != m_tokenList.end()) { + cout << (*p).toString() << " "; + b = i % TOKENSPERLINE; + if (b == 0) + cout << endl; + p++; + i++; + } } - diff --git a/Source/DoxygenTranslator/src/TokenList.h b/Source/DoxygenTranslator/src/TokenList.h index 0f5710e0f..841d66e1a 100644 --- a/Source/DoxygenTranslator/src/TokenList.h +++ b/Source/DoxygenTranslator/src/TokenList.h @@ -10,25 +10,25 @@ * that can be derived from a formatted doxygen string */ -class TokenList{ +class TokenList { private: - std::list m_tokenList; - std::list::iterator m_tokenListIter; + std::list < Token > m_tokenList; + std::list < Token >::iterator m_tokenListIter; public: - TokenList(const std::string &doxygenString); /* constructor takes a blob of Doxygen comment */ - ~TokenList(); + TokenList(const std::string & doxygenString); /* constructor takes a blob of Doxygen comment */ + ~TokenList(); - Token peek(); /* returns next token without advancing */ - Token next(); /* returns next token and advances */ + Token peek(); /* returns next token without advancing */ + Token next(); /* returns next token and advances */ - std::list::iterator end(); /* returns an end iterator */ - std::list::iterator current(); /* returns the current iterator */ + std::list < Token >::iterator end(); /* returns an end iterator */ + std::list < Token >::iterator current(); /* returns the current iterator */ - std::list::iterator iteratorCopy(); /* returns a copy of the current iterator */ - void setIterator(list::iterator newPosition); /*moves up the iterator*/ + std::list < Token >::iterator iteratorCopy(); /* returns a copy of the current iterator */ + void setIterator(list < Token >::iterator newPosition); /*moves up the iterator */ - void printList(); /* prints out the sequence of tokens */ + void printList(); /* prints out the sequence of tokens */ }; -#endif /*TOKENLIST_H_*/ +#endif From 06269a50a5a1af69f856c41d0eecdb9e167f0bbe Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Sun, 1 Nov 2009 22:05:01 +0000 Subject: [PATCH 041/314] Apply modified patch 2879724 from Marko Klopcic git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2008-cherylfoil@11716 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Source/DoxygenTranslator/src/PyDocConverter.cpp | 12 +++++++++++- Source/Modules/java.cxx | 4 ++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/Source/DoxygenTranslator/src/PyDocConverter.cpp b/Source/DoxygenTranslator/src/PyDocConverter.cpp index 44dec4cbf..cbe81571b 100644 --- a/Source/DoxygenTranslator/src/PyDocConverter.cpp +++ b/Source/DoxygenTranslator/src/PyDocConverter.cpp @@ -19,6 +19,13 @@ PyDocConverter::PyDocConverter() { } std::string PyDocConverter::formatParam(Node *n, DoxygenEntity & doxygenEntity) { + + if (doxygenEntity.entityList.size() < 2) { + /* if 'paramDescriptionEntity' is not there, ignore param. Better than crash! + TODO: log error! */ + return ""; + } + ParmList *plist = CopyParmList(Getattr(n, "parms")); Parm *p = NULL; @@ -34,7 +41,10 @@ std::string PyDocConverter::formatParam(Node *n, DoxygenEntity & doxygenEntity) std::string type = Char(Swig_name_make(n, 0, Getattr(p, "type"), 0, 0)); result = name + " (" + type + ") "; - result.resize(DOC_PARAM_STRING_LENGTH - 3, ' '); + if (result.size() < (DOC_PARAM_STRING_LENGTH - 3)) { + /* do not cut info away - it is better to have not so nice output than type information missing. */ + result.resize(DOC_PARAM_STRING_LENGTH - 3, ' '); + } result += "-- " + paramDescription.substr(DOC_PARAM_STRING_LENGTH); break; } diff --git a/Source/Modules/java.cxx b/Source/Modules/java.cxx index 532dfd305..0c5ad5401 100644 --- a/Source/Modules/java.cxx +++ b/Source/Modules/java.cxx @@ -2533,10 +2533,10 @@ public: // translate and write javadoc comment if flagged if (doxygen_javadoc_flag){ String *doxygen_comments; - if(DoxygenTranslator::getDocumentation(n, JavaDoc, doxygen_comments)){ + if(DoxygenTranslator::getDocumentation(n, JavaDoc, doxygen_comments)) { if(comment_creation_chatter) Printf(function_code, "/* This was generated from moduleClassFunctionHandler() */"); - Printf(function_code, Char(doxygen_comments)); + Printv(function_code, doxygen_comments, NIL); Delete(doxygen_comments); } } From 2b1f0a14bcc9649be42f34cd7812ab09c6963f0b Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Fri, 5 Mar 2010 23:43:39 +0000 Subject: [PATCH 042/314] merge revisions 11872:11876 from trunk to gsoc2008-cherylfoil branch - license changes git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2008-cherylfoil@11900 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- ANNOUNCE | 12 +- COPYRIGHT | 63 + Doc/Manual/Sections.html | 2 +- Examples/GIFPlot/Chicken/check.list | 3 - Examples/GIFPlot/Chicken/full/Makefile | 28 - Examples/GIFPlot/Chicken/full/README | 6 - Examples/GIFPlot/Chicken/full/cmap | Bin 768 -> 0 bytes Examples/GIFPlot/Chicken/full/gifplot.i | 26 - .../GIFPlot/Chicken/full/test-gifplot.scm | 66 - Examples/GIFPlot/Chicken/simple/Makefile | 28 - Examples/GIFPlot/Chicken/simple/README | 5 - Examples/GIFPlot/Chicken/simple/simple.i | 34 - .../GIFPlot/Chicken/simple/test-simple.scm | 29 - Examples/GIFPlot/Common-Lisp/full/cmap | Bin 768 -> 0 bytes Examples/GIFPlot/Common-Lisp/full/gifplot.i | 21 - Examples/GIFPlot/Common-Lisp/full/runme.lisp | 59 - Examples/GIFPlot/Guile/check.list | 3 - Examples/GIFPlot/Guile/full/Makefile | 28 - Examples/GIFPlot/Guile/full/README | 8 - Examples/GIFPlot/Guile/full/cmap | Bin 768 -> 0 bytes Examples/GIFPlot/Guile/full/gifplot.i | 21 - Examples/GIFPlot/Guile/full/runme.scm | 66 - Examples/GIFPlot/Guile/simple/Makefile | 28 - Examples/GIFPlot/Guile/simple/README | 11 - Examples/GIFPlot/Guile/simple/runme.scm | 30 - Examples/GIFPlot/Guile/simple/simple.i | 34 - Examples/GIFPlot/Include/gifplot.h | 333 --- Examples/GIFPlot/Interface/gifplot.i | 264 -- Examples/GIFPlot/Java/check.list | 4 - Examples/GIFPlot/Java/full/Makefile | 20 - Examples/GIFPlot/Java/full/README | 8 - Examples/GIFPlot/Java/full/cmap | Bin 768 -> 0 bytes Examples/GIFPlot/Java/full/gifplot.i | 15 - Examples/GIFPlot/Java/full/main.java | 75 - Examples/GIFPlot/Java/shadow/Makefile | 20 - Examples/GIFPlot/Java/shadow/README | 5 - Examples/GIFPlot/Java/shadow/cmap | Bin 768 -> 0 bytes Examples/GIFPlot/Java/shadow/main.java | 76 - Examples/GIFPlot/Java/simple/Makefile | 21 - Examples/GIFPlot/Java/simple/README | 5 - Examples/GIFPlot/Java/simple/main.java | 41 - Examples/GIFPlot/Java/simple/simple.i | 38 - Examples/GIFPlot/Lib/Makefile.in | 22 - Examples/GIFPlot/Lib/color.c | 140 -- Examples/GIFPlot/Lib/font.c | 705 ------ Examples/GIFPlot/Lib/frame.c | 924 ------- Examples/GIFPlot/Lib/gif.c | 668 ----- Examples/GIFPlot/Lib/matrix.c | 343 --- Examples/GIFPlot/Lib/pixmap.c | 159 -- Examples/GIFPlot/Lib/plot2d.c | 445 ---- Examples/GIFPlot/Lib/plot3d.c | 2181 ----------------- Examples/GIFPlot/Makefile.in | 23 - Examples/GIFPlot/Ocaml/check.list | 3 - Examples/GIFPlot/Ocaml/full/Makefile | 33 - Examples/GIFPlot/Ocaml/full/README | 8 - Examples/GIFPlot/Ocaml/full/cmap | Bin 768 -> 0 bytes Examples/GIFPlot/Ocaml/full/gifplot.i | 15 - Examples/GIFPlot/Ocaml/full/runme.ml | 87 - Examples/GIFPlot/Ocaml/simple/Makefile | 33 - Examples/GIFPlot/Ocaml/simple/cmap | Bin 768 -> 0 bytes Examples/GIFPlot/Ocaml/simple/runme.ml | 35 - Examples/GIFPlot/Ocaml/simple/simple.i | 33 - Examples/GIFPlot/Perl5/check.list | 4 - Examples/GIFPlot/Perl5/full/Makefile | 24 - Examples/GIFPlot/Perl5/full/README | 8 - Examples/GIFPlot/Perl5/full/cmap | Bin 768 -> 0 bytes Examples/GIFPlot/Perl5/full/gifplot.i | 15 - Examples/GIFPlot/Perl5/full/runme.pl | 68 - Examples/GIFPlot/Perl5/shadow/Makefile | 24 - Examples/GIFPlot/Perl5/shadow/README | 2 - Examples/GIFPlot/Perl5/shadow/cmap | Bin 768 -> 0 bytes Examples/GIFPlot/Perl5/shadow/runme.pl | 68 - Examples/GIFPlot/Perl5/simple/Makefile | 24 - Examples/GIFPlot/Perl5/simple/README | 5 - Examples/GIFPlot/Perl5/simple/runme.pl | 28 - Examples/GIFPlot/Perl5/simple/simple.i | 38 - Examples/GIFPlot/Php4/check.list | 3 - Examples/GIFPlot/Php4/full/Makefile | 20 - Examples/GIFPlot/Php4/full/README | 4 - Examples/GIFPlot/Php4/full/cmap | Bin 768 -> 0 bytes Examples/GIFPlot/Php4/full/gifplot.i | 15 - Examples/GIFPlot/Php4/full/runme.php4 | 78 - Examples/GIFPlot/Php4/shadow/Makefile | 19 - Examples/GIFPlot/Php4/shadow/README | 2 - Examples/GIFPlot/Php4/shadow/cmap | Bin 768 -> 0 bytes Examples/GIFPlot/Php4/shadow/runme.php4 | 79 - Examples/GIFPlot/Php4/simple/Makefile | 20 - Examples/GIFPlot/Php4/simple/README | 5 - Examples/GIFPlot/Php4/simple/runme.php4 | 32 - Examples/GIFPlot/Php4/simple/simple.i | 38 - Examples/GIFPlot/Pike/check.list | 2 - Examples/GIFPlot/Pike/simple/Makefile | 24 - Examples/GIFPlot/Pike/simple/README | 5 - Examples/GIFPlot/Pike/simple/runme.pike | 30 - Examples/GIFPlot/Pike/simple/simple.i | 38 - Examples/GIFPlot/Python/check.list | 4 - Examples/GIFPlot/Python/full/Makefile | 26 - Examples/GIFPlot/Python/full/README | 8 - Examples/GIFPlot/Python/full/cmap | Bin 768 -> 0 bytes Examples/GIFPlot/Python/full/gifplot.i | 15 - Examples/GIFPlot/Python/full/runme.py | 64 - Examples/GIFPlot/Python/shadow/Makefile | 26 - Examples/GIFPlot/Python/shadow/README | 8 - Examples/GIFPlot/Python/shadow/cmap | Bin 768 -> 0 bytes Examples/GIFPlot/Python/shadow/runme.py | 62 - Examples/GIFPlot/Python/simple/Makefile | 26 - Examples/GIFPlot/Python/simple/README | 5 - Examples/GIFPlot/Python/simple/runme.py | 27 - Examples/GIFPlot/Python/simple/simple.i | 38 - Examples/GIFPlot/README | 59 - Examples/GIFPlot/Ruby/check.list | 4 - Examples/GIFPlot/Ruby/full/Makefile | 24 - Examples/GIFPlot/Ruby/full/README | 8 - Examples/GIFPlot/Ruby/full/cmap | Bin 768 -> 0 bytes Examples/GIFPlot/Ruby/full/gifplot.i | 15 - Examples/GIFPlot/Ruby/full/runme.rb | 66 - Examples/GIFPlot/Ruby/shadow/Makefile | 24 - Examples/GIFPlot/Ruby/shadow/README | 5 - Examples/GIFPlot/Ruby/shadow/cmap | Bin 768 -> 0 bytes Examples/GIFPlot/Ruby/shadow/runme.rb | 66 - Examples/GIFPlot/Ruby/simple/Makefile | 24 - Examples/GIFPlot/Ruby/simple/README | 5 - Examples/GIFPlot/Ruby/simple/runme.rb | 27 - Examples/GIFPlot/Ruby/simple/simple.i | 38 - Examples/GIFPlot/Tcl/check.list | 4 - Examples/GIFPlot/Tcl/full/Makefile | 24 - Examples/GIFPlot/Tcl/full/README | 8 - Examples/GIFPlot/Tcl/full/cmap | Bin 768 -> 0 bytes Examples/GIFPlot/Tcl/full/gifplot.i | 15 - Examples/GIFPlot/Tcl/full/runme.tcl | 67 - Examples/GIFPlot/Tcl/mandel/Makefile | 24 - Examples/GIFPlot/Tcl/mandel/README | 6 - Examples/GIFPlot/Tcl/mandel/cmap | Bin 768 -> 0 bytes Examples/GIFPlot/Tcl/mandel/display.tcl | 68 - Examples/GIFPlot/Tcl/mandel/mandel.i | 47 - Examples/GIFPlot/Tcl/mandel/mandel.tcl | 170 -- Examples/GIFPlot/Tcl/simple/Makefile | 24 - Examples/GIFPlot/Tcl/simple/README | 5 - Examples/GIFPlot/Tcl/simple/runme.tcl | 27 - Examples/GIFPlot/Tcl/simple/simple.i | 38 - Examples/chicken/zlib/Makefile | 28 - Examples/chicken/zlib/README.html | 1666 ------------- Examples/chicken/zlib/example.i | 76 - Examples/chicken/zlib/test-zlib.scm | 41 - Examples/guile/check.list | 1 - Examples/lua/lua.c | 1 - Examples/test-suite/li_std_set.i | 22 +- Examples/xml/example_gif.i | 329 --- LICENSE | 109 +- LICENSE-GPL | 674 +++++ LICENSE-UNIVERSITIES | 95 + Lib/allegrocl/allegrocl.swg | 2 - Lib/allegrocl/longlongs.i | 3 - Lib/allegrocl/std_list.i | 3 - Lib/allegrocl/std_string.i | 3 - Lib/attribute.i | 3 - Lib/carrays.i | 3 - Lib/cdata.i | 3 - Lib/chicken/chicken.swg | 3 - Lib/chicken/chickenrun.swg | 4 - Lib/chicken/multi-generic.scm | 2 +- Lib/chicken/std_string.i | 3 - Lib/chicken/typemaps.i | 3 - Lib/clisp/clisp.swg | 3 - Lib/cmalloc.i | 3 - Lib/constraints.i | 3 - Lib/cpointer.i | 3 - Lib/csharp/csharp.swg | 3 - Lib/csharp/csharphead.swg | 3 - Lib/csharp/director.swg | 3 - Lib/csharp/enums.swg | 3 - Lib/csharp/enumsimple.swg | 3 - Lib/csharp/enumtypesafe.swg | 3 - Lib/csharp/std_except.i | 3 - Lib/csharp/std_map.i | 3 - Lib/csharp/std_pair.i | 3 - Lib/csharp/std_string.i | 3 - Lib/csharp/std_vector.i | 3 - Lib/csharp/std_wstring.i | 3 - Lib/csharp/stl.i | 3 - Lib/csharp/typemaps.i | 3 - Lib/csharp/wchar.i | 3 - Lib/cstring.i | 3 - Lib/cwstring.i | 3 - Lib/exception.i | 3 - Lib/gcj/cni.swg | 3 - Lib/guile/common.scm | 6 - Lib/guile/cplusplus.i | 3 - Lib/guile/guile.i | 3 - Lib/guile/guile_gh.swg | 3 - Lib/guile/guile_gh_run.swg | 3 - Lib/guile/guile_scm.swg | 3 - Lib/guile/guile_scm_run.swg | 3 - Lib/guile/guilemain.i | 3 - Lib/guile/interpreter.i | 3 - Lib/guile/list-vector.i | 3 - Lib/guile/pointer-in-out.i | 3 - Lib/guile/ports.i | 3 - Lib/guile/std_common.i | 3 - Lib/guile/std_map.i | 3 - Lib/guile/std_pair.i | 3 - Lib/guile/std_string.i | 3 - Lib/guile/std_vector.i | 3 - Lib/guile/stl.i | 3 - Lib/guile/typemaps.i | 3 - Lib/inttypes.i | 3 - Lib/java/arrays_java.i | 3 - Lib/java/director.swg | 3 - Lib/java/enums.swg | 3 - Lib/java/enumsimple.swg | 3 - Lib/java/enumtypesafe.swg | 3 - Lib/java/enumtypeunsafe.swg | 3 - Lib/java/java.swg | 3 - Lib/java/javahead.swg | 3 - Lib/java/std_except.i | 3 - Lib/java/std_map.i | 3 - Lib/java/std_pair.i | 3 - Lib/java/std_string.i | 3 - Lib/java/std_vector.i | 3 - Lib/java/std_wstring.i | 3 - Lib/java/stl.i | 3 - Lib/java/typemaps.i | 3 - Lib/java/various.i | 3 - Lib/lua/_std_common.i | 3 - Lib/lua/lua.swg | 3 - Lib/lua/lua_fnptr.i | 3 - Lib/lua/luarun.swg | 3 - Lib/lua/luaruntime.swg | 3 - Lib/lua/luatypemaps.swg | 3 - Lib/lua/std_except.i | 3 - Lib/lua/std_map.i | 3 - Lib/lua/std_pair.i | 3 - Lib/lua/std_string.i | 3 - Lib/lua/std_vector.i | 3 - Lib/lua/stl.i | 3 - Lib/lua/typemaps.i | 3 - Lib/lua/wchar.i | 6 +- Lib/math.i | 3 - Lib/modula3/modula3.swg | 3 - Lib/modula3/modula3head.swg | 3 - Lib/modula3/typemaps.i | 3 - Lib/mzscheme/mzrun.swg | 3 - Lib/mzscheme/mzscheme.swg | 3 - Lib/mzscheme/std_common.i | 3 - Lib/mzscheme/std_map.i | 3 - Lib/mzscheme/std_pair.i | 3 - Lib/mzscheme/std_string.i | 3 - Lib/mzscheme/std_vector.i | 3 - Lib/mzscheme/stl.i | 3 - Lib/mzscheme/typemaps.i | 3 - Lib/ocaml/cstring.i | 3 - Lib/ocaml/director.swg | 3 - Lib/ocaml/ocaml.i | 3 - Lib/ocaml/ocamldec.swg | 3 - Lib/ocaml/std_common.i | 3 - Lib/ocaml/std_deque.i | 3 - Lib/ocaml/std_list.i | 3 - Lib/ocaml/std_map.i | 3 - Lib/ocaml/std_pair.i | 3 - Lib/ocaml/std_string.i | 3 - Lib/ocaml/std_vector.i | 3 - Lib/ocaml/stl.i | 3 - Lib/ocaml/typecheck.i | 3 - Lib/ocaml/typemaps.i | 3 - Lib/octave/octcontainer.swg | 3 - Lib/octave/octiterators.swg | 3 - Lib/perl5/perlmain.i | 3 - Lib/perl5/reference.i | 3 - Lib/perl5/std_common.i | 3 - Lib/perl5/std_list.i | 3 - Lib/perl5/std_map.i | 3 - Lib/perl5/std_pair.i | 3 - Lib/perl5/std_vector.i | 3 - Lib/perl5/stl.i | 3 - Lib/perl5/typemaps.i | 3 - Lib/php/const.i | 3 - Lib/php/globalvar.i | 3 - Lib/php/php.swg | 3 - Lib/php/phpkw.swg | 3 - Lib/php/phprun.swg | 3 - Lib/php/std_common.i | 3 - Lib/php/std_map.i | 3 - Lib/php/std_pair.i | 3 - Lib/php/std_string.i | 3 - Lib/php/std_vector.i | 3 - Lib/php/stl.i | 3 - Lib/php/typemaps.i | 3 - Lib/pike/pike.swg | 3 - Lib/pike/pikerun.swg | 3 - Lib/pike/std_string.i | 3 - Lib/pointer.i | 3 - Lib/python/ccomplex.i | 3 - Lib/python/director.swg | 3 - Lib/python/embed15.i | 3 - Lib/python/file.i | 4 - Lib/python/pycontainer.swg | 3 - Lib/python/pyiterators.swg | 3 - Lib/python/pyrun.swg | 3 - Lib/python/typemaps.i | 3 - Lib/ruby/director.swg | 3 - Lib/ruby/rubyautodoc.swg | 15 +- Lib/ruby/rubycontainer.swg | 3 - Lib/ruby/rubycontainer_extended.swg | 24 +- Lib/ruby/rubyiterators.swg | 3 - Lib/ruby/rubyprimtypes.swg | 4 - Lib/ruby/rubyrun.swg | 3 - Lib/ruby/rubystdautodoc.swg | 12 +- Lib/ruby/rubytracking.swg | 3 - Lib/ruby/rubywstrings.swg | 20 +- Lib/ruby/stl.i | 3 - Lib/ruby/typemaps.i | 3 - Lib/std/_std_deque.i | 3 - Lib/std_except.i | 3 - Lib/stdint.i | 3 - Lib/stl.i | 3 - Lib/swigarch.i | 3 - Lib/swigrun.i | 3 - Lib/tcl/mactclinit.c | 93 - Lib/tcl/mactkinit.c | 3 - Lib/tcl/std_common.i | 3 - Lib/tcl/std_pair.i | 3 - Lib/tcl/std_vector.i | 3 - Lib/tcl/stl.i | 3 - Lib/tcl/tcl8.swg | 3 - Lib/tcl/tclinterp.i | 3 - Lib/tcl/tclopers.swg | 3 - Lib/tcl/tclresult.i | 3 - Lib/tcl/tclrun.swg | 3 - Lib/tcl/tclsh.i | 3 - Lib/tcl/tclwstrings.swg | 3 - Lib/tcl/typemaps.i | 3 - Lib/tcl/wish.i | 3 - Lib/typemaps/attribute.swg | 3 - Lib/typemaps/carrays.swg | 3 - Lib/typemaps/cdata.swg | 3 - Lib/typemaps/cmalloc.swg | 3 - Lib/typemaps/cpointer.swg | 3 - Lib/typemaps/cstrings.swg | 3 - Lib/typemaps/exception.swg | 3 - Lib/typemaps/ptrtypes.swg | 3 - Lib/typemaps/swigtypemaps.swg | 3 - Lib/typemaps/typemaps.swg | 3 - Lib/uffi/uffi.swg | 2 - Lib/wchar.i | 3 - Lib/windows.i | 3 - Makefile.in | 56 +- README | 57 +- Source/CParse/cparse.h | 8 +- Source/CParse/cscanner.c | 8 +- Source/CParse/parser.y | 8 +- Source/CParse/templ.c | 8 +- Source/CParse/util.c | 8 +- Source/DOH/base.c | 12 +- Source/DOH/doh.h | 14 +- Source/DOH/dohint.h | 15 +- Source/DOH/file.c | 12 +- Source/DOH/fio.c | 12 +- Source/DOH/hash.c | 12 +- Source/DOH/list.c | 12 +- Source/DOH/memory.c | 12 +- Source/DOH/string.c | 12 +- Source/DOH/void.c | 12 +- Source/Include/swigwarn.h | 10 +- Source/Modules/allegrocl.cxx | 8 +- Source/Modules/allocate.cxx | 8 +- Source/Modules/browser.cxx | 8 +- Source/Modules/cffi.cxx | 8 +- Source/Modules/chicken.cxx | 8 +- Source/Modules/clisp.cxx | 8 +- Source/Modules/contract.cxx | 8 +- Source/Modules/csharp.cxx | 8 +- Source/Modules/directors.cxx | 8 +- Source/Modules/emit.cxx | 8 +- Source/Modules/guile.cxx | 8 +- Source/Modules/java.cxx | 8 +- Source/Modules/lang.cxx | 8 +- Source/Modules/lua.cxx | 8 +- Source/Modules/main.cxx | 8 +- Source/Modules/modula3.cxx | 8 +- Source/Modules/module.cxx | 8 +- Source/Modules/mzscheme.cxx | 8 +- Source/Modules/ocaml.cxx | 8 +- Source/Modules/octave.cxx | 8 +- Source/Modules/overload.cxx | 8 +- Source/Modules/perl5.cxx | 12 +- Source/Modules/php.cxx | 8 +- Source/Modules/pike.cxx | 8 +- Source/Modules/python.cxx | 8 +- Source/Modules/r.cxx | 8 +- Source/Modules/ruby.cxx | 8 +- Source/Modules/s-exp.cxx | 8 +- Source/Modules/swigmain.cxx | 12 +- Source/Modules/swigmod.h | 8 +- Source/Modules/tcl8.cxx | 8 +- Source/Modules/typepass.cxx | 8 +- Source/Modules/uffi.cxx | 8 +- Source/Modules/utils.cxx | 8 +- Source/Modules/xml.cxx | 8 +- Source/Preprocessor/cpp.c | 8 +- Source/Preprocessor/expr.c | 8 +- Source/Preprocessor/preprocessor.h | 8 +- Source/Swig/cwrap.c | 8 +- Source/Swig/deprecate.c | 8 +- Source/Swig/error.c | 8 +- Source/Swig/fragment.c | 8 +- Source/Swig/getopt.c | 8 +- Source/Swig/include.c | 8 +- Source/Swig/misc.c | 8 +- Source/Swig/naming.c | 8 +- Source/Swig/parms.c | 8 +- Source/Swig/scanner.c | 8 +- Source/Swig/stype.c | 8 +- Source/Swig/swig.h | 8 +- Source/Swig/swigfile.h | 8 +- Source/Swig/swigopt.h | 8 +- Source/Swig/swigparm.h | 8 +- Source/Swig/swigscan.h | 8 +- Source/Swig/swigtree.h | 8 +- Source/Swig/swigwrap.h | 8 +- Source/Swig/symbol.c | 8 +- Source/Swig/tree.c | 8 +- Source/Swig/typemap.c | 8 +- Source/Swig/typeobj.c | 8 +- Source/Swig/typesys.c | 8 +- Source/Swig/wrapfunc.c | 8 +- configure.in | 4 +- 426 files changed, 1379 insertions(+), 12512 deletions(-) create mode 100644 COPYRIGHT delete mode 100644 Examples/GIFPlot/Chicken/check.list delete mode 100644 Examples/GIFPlot/Chicken/full/Makefile delete mode 100644 Examples/GIFPlot/Chicken/full/README delete mode 100644 Examples/GIFPlot/Chicken/full/cmap delete mode 100644 Examples/GIFPlot/Chicken/full/gifplot.i delete mode 100644 Examples/GIFPlot/Chicken/full/test-gifplot.scm delete mode 100644 Examples/GIFPlot/Chicken/simple/Makefile delete mode 100644 Examples/GIFPlot/Chicken/simple/README delete mode 100644 Examples/GIFPlot/Chicken/simple/simple.i delete mode 100644 Examples/GIFPlot/Chicken/simple/test-simple.scm delete mode 100644 Examples/GIFPlot/Common-Lisp/full/cmap delete mode 100644 Examples/GIFPlot/Common-Lisp/full/gifplot.i delete mode 100644 Examples/GIFPlot/Common-Lisp/full/runme.lisp delete mode 100644 Examples/GIFPlot/Guile/check.list delete mode 100644 Examples/GIFPlot/Guile/full/Makefile delete mode 100644 Examples/GIFPlot/Guile/full/README delete mode 100644 Examples/GIFPlot/Guile/full/cmap delete mode 100644 Examples/GIFPlot/Guile/full/gifplot.i delete mode 100644 Examples/GIFPlot/Guile/full/runme.scm delete mode 100644 Examples/GIFPlot/Guile/simple/Makefile delete mode 100644 Examples/GIFPlot/Guile/simple/README delete mode 100644 Examples/GIFPlot/Guile/simple/runme.scm delete mode 100644 Examples/GIFPlot/Guile/simple/simple.i delete mode 100644 Examples/GIFPlot/Include/gifplot.h delete mode 100644 Examples/GIFPlot/Interface/gifplot.i delete mode 100644 Examples/GIFPlot/Java/check.list delete mode 100644 Examples/GIFPlot/Java/full/Makefile delete mode 100644 Examples/GIFPlot/Java/full/README delete mode 100644 Examples/GIFPlot/Java/full/cmap delete mode 100644 Examples/GIFPlot/Java/full/gifplot.i delete mode 100644 Examples/GIFPlot/Java/full/main.java delete mode 100644 Examples/GIFPlot/Java/shadow/Makefile delete mode 100644 Examples/GIFPlot/Java/shadow/README delete mode 100644 Examples/GIFPlot/Java/shadow/cmap delete mode 100644 Examples/GIFPlot/Java/shadow/main.java delete mode 100644 Examples/GIFPlot/Java/simple/Makefile delete mode 100644 Examples/GIFPlot/Java/simple/README delete mode 100644 Examples/GIFPlot/Java/simple/main.java delete mode 100644 Examples/GIFPlot/Java/simple/simple.i delete mode 100644 Examples/GIFPlot/Lib/Makefile.in delete mode 100644 Examples/GIFPlot/Lib/color.c delete mode 100644 Examples/GIFPlot/Lib/font.c delete mode 100644 Examples/GIFPlot/Lib/frame.c delete mode 100644 Examples/GIFPlot/Lib/gif.c delete mode 100644 Examples/GIFPlot/Lib/matrix.c delete mode 100644 Examples/GIFPlot/Lib/pixmap.c delete mode 100644 Examples/GIFPlot/Lib/plot2d.c delete mode 100644 Examples/GIFPlot/Lib/plot3d.c delete mode 100644 Examples/GIFPlot/Makefile.in delete mode 100644 Examples/GIFPlot/Ocaml/check.list delete mode 100644 Examples/GIFPlot/Ocaml/full/Makefile delete mode 100644 Examples/GIFPlot/Ocaml/full/README delete mode 100644 Examples/GIFPlot/Ocaml/full/cmap delete mode 100644 Examples/GIFPlot/Ocaml/full/gifplot.i delete mode 100644 Examples/GIFPlot/Ocaml/full/runme.ml delete mode 100644 Examples/GIFPlot/Ocaml/simple/Makefile delete mode 100644 Examples/GIFPlot/Ocaml/simple/cmap delete mode 100644 Examples/GIFPlot/Ocaml/simple/runme.ml delete mode 100644 Examples/GIFPlot/Ocaml/simple/simple.i delete mode 100644 Examples/GIFPlot/Perl5/check.list delete mode 100644 Examples/GIFPlot/Perl5/full/Makefile delete mode 100644 Examples/GIFPlot/Perl5/full/README delete mode 100644 Examples/GIFPlot/Perl5/full/cmap delete mode 100644 Examples/GIFPlot/Perl5/full/gifplot.i delete mode 100644 Examples/GIFPlot/Perl5/full/runme.pl delete mode 100644 Examples/GIFPlot/Perl5/shadow/Makefile delete mode 100644 Examples/GIFPlot/Perl5/shadow/README delete mode 100644 Examples/GIFPlot/Perl5/shadow/cmap delete mode 100644 Examples/GIFPlot/Perl5/shadow/runme.pl delete mode 100644 Examples/GIFPlot/Perl5/simple/Makefile delete mode 100644 Examples/GIFPlot/Perl5/simple/README delete mode 100644 Examples/GIFPlot/Perl5/simple/runme.pl delete mode 100644 Examples/GIFPlot/Perl5/simple/simple.i delete mode 100644 Examples/GIFPlot/Php4/check.list delete mode 100644 Examples/GIFPlot/Php4/full/Makefile delete mode 100644 Examples/GIFPlot/Php4/full/README delete mode 100644 Examples/GIFPlot/Php4/full/cmap delete mode 100644 Examples/GIFPlot/Php4/full/gifplot.i delete mode 100644 Examples/GIFPlot/Php4/full/runme.php4 delete mode 100644 Examples/GIFPlot/Php4/shadow/Makefile delete mode 100644 Examples/GIFPlot/Php4/shadow/README delete mode 100644 Examples/GIFPlot/Php4/shadow/cmap delete mode 100644 Examples/GIFPlot/Php4/shadow/runme.php4 delete mode 100644 Examples/GIFPlot/Php4/simple/Makefile delete mode 100644 Examples/GIFPlot/Php4/simple/README delete mode 100644 Examples/GIFPlot/Php4/simple/runme.php4 delete mode 100644 Examples/GIFPlot/Php4/simple/simple.i delete mode 100644 Examples/GIFPlot/Pike/check.list delete mode 100644 Examples/GIFPlot/Pike/simple/Makefile delete mode 100644 Examples/GIFPlot/Pike/simple/README delete mode 100644 Examples/GIFPlot/Pike/simple/runme.pike delete mode 100644 Examples/GIFPlot/Pike/simple/simple.i delete mode 100644 Examples/GIFPlot/Python/check.list delete mode 100644 Examples/GIFPlot/Python/full/Makefile delete mode 100644 Examples/GIFPlot/Python/full/README delete mode 100644 Examples/GIFPlot/Python/full/cmap delete mode 100644 Examples/GIFPlot/Python/full/gifplot.i delete mode 100644 Examples/GIFPlot/Python/full/runme.py delete mode 100644 Examples/GIFPlot/Python/shadow/Makefile delete mode 100644 Examples/GIFPlot/Python/shadow/README delete mode 100644 Examples/GIFPlot/Python/shadow/cmap delete mode 100644 Examples/GIFPlot/Python/shadow/runme.py delete mode 100644 Examples/GIFPlot/Python/simple/Makefile delete mode 100644 Examples/GIFPlot/Python/simple/README delete mode 100644 Examples/GIFPlot/Python/simple/runme.py delete mode 100644 Examples/GIFPlot/Python/simple/simple.i delete mode 100644 Examples/GIFPlot/README delete mode 100644 Examples/GIFPlot/Ruby/check.list delete mode 100644 Examples/GIFPlot/Ruby/full/Makefile delete mode 100644 Examples/GIFPlot/Ruby/full/README delete mode 100644 Examples/GIFPlot/Ruby/full/cmap delete mode 100644 Examples/GIFPlot/Ruby/full/gifplot.i delete mode 100644 Examples/GIFPlot/Ruby/full/runme.rb delete mode 100644 Examples/GIFPlot/Ruby/shadow/Makefile delete mode 100644 Examples/GIFPlot/Ruby/shadow/README delete mode 100644 Examples/GIFPlot/Ruby/shadow/cmap delete mode 100644 Examples/GIFPlot/Ruby/shadow/runme.rb delete mode 100644 Examples/GIFPlot/Ruby/simple/Makefile delete mode 100644 Examples/GIFPlot/Ruby/simple/README delete mode 100644 Examples/GIFPlot/Ruby/simple/runme.rb delete mode 100644 Examples/GIFPlot/Ruby/simple/simple.i delete mode 100644 Examples/GIFPlot/Tcl/check.list delete mode 100644 Examples/GIFPlot/Tcl/full/Makefile delete mode 100644 Examples/GIFPlot/Tcl/full/README delete mode 100644 Examples/GIFPlot/Tcl/full/cmap delete mode 100644 Examples/GIFPlot/Tcl/full/gifplot.i delete mode 100644 Examples/GIFPlot/Tcl/full/runme.tcl delete mode 100644 Examples/GIFPlot/Tcl/mandel/Makefile delete mode 100644 Examples/GIFPlot/Tcl/mandel/README delete mode 100644 Examples/GIFPlot/Tcl/mandel/cmap delete mode 100644 Examples/GIFPlot/Tcl/mandel/display.tcl delete mode 100644 Examples/GIFPlot/Tcl/mandel/mandel.i delete mode 100644 Examples/GIFPlot/Tcl/mandel/mandel.tcl delete mode 100644 Examples/GIFPlot/Tcl/simple/Makefile delete mode 100644 Examples/GIFPlot/Tcl/simple/README delete mode 100644 Examples/GIFPlot/Tcl/simple/runme.tcl delete mode 100644 Examples/GIFPlot/Tcl/simple/simple.i delete mode 100644 Examples/chicken/zlib/Makefile delete mode 100644 Examples/chicken/zlib/README.html delete mode 100644 Examples/chicken/zlib/example.i delete mode 100644 Examples/chicken/zlib/test-zlib.scm delete mode 100644 Examples/xml/example_gif.i create mode 100644 LICENSE-GPL create mode 100644 LICENSE-UNIVERSITIES delete mode 100644 Lib/tcl/mactclinit.c diff --git a/ANNOUNCE b/ANNOUNCE index 7c0e95e3f..5f19da9c0 100644 --- a/ANNOUNCE +++ b/ANNOUNCE @@ -1,11 +1,11 @@ -*** ANNOUNCE: SWIG 1.3.36 (24 June 2008) *** +*** ANNOUNCE: SWIG 2.0.0 (in progress) *** http://www.swig.org -We're pleased to announce SWIG-1.3.36, the latest installment in the -SWIG development effort. SWIG-1.3.36 includes a number of bug fixes -and large number of enhancements throughout. +We're pleased to announce SWIG-2.0.0, the latest installment in the +SWIG development effort. SWIG-2.0.0 includes a number of bug fixes +and enhancements. What is SWIG? ------------- @@ -24,11 +24,11 @@ Availability: ------------- The release is available for download on Sourceforge at - http://prdownloads.sourceforge.net/swig/swig-1.3.36.tar.gz + http://prdownloads.sourceforge.net/swig/swig-2.0.0.tar.gz A Windows version is also available at - http://prdownloads.sourceforge.net/swig/swigwin-1.3.36.zip + http://prdownloads.sourceforge.net/swig/swigwin-2.0.0.zip Release numbers --------------- diff --git a/COPYRIGHT b/COPYRIGHT new file mode 100644 index 000000000..45f9d6b45 --- /dev/null +++ b/COPYRIGHT @@ -0,0 +1,63 @@ +SWIG Copyright and Authors +-------------------------- + +Copyright (c) 1995-2010 The SWIG Developers +Copyright (c) 2005-2006 Arizona Board of Regents (University of Arizona). +Copyright (c) 1998-2005 University of Chicago. +Copyright (c) 1995-1998 The University of Utah and the Regents of the University of California + +Portions also copyrighted by: + Network Applied Communication Laboratory, Inc + Information-technology Promotion Agency, Japan + +Active SWIG Developers: + William Fulton (wsf@fultondesigns.co.uk) (SWIG core, Java, C#, Windows, Cygwin) + Olly Betts (olly@survex.com) (PHP) + Joseph Wang (joequant@gmail.com) (R) + Xavier Delacour (xavier.delacour@gmail.com) (Octave) + +Past SWIG developers and major contributors include: + Dave Beazley (dave-swig@dabeaz.com) (SWIG core, Python, Tcl, Perl) + Henning Thielemann (swig@henning-thielemann.de) (Modula3) + Matthias Köppe (mkoeppe@mail.math.uni-magdeburg.de) (Guile, MzScheme) + Luigi Ballabio (luigi.ballabio@fastwebnet.it) (STL wrapping) + Mikel Bancroft (mikel@franz.com) (Allegro CL) + Surendra Singhi (efuzzyone@netscape.net) (CLISP, CFFI) + Marcelo Matus (mmatus@acms.arizona.edu) (SWIG core, Python, UTL[python,perl,tcl,ruby]) + Art Yerkes (ayerkes@speakeasy.net) (Ocaml) + Lyle Johnson (lyle@users.sourceforge.net) (Ruby) + Charlie Savage (cfis@interserv.com) (Ruby) + Thien-Thi Nguyen (ttn@glug.org) (build/test/misc) + Richard Palmer (richard@magicality.org) (PHP) + Sam Liddicott - Anonova Ltd (saml@liddicott.com) (PHP) + Tim Hockin - Sun Microsystems (thockin@sun.com) (PHP) + Kevin Ruland (PHP) + Shibukawa Yoshiki (Japanese Translation) + Jason Stewart (jason@openinformatics.com) (Perl5) + Loic Dachary (Perl5) + David Fletcher (Perl5) + Gary Holt (Perl5) + Masaki Fukushima (Ruby) + Scott Michel (scottm@cs.ucla.edu) (Java directors) + Tiger Feng (songyanf@cs.uchicago.edu) (SWIG core) + Mark Rose (mrose@stm.lbl.gov) (Directors) + Jonah Beckford (beckford@usermail.com) (CHICKEN) + Ahmon Dancy (dancy@franz.com) (Allegro CL) + Dirk Gerrits (Allegro CL) + Neil Cawse (C#) + Harco de Hilster (Java) + Alexey Dyachenko (dyachenko@fromru.com) (Tcl) + Bob Techentin (Tcl) + Martin Froehlich (Guile) + Marcio Luis Teixeira (Guile) + Duncan Temple Lang (R) + Miklos Vajna (PHP directors) + Mark Gossage (mark@gossage.cjb.net) (Lua) + Gonzalo Garramuno (ggarra@advancedsl.com.ar) (Ruby, Ruby's UTL) + John Lenz (Guile, MzScheme updates, Chicken module, runtime system) + +Past contributors include: + James Michael DuPont, Clark McGrew, Dustin Mitchell, Ian Cooke, Catalin Dumitrescu, Baran + Kovuk, Oleg Tolmatcev, Tal Shalif, Lluis Padro, Chris Seatory, Igor Bely, Robin Dunn + (See CHANGES and CHANGES.current for a more complete list). + diff --git a/Doc/Manual/Sections.html b/Doc/Manual/Sections.html index 5406f44ea..98f90bc1b 100644 --- a/Doc/Manual/Sections.html +++ b/Doc/Manual/Sections.html @@ -6,7 +6,7 @@

    SWIG-1.3 Development Documentation

    -Last update : SWIG-1.3.37 (in progress) +Last update : SWIG-2.0.0 (in progress)

    Sections

    diff --git a/Examples/GIFPlot/Chicken/check.list b/Examples/GIFPlot/Chicken/check.list deleted file mode 100644 index e75ee586a..000000000 --- a/Examples/GIFPlot/Chicken/check.list +++ /dev/null @@ -1,3 +0,0 @@ -# see top-level Makefile.in -full -simple diff --git a/Examples/GIFPlot/Chicken/full/Makefile b/Examples/GIFPlot/Chicken/full/Makefile deleted file mode 100644 index 2ae4fd7ea..000000000 --- a/Examples/GIFPlot/Chicken/full/Makefile +++ /dev/null @@ -1,28 +0,0 @@ -TOP = ../../.. -SWIG = $(TOP)/../preinst-swig -INTERFACE = gifplot.i -SRCS = -CXXSRCS = -TARGET = gifplot -INCLUDE = -I. -I../../Include -SWIGOPT = -I../../Include -CFLAGS = -VARIANT = -LIBS = -L../.. -lgifplot -lm - -# comment the following two lines to build a dynamic so file -CHICKEN_MAIN = test-gifplot.scm -VARIANT = _static - -all:: $(TARGET) - -$(TARGET): $(INTERFACE) $(SRCS) - $(MAKE) -f $(TOP)/Makefile \ - SRCS='$(SRCS)' CXXSRCS='$(CXXSRCS)' CHICKEN_MAIN='$(CHICKEN_MAIN)' \ - INCLUDE='$(INCLUDE)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' TARGET='$(TARGET)' \ - SWIG='$(SWIG)' INTERFACE='$(INTERFACE)' CHICKENOPTS='$(CHICKENOPTS)' chicken$(VARIANT) - -clean:: - $(MAKE) -f $(TOP)/Makefile chicken_clean - rm -f gifplot.scm image.gif - rm -f $(TARGET) diff --git a/Examples/GIFPlot/Chicken/full/README b/Examples/GIFPlot/Chicken/full/README deleted file mode 100644 index e5ddd7af1..000000000 --- a/Examples/GIFPlot/Chicken/full/README +++ /dev/null @@ -1,6 +0,0 @@ -This example runs the entire gifplot.h header file through SWIG without -any changes. The Scheme program 'test-gifplot.scm' does something a -little more interesting. You'll have to go look at the header file to -get a complete listing of the functions. - -`make' will build a static binary. Run ./gifplot to test it. diff --git a/Examples/GIFPlot/Chicken/full/cmap b/Examples/GIFPlot/Chicken/full/cmap deleted file mode 100644 index a20c331a9573dd8443380680bfe2cc428780d8a9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 768 zcmZQzpd(=A5)hSEP}Mdtvvzdz4h)M)OwTDSuW4%Uoiu&!q7`d5@7R0z#JS5i?>&C` z?#s{r^Z@9-XXO?YlTlLFHMX#G@$?UkN=VBFxv-;m^2~WlR;}N<`@pd?7q8!a^y1xT znmh34m-nxpKDd4D;+bOy_iW#^cE#d(Gbi_Tw$xXZ7G$R-M27|XxI5We80l&#%Snpx zbFrd(h8Vt}lCeu@T6xFJRlCpJeMef510DGC$^DyG&YwK8f9ICexact (round (max (min cc 239) 0))))) - (gifplot:Plot3D-solidquad p3 x y z1 (+ x dx) y z2 (+ x dx) (+ y dy) - z3 x (+ y dy) z4 - (gifplot:int->Pixel (+ c 16)))) - (y-loop (+ y dy) (+ j 1))))) - (x-loop (+ x dx) (+ i 1))))))) - -(display "Making a nice 3D plot...\n") -(drawsolid) - -(gifplot:FrameBuffer-writeGIF frame cmap "image.gif") -(display "Wrote image.gif\n") diff --git a/Examples/GIFPlot/Chicken/simple/Makefile b/Examples/GIFPlot/Chicken/simple/Makefile deleted file mode 100644 index 484e58390..000000000 --- a/Examples/GIFPlot/Chicken/simple/Makefile +++ /dev/null @@ -1,28 +0,0 @@ -TOP = ../../.. -SWIG = $(TOP)/../preinst-swig -INTERFACE = simple.i -SRCS = -CXXSRCS = -TARGET = simple -INCLUDE = -I. -I../../Include -SWIGOPT = -I../../Include -CFLAGS = -VARIANT = -LIBS = -L../.. -lgifplot -lm - -# comment the following two lines to build a dynamic so file -CHICKEN_MAIN = test-simple.scm -VARIANT = _static - -all:: $(TARGET) - -$(TARGET): $(INTERFACE) $(SRCS) - $(MAKE) -f $(TOP)/Makefile \ - SRCS='$(SRCS)' CXXSRCS='$(CXXSRCS)' CHICKEN_MAIN='$(CHICKEN_MAIN)' \ - INCLUDE='$(INCLUDE)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' TARGET='$(TARGET)' \ - SWIG='$(SWIG)' INTERFACE='$(INTERFACE)' CHICKENOPTS='$(CHICKENOPTS)' chicken$(VARIANT) - -clean:: - $(MAKE) -f $(TOP)/Makefile chicken_clean - rm -f simple.scm image.gif - rm -f $(TARGET) diff --git a/Examples/GIFPlot/Chicken/simple/README b/Examples/GIFPlot/Chicken/simple/README deleted file mode 100644 index 3b138f381..000000000 --- a/Examples/GIFPlot/Chicken/simple/README +++ /dev/null @@ -1,5 +0,0 @@ -This is a very minimalistic example in which just a few functions -and constants from library are wrapped and used to draw some simple -shapes. - -`make' will build an exe. Run ./simple to test it. diff --git a/Examples/GIFPlot/Chicken/simple/simple.i b/Examples/GIFPlot/Chicken/simple/simple.i deleted file mode 100644 index 23ac8a856..000000000 --- a/Examples/GIFPlot/Chicken/simple/simple.i +++ /dev/null @@ -1,34 +0,0 @@ -/* This example shows a very simple interface wrapping a few - primitive declarations */ - -%module simple -%{ -#include "gifplot.h" -%} - -typedef unsigned int Pixel; - -/* Here are a few useful functions */ - -ColorMap *new_ColorMap(char *filename = 0); -void delete_ColorMap(ColorMap *cmap); - -FrameBuffer *new_FrameBuffer(unsigned int width, unsigned int height); -void delete_FrameBuffer(FrameBuffer *frame); -void FrameBuffer_clear(FrameBuffer *frame, Pixel color); -void FrameBuffer_line(FrameBuffer *frame, int x1, int y1, int x2, int y2, Pixel color); -void FrameBuffer_box(FrameBuffer *frame, int x1, int y1, int x2, int y2, Pixel color); -void FrameBuffer_circle(FrameBuffer *frame, int x1, int y1, int radius, Pixel color); -int FrameBuffer_writeGIF(FrameBuffer *f, ColorMap *c, char *filename); - -/* And some useful constants, which we redefine (from gifplot.h) so - that SWIG sees them */ -#define BLACK 0 -#define WHITE 1 -#define RED 2 -#define GREEN 3 -#define BLUE 4 -#define YELLOW 5 -#define CYAN 6 -#define MAGENTA 7 - diff --git a/Examples/GIFPlot/Chicken/simple/test-simple.scm b/Examples/GIFPlot/Chicken/simple/test-simple.scm deleted file mode 100644 index 43250d8e9..000000000 --- a/Examples/GIFPlot/Chicken/simple/test-simple.scm +++ /dev/null @@ -1,29 +0,0 @@ -;;; Draw some simple shapes - -(declare (uses simple)) - -(display "Drawing some basic shapes\n") - -(define cmap (simple:new-ColorMap #f)) -(define f (simple:new-FrameBuffer 400 400)) - -;; Clear the picture -(simple:FrameBuffer-clear f (simple:BLACK)) - -;; Make a red box -(simple:FrameBuffer-box f 40 40 200 200 (simple:RED)) - -;; Make a blue circle -(simple:FrameBuffer-circle f 200 200 40 (simple:BLUE)) - -;; Make green line -(simple:FrameBuffer-line f 10 390 390 200 (simple:GREEN)) - -;; Write an image out to disk - -(simple:FrameBuffer-writeGIF f cmap "image.gif") -(display "Wrote image.gif\n") - -(simple:delete-FrameBuffer f) -(simple:delete-ColorMap cmap) - diff --git a/Examples/GIFPlot/Common-Lisp/full/cmap b/Examples/GIFPlot/Common-Lisp/full/cmap deleted file mode 100644 index a20c331a9573dd8443380680bfe2cc428780d8a9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 768 zcmZQzpd(=A5)hSEP}Mdtvvzdz4h)M)OwTDSuW4%Uoiu&!q7`d5@7R0z#JS5i?>&C` z?#s{r^Z@9-XXO?YlTlLFHMX#G@$?UkN=VBFxv-;m^2~WlR;}N<`@pd?7q8!a^y1xT znmh34m-nxpKDd4D;+bOy_iW#^cE#d(Gbi_Tw$xXZ7G$R-M27|XxI5We80l&#%Snpx zbFrd(h8Vt}lCeu@T6xFJRlCpJeMef510DGC$^DyG&YwK8f9IC&C` z?#s{r^Z@9-XXO?YlTlLFHMX#G@$?UkN=VBFxv-;m^2~WlR;}N<`@pd?7q8!a^y1xT znmh34m-nxpKDd4D;+bOy_iW#^cE#d(Gbi_Tw$xXZ7G$R-M27|XxI5We80l&#%Snpx zbFrd(h8Vt}lCeu@T6xFJRlCpJeMef510DGC$^DyG&YwK8f9IC -#include -#include -#include -#include -#include - -#ifndef GIFPLOT_H - -#ifdef SWIG -%nodefault; -#endif - -/* Pixel is 8-bits */ - -typedef unsigned char Pixel; -typedef float Zvalue; - -/* ------------------------------------------------------------------------ - ColorMap - - Definition and methods for colormaps - ------------------------------------------------------------------------ */ - -typedef struct ColorMap { - unsigned char *cmap; - char *name; -} ColorMap; - -extern ColorMap *new_ColorMap(char *filename); -extern void delete_ColorMap(ColorMap *c); -extern void ColorMap_default(ColorMap *c); -extern void ColorMap_assign(ColorMap *c, int index, int r, int g, int b); -extern int ColorMap_getitem(ColorMap *c, int index); -extern void ColorMap_setitem(ColorMap *c, int index, int value); -extern int ColorMap_write(ColorMap *c, char *filename); - -/* Some default colors */ - -#define BLACK 0 -#define WHITE 1 -#define RED 2 -#define GREEN 3 -#define BLUE 4 -#define YELLOW 5 -#define CYAN 6 -#define MAGENTA 7 - -/*------------------------------------------------------------------------- - FrameBuffer - - This structure defines a simple 8 bit framebuffer. - ------------------------------------------------------------------------- */ - -typedef struct FrameBuffer { - Pixel **pixels; - Zvalue **zbuffer; - unsigned int height; - unsigned int width; - int xmin; /* These are used for clipping */ - int ymin; - int xmax; - int ymax; -} FrameBuffer; - -#define ZMIN 1e+36 - -/* FrameBuffer Methods */ - -extern FrameBuffer *new_FrameBuffer(unsigned int width, unsigned int height); -extern void delete_FrameBuffer(FrameBuffer *frame); -extern int FrameBuffer_resize(FrameBuffer *frame, int width, int height); -extern void FrameBuffer_clear(FrameBuffer *frame, Pixel color); -extern void FrameBuffer_plot(FrameBuffer *frame, int x, int y, Pixel color); -extern void FrameBuffer_horizontal(FrameBuffer *frame, int xmin, int xmax, int y, Pixel color); -extern void FrameBuffer_horizontalinterp(FrameBuffer *f, int xmin, int xmax, int y, Pixel c1, Pixel c2); -extern void FrameBuffer_vertical(FrameBuffer *frame, int ymin, int ymax, int x, Pixel color); -extern void FrameBuffer_box(FrameBuffer *frame, int x1, int y1, int x2, int y2, Pixel color); -extern void FrameBuffer_solidbox(FrameBuffer *frame, int x1, int y1, int x2, int y2, Pixel color); -extern void FrameBuffer_interpbox(FrameBuffer *f, int x1, int y1, int x2, int y2, Pixel c1, Pixel c2, Pixel c3, Pixel c4); -extern void FrameBuffer_circle(FrameBuffer *frame, int x1, int y1, int radius, Pixel color); -extern void FrameBuffer_solidcircle(FrameBuffer *frame, int x1, int y1, int radius, Pixel color); -extern void FrameBuffer_line(FrameBuffer *frame, int x1, int y1, int x2, int y2, Pixel color); -extern void FrameBuffer_setclip(FrameBuffer *frame, int xmin, int ymin, int xmax, int ymax); -extern void FrameBuffer_noclip(FrameBuffer *frame); -extern int FrameBuffer_makeGIF(FrameBuffer *frame, ColorMap *cmap, void *buffer, unsigned int maxsize); -extern int FrameBuffer_writeGIF(FrameBuffer *f, ColorMap *c, char *filename); -extern void FrameBuffer_zresize(FrameBuffer *f, int width, int height); -extern void FrameBuffer_zclear(FrameBuffer *f); -extern void FrameBuffer_solidtriangle(FrameBuffer *f, int x1, int y1, int x2, int y2, int x3, int y3, Pixel c); -extern void FrameBuffer_interptriangle(FrameBuffer *f, int tx1, int ty1, Pixel c1, - int tx2, int ty2, Pixel c2, int tx3, int ty3, Pixel c3); - -#define HORIZONTAL 1 -#define VERTICAL 2 - -extern void FrameBuffer_drawchar(FrameBuffer *frame, int x, int y, int fgcolor, int bgcolor, char chr, int orientation); -extern void FrameBuffer_drawstring(FrameBuffer *f, int x, int y, int fgcolor, int bgcolor, char *text, int orientation); - -/* ------------------------------------------------------------------------ - PixMap - - The equivalent of "bit-maps". - ------------------------------------------------------------------------ */ - -typedef struct PixMap { - int width; - int height; - int centerx; - int centery; - int *map; -} PixMap; - -/* PIXMAP methods */ - -extern PixMap *new_PixMap(int width, int height, int centerx, int centery); -extern void delete_PixMap(PixMap *pm); -extern void PixMap_set(PixMap *pm, int x, int y, int pix); -extern void FrameBuffer_drawpixmap(FrameBuffer *f, PixMap *pm, int x, int y, int fgcolor, int bgcolor); - -#define GIFPLOT_TRANSPARENT 0 -#define GIFPLOT_FOREGROUND 1 -#define GIFPLOT_BACKGROUND 2 - -/* ------------------------------------------------------------------------ - Plot2D - - Definition and methods for 2D plots. - ------------------------------------------------------------------------ */ - -typedef struct Plot2D { - FrameBuffer *frame; /* what frame buffer are we using */ - int view_xmin; /* Minimum coordinates of view region */ - int view_ymin; - int view_xmax; /* Maximum coordinates of view region */ - int view_ymax; - double xmin; /* Minimum coordinates of plot region */ - double ymin; - double xmax; /* Maximum coordinates of plot region */ - double ymax; - int xscale; /* Type of scaling (LINEAR, LOG, etc..) */ - int yscale; - double dx; /* Private scaling parameters */ - double dy; -} Plot2D; - -/* 2D Plot methods */ - -extern Plot2D *new_Plot2D(FrameBuffer *frame,double xmin,double ymin, double xmax, double ymax); -extern void delete_Plot2D(Plot2D *p2); -extern Plot2D *Plot2D_copy(Plot2D *p2); -extern void Plot2D_clear(Plot2D *p2, Pixel c); -extern void Plot2D_setview(Plot2D *p2, int vxmin, int vymin, int vxmax, int vymax); -extern void Plot2D_setrange(Plot2D *p2, double xmin, double ymin, double xmax, double ymax); -extern void Plot2D_setscale(Plot2D *p2, int xscale, int yscale); -extern void Plot2D_plot(Plot2D *p2, double x, double y, Pixel color); -extern void Plot2D_box(Plot2D *p2, double x1, double y1, double x2, double y2, Pixel color); -extern void Plot2D_solidbox(Plot2D *p2, double x1, double y1,double x2, double y2, Pixel color); -extern void Plot2D_interpbox(Plot2D *p2, double x1, double y1, double x2, double y2, Pixel c1, Pixel c2, Pixel c3, Pixel c4); -extern void Plot2D_circle(Plot2D *p2, double x, double y, double radius, Pixel color); -extern void Plot2D_solidcircle(Plot2D *p2, double x, double y, double radius, Pixel color); -extern void Plot2D_line(Plot2D *p2, double x1, double y1, double x2, double y2, Pixel color); -extern void Plot2D_start(Plot2D *p2); -extern void Plot2D_drawpixmap(Plot2D *p2, PixMap *pm, double x, double y, Pixel color, Pixel bgcolor); -extern void Plot2D_xaxis(Plot2D *p2, double x, double y, double xtick, int ticklength, Pixel c); -extern void Plot2D_yaxis(Plot2D *p2, double x, double y, double ytick, int ticklength, Pixel c); -extern void Plot2D_triangle(Plot2D *p2, double x1, double y1, double x2, double y2, double x3, double y3, Pixel c); -extern void Plot2D_solidtriangle(Plot2D *p2, double x1, double y1, double x2, double y2, double x3, double y3, Pixel c); -extern void Plot2D_interptriangle(Plot2D *p2, double x1, double y1, Pixel c1, - double x2, double y2, Pixel c2, - double x3, double y3, Pixel c3); - -#define LINEAR 10 -#define LOG 11 - -/* ----------------------------------------------------------------------- - Matrix - - Operations on 4x4 transformation matrices and vectors. - Matrices are represented as a double array of 16 elements - ----------------------------------------------------------------------- */ - -typedef double *Matrix; -typedef struct GL_Vector { - double x; - double y; - double z; - double w; -} GL_Vector; - -extern Matrix new_Matrix(); -extern void delete_Matrix(Matrix a); -extern Matrix Matrix_copy(Matrix a); -extern void Matrix_multiply(Matrix a, Matrix b, Matrix c); -extern void Matrix_identity(Matrix a); -extern void Matrix_zero(Matrix a); -extern void Matrix_transpose(Matrix a, Matrix result); -extern void Matrix_invert(Matrix a, Matrix inva); -extern void Matrix_transform(Matrix a, GL_Vector *r, GL_Vector *t); -extern void Matrix_transform4(Matrix a, double rx, double ry, double rz, - double rw, GL_Vector *t); - -extern void Matrix_print(Matrix a); -extern void Matrix_translate(Matrix a, double tx, double ty, double tz); -extern void Matrix_rotatex(Matrix a, double deg); -extern void Matrix_rotatey(Matrix a, double deg); -extern void Matrix_rotatez(Matrix a, double deg); - -/* ----------------------------------------------------------------------- - Plot3D - - Data Structure for 3-D plots - ------------------------------------------------------------------------ */ - -typedef struct Plot3D { - FrameBuffer *frame; /* Frame buffer being used */ - int view_xmin; /* Viewing region */ - int view_ymin; - int view_xmax; - int view_ymax; - double xmin; /* Bounding box */ - double ymin; - double zmin; - double xmax; - double ymax; - double zmax; - double xcenter; /* Center point */ - double ycenter; - double zcenter; - double fovy; /* Field of view */ - double aspect; /* Aspect ratio */ - double znear; /* near "clipping" plane */ - double zfar; /* far "clipping" plane */ - Matrix center_mat; /* Matrix used for centering the model */ - Matrix model_mat; /* Model rotation matrix */ - Matrix view_mat; /* Viewing matrix */ - Matrix fullmodel_mat; /* Full model matrix. Used by sphere plot */ - Matrix trans_mat; /* Total transformation matrix */ - double lookatz; /* Where is the z-lookat point */ - double xshift; /* Used for translation and stuff */ - double yshift; - double zoom; - int width; - int height; - int pers_mode; /* Perspective mode (private) */ - double ortho_left,ortho_right,ortho_bottom,ortho_top; -} Plot3D; - -extern Plot3D *new_Plot3D(FrameBuffer *frame, double xmin, double ymin, double zmin, - double xmax, double ymax, double zmax); -extern void delete_Plot3D(Plot3D *p3); -extern Plot3D *Plot3D_copy(Plot3D *p3); -extern void Plot3D_clear(Plot3D *p3, Pixel Color); -extern void Plot3D_perspective(Plot3D *p3, double fovy, double znear, double zfar); -extern void Plot3D_ortho(Plot3D *p3, double left, double right, double top, double bottom); -extern void Plot3D_lookat(Plot3D *p3, double z); -extern void Plot3D_autoperspective(Plot3D *p3, double fovy); -extern void Plot3D_autoortho(Plot3D *p3); -extern void Plot3D_rotx(Plot3D *p3, double deg); -extern void Plot3D_roty(Plot3D *p3, double deg); -extern void Plot3D_rotz(Plot3D *p3, double deg); -extern void Plot3D_rotl(Plot3D *p3, double deg); -extern void Plot3D_rotr(Plot3D *p3, double deg); -extern void Plot3D_rotd(Plot3D *p3, double deg); -extern void Plot3D_rotu(Plot3D *p3, double deg); -extern void Plot3D_rotc(Plot3D *p3, double deg); -extern void Plot3D_zoom(Plot3D *p3, double percent); -extern void Plot3D_left(Plot3D *p3, double percent); -extern void Plot3D_right(Plot3D *p3, double percent); -extern void Plot3D_down(Plot3D *p3, double percent); -extern void Plot3D_up(Plot3D *p3, double percent); -extern void Plot3D_center(Plot3D *p3, double cx, double cy); - -extern void Plot3D_plot(Plot3D *p3, double x, double y, double z, Pixel Color); - -extern void Plot3D_setview(Plot3D *p3, int vxmin, int vymin, int vxmax, int vymax); -extern void Plot3D_start(Plot3D *p3); -extern void Plot3D_line(Plot3D *p3, double x1, double y1, double z1, - double x2, double y2, double z2, Pixel color); -extern void Plot3D_triangle(Plot3D *p3, double x1, double y1, double z1, - double x2, double y2, double z2, - double x3, double y3, double z3, Pixel color); -extern void Plot3D_solidtriangle(Plot3D *p3, double x1, double y1, double z1, - double x2, double y2, double z2, - double x3, double y3, double z3, Pixel color); - -extern void Plot3D_interptriangle(Plot3D *p3, - double x1, double y1, double z1, Pixel c1, - double x2, double y2, double z2, Pixel c2, - double x3, double y3, double z3, Pixel c3); - -extern void Plot3D_quad(Plot3D *p3, double x1, double y1, double z1, - double x2, double y2, double z2, - double x3, double y3, double z3, - double x4, double y4, double z4, - Pixel color); - -extern void Plot3D_solidquad(Plot3D *p3, double x1, double y1, double z1, - double x2, double y2, double z2, - double x3, double y3, double z3, - double x4, double y4, double z4, - Pixel color); - -extern void Plot3D_interpquad(Plot3D *p3, double x1, double y1, double z1, Pixel c1, - double x2, double y2, double z2, Pixel c2, - double x3, double y3, double z3, Pixel c3, - double x4, double y4, double z4, Pixel c4); - - -extern void Plot3D_solidsphere(Plot3D *p3, double x, double y, double z, double radius,Pixel c); - -extern void Plot3D_outlinesphere(Plot3D *p3, double x, double y, double z, double radius,Pixel c, Pixel bc); - -extern PixMap PixMap_SQUARE; -extern PixMap PixMap_TRIANGLE; -extern PixMap PixMap_CROSS; - -#endif -#define GIFPLOT_H - - - diff --git a/Examples/GIFPlot/Interface/gifplot.i b/Examples/GIFPlot/Interface/gifplot.i deleted file mode 100644 index fdf661c5e..000000000 --- a/Examples/GIFPlot/Interface/gifplot.i +++ /dev/null @@ -1,264 +0,0 @@ -// -// Graphics module -// -%module gifplot -%{ -#include "gifplot.h" -%} - -#if defined(SWIGJAVA ) || defined(SWIGPHP) - %rename(make_default) ColorMap::default(); -#endif - -%rename(__getitem__) ColorMap::getitem(int index); -%rename(__setitem__) ColorMap::setitem(int index, int value); - -/* Pixel is 8-bits */ - -typedef unsigned char Pixel; -typedef float Zvalue; - -/* ------------------------------------------------------------------------ - ColorMap - - Definition and methods for colormaps - ------------------------------------------------------------------------ */ - -typedef struct ColorMap { - char *name; - -// -// %extend adds some C methods to this structure to make it -// look like a C++ class in Python. -// These are really named things like ColorMap_default, ColorMap_assign, etc... - - %extend { - ColorMap(char *filename); - ~ColorMap(); - void default(); - void assign(int index,int r, int g, int b); - int getitem(int index); - void setitem(int index, int value); - int write(char *filename); - } -} ColorMap; - -/* Some default colors */ - -#define BLACK 0 -#define WHITE 1 -#define RED 2 -#define GREEN 3 -#define BLUE 4 -#define YELLOW 5 -#define CYAN 6 -#define MAGENTA 7 - -/*------------------------------------------------------------------------- - FrameBuffer - - This structure defines a simple 8 bit framebuffer. - ------------------------------------------------------------------------- */ - -typedef struct FrameBuffer { - unsigned int height; - unsigned int width; - int xmin; /* These are used for clipping */ - int ymin; - int xmax; - int ymax; - %extend { - FrameBuffer(unsigned int width, unsigned int height); - ~FrameBuffer(); - void resize(int width, int height); - void clear(Pixel color); - void plot(int x, int y, Pixel color); - void horizontal(int xmin, int xmax, int y, Pixel color); - void horizontalinterp(int xmin, int xmax, int y, Pixel c1, Pixel c2); - void vertical(int ymin, int ymax, int x, Pixel color); - void box(int x1, int y1, int x2, int y2, Pixel color); - void solidbox(int x1, int y1, int x2, int y2, Pixel color); - void interpbox(int x1, int y1, int x2, int y2, Pixel c1, Pixel c2, Pixel c3, Pixel c4); - void circle(int x1, int y1, int radius, Pixel color); - void solidcircle(int x1, int y1, int radius, Pixel color); - void line(int x1, int y1, int x2, int y2, Pixel color); - void setclip(int xmin, int ymin, int xmax, int ymax); - void noclip(); - int makeGIF(ColorMap *cmap, void *buffer, unsigned int maxsize); - void zresize(int width, int height); - void zclear(); - void drawchar(int x, int y, int fgcolor, int bgcolor, char chr, int orientation); - void drawstring(int x, int y, int fgcolor, int bgcolor, char *text, int orientation); - void drawpixmap(PixMap *pm, int x, int y, int fgcolor, int bgcolor); - int writeGIF(ColorMap *cmap, char *filename); - } -} FrameBuffer; - -#define HORIZONTAL 1 -#define VERTICAL 2 - -/* -------------------------------------------------------------------------- - PixMap - - The equivalent of "bit-maps". - -------------------------------------------------------------------------- */ - -/* PIXMAP methods */ - -extern PixMap *new_PixMap(int width, int height, int centerx, int centery); -extern void delete_PixMap(PixMap *pm); -extern void PixMap_set(PixMap *pm, int x, int y, int pix); - -#define GIFPLOT_TRANSPARENT 0 -#define GIFPLOT_FOREGROUND 1 -#define GIFPLOT_BACKGROUND 2 - -/* -------------------------------------------------------------------------- - Plot2D - - Definition and methods for 2D plots. - --------------------------------------------------------------------------- */ - -typedef struct Plot2D { - FrameBuffer *frame; - int view_xmin; /* Minimum coordinates of view region */ - int view_ymin; - int view_xmax; /* Maximum coordinates of view region */ - int view_ymax; - double xmin; /* Minimum coordinates of plot region */ - double ymin; - double xmax; /* Maximum coordinates of plot region */ - double ymax; - int xscale; /* Type of scaling (LINEAR, LOG, etc..) */ - int yscale; - %extend { - Plot2D(FrameBuffer *frame,double xmin,double ymin, double xmax, double ymax); - ~Plot2D(); - Plot2D *copy(); - void clear(Pixel c); - void setview(int vxmin, int vymin, int vxmax, int vymax); - void setrange(double xmin, double ymin, double xmax, double ymax); - void setscale(int xscale, int yscale); - void plot(double x, double y, Pixel color); - void box(double x1, double y1, double x2, double y2, Pixel color); - void solidbox(double x1, double y1, double x2, double y2, Pixel color); - void interpbox(double x1, double y1, double x2, double y2, Pixel c1, Pixel c2, Pixel c3, Pixel c4); - - void circle(double x, double y, double radius, Pixel color); - void solidcircle(double x, double y, double radius, Pixel color); - void line(double x1, double y1, double x2, double y2, Pixel color); - void start(); - void drawpixmap(PixMap *pm, double x, double y, Pixel color, Pixel bgcolor); - void xaxis(double x, double y, double xtick, int ticklength, Pixel color); - void yaxis(double x, double y, double ytick, int ticklength, Pixel color); - void triangle(double x1, double y1, double x2, double y2, double x3, double y3, Pixel c); - - void solidtriangle(double x1, double y1, double x2, double y2, double x3, double y3, Pixel c); - - void interptriangle(double x1, double y1, Pixel c1, - double x2, double y2, Pixel c2, - double x3, double y3, Pixel c3); - - } -} Plot2D; - -#define LINEAR 10 -#define LOG 11 - -/* ------------------------------------------------------------------------------ - Plot3D - - Data Structure for 3-D plots - ------------------------------------------------------------------------------ */ - -typedef struct Plot3D { - FrameBuffer *frame; - int view_xmin; /* Viewing region */ - int view_ymin; - int view_xmax; - int view_ymax; - double xmin; /* Bounding box */ - double ymin; - double zmin; - double xmax; - double ymax; - double zmax; - double xcenter; /* Center point */ - double ycenter; - double zcenter; - double fovy; /* Field of view */ - double aspect; /* Aspect ratio */ - double znear; /* near "clipping" plane */ - double zfar; /* far "clipping" plane */ - double lookatz; /* Where is the z-lookat point */ - double xshift; /* Used for translation and stuff */ - double yshift; - %extend { - Plot3D(FrameBuffer *frame, double xmin, double ymin, double zmin, double xmax, double ymax, double zmax); - ~Plot3D(); - Plot3D *copy(); - void clear(Pixel bgcolor); - void perspective( double fovy, double znear, double zfar); - void lookat( double z); - void autoperspective( double fovy); - void ortho(double left, double right, double bottom, double top); - void autoortho(); - void rotx( double deg); - void roty( double deg); - void rotz( double deg); - void rotl( double deg); - void rotr( double deg); - void rotd( double deg); - void rotu( double deg); - void rotc( double deg); - void zoom( double percent); - void left( double percent); - void right( double percent); - void down( double percent); - void up( double percent); - void center( double cx, double cy); - void plot( double x, double y, double z, Pixel Color); - void setview( int vxmin, int vymin, int vxmax, int vymax); - void start(); - void line( double x1, double y1, double z1, - double x2, double y2, double z2, Pixel color); - void triangle( double x1, double y1, double z1, - double x2, double y2, double z2, - double x3, double y3, double z3, Pixel color); - void solidtriangle( double x1, double y1, double z1, - double x2, double y2, double z2, - double x3, double y3, double z3, Pixel color); - void interptriangle(double x1, double y1, double z1, Pixel c1, - double x2, double y2, double z2, Pixel c2, - double x3, double y3, double z3, Pixel c3); - void quad( double x1, double y1, double z1, - double x2, double y2, double z2, - double x3, double y3, double z3, - double x4, double y4, double z4, - Pixel color); - void solidquad( double x1, double y1, double z1, - double x2, double y2, double z2, - double x3, double y3, double z3, - double x4, double y4, double z4, - Pixel color); - void interpquad( double x1, double y1, double z1, Pixel c1, - double x2, double y2, double z2, Pixel c2, - double x3, double y3, double z3, Pixel c3, - double x4, double y4, double z4, Pixel c4); - void solidsphere( double x, double y, double z, double radius,Pixel c); - void outlinesphere( double x, double y, double z, double radius,Pixel c, Pixel bc); - } -} Plot3D; - -#ifndef SWIGJAVA -/* These directives create constants of a specific type. They - do not correspond to any C variable or declared constant in the - header file */ -%constant PixMap * SQUARE = &PixMap_SQUARE; -%constant PixMap * TRIANGLE = &PixMap_TRIANGLE; -%constant PixMap * CROSS = &PixMap_CROSS; -#endif - - - - diff --git a/Examples/GIFPlot/Java/check.list b/Examples/GIFPlot/Java/check.list deleted file mode 100644 index 13de977af..000000000 --- a/Examples/GIFPlot/Java/check.list +++ /dev/null @@ -1,4 +0,0 @@ -# see top-level Makefile.in -full -shadow -simple diff --git a/Examples/GIFPlot/Java/full/Makefile b/Examples/GIFPlot/Java/full/Makefile deleted file mode 100644 index 8f167237d..000000000 --- a/Examples/GIFPlot/Java/full/Makefile +++ /dev/null @@ -1,20 +0,0 @@ -TOP = ../../.. -SWIG = $(TOP)/../swig -SWIGOPT = -I../../Include -noproxy -SRCS = -TARGET = gifplot -INTERFACE = gifplot.i -LIBS = -L../.. -lgifplot -INCLUDES = -I../../Include - -all:: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ - INCLUDES='$(INCLUDES)' LIBS='$(LIBS)' SWIGOPT='$(SWIGOPT)' \ - TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' java - javac *.java - -clean:: - $(MAKE) -f $(TOP)/Makefile java_clean - rm -f *.gif - -check: all diff --git a/Examples/GIFPlot/Java/full/README b/Examples/GIFPlot/Java/full/README deleted file mode 100644 index f536864de..000000000 --- a/Examples/GIFPlot/Java/full/README +++ /dev/null @@ -1,8 +0,0 @@ -This example runs the entire gifplot.h header file through SWIG without -any changes. The program 'main.java' does something a little more -interesting. After doing a make, run it using 'java main'. You'll have to go -look at the header file to get a complete listing of the functions. - -Note the differences in the main.java files between this example and the -'full' example. This example does not use shadow classes. - diff --git a/Examples/GIFPlot/Java/full/cmap b/Examples/GIFPlot/Java/full/cmap deleted file mode 100644 index a20c331a9573dd8443380680bfe2cc428780d8a9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 768 zcmZQzpd(=A5)hSEP}Mdtvvzdz4h)M)OwTDSuW4%Uoiu&!q7`d5@7R0z#JS5i?>&C` z?#s{r^Z@9-XXO?YlTlLFHMX#G@$?UkN=VBFxv-;m^2~WlR;}N<`@pd?7q8!a^y1xT znmh34m-nxpKDd4D;+bOy_iW#^cE#d(Gbi_Tw$xXZ7G$R-M27|XxI5We80l&#%Snpx zbFrd(h8Vt}lCeu@T6xFJRlCpJeMef510DGC$^DyG&YwK8f9IC 239) c = 239; - gifplot.Plot3D_solidquad(p3,x,y,z1,x+dx,y,z2,x+dx,y+dy,z3,x,y+dy,z4,(short)(c+16)); - y = y + dy; - } - x = x + dx; - } - - gifplot.FrameBuffer_writeGIF(frame,cmap,"image.gif"); - System.out.println( "Wrote image.gif" ); - } - - // Here is the function to plot - public static double func(double x, double y) { - return 5*java.lang.Math.cos(2*java.lang.Math.sqrt(x*x+y*y))*java.lang.Math.exp(-0.3*java.lang.Math.sqrt(x*x+y*y)); - } -} diff --git a/Examples/GIFPlot/Java/shadow/Makefile b/Examples/GIFPlot/Java/shadow/Makefile deleted file mode 100644 index e513b9b5a..000000000 --- a/Examples/GIFPlot/Java/shadow/Makefile +++ /dev/null @@ -1,20 +0,0 @@ -TOP = ../../.. -SWIG = $(TOP)/../swig -SWIGOPT = -I../../Interface -SRCS = -TARGET = gifplot -INTERFACE = gifplot.i -LIBS = -L../.. -lgifplot -INCLUDES = -I../../Include - -all:: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ - INCLUDES='$(INCLUDES)' LIBS='$(LIBS)' SWIGOPT='$(SWIGOPT)' \ - TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' java - javac *.java - -clean:: - $(MAKE) -f $(TOP)/Makefile java_clean - rm -f *.gif - -check: all diff --git a/Examples/GIFPlot/Java/shadow/README b/Examples/GIFPlot/Java/shadow/README deleted file mode 100644 index 4adbde306..000000000 --- a/Examples/GIFPlot/Java/shadow/README +++ /dev/null @@ -1,5 +0,0 @@ -This example uses the file in ../../Interface/gifplot.i to build -an interface with shadow classes. After doing a make, run the program main, ie: 'java main'. - -Note the differences in the main.java files between this example and the -'full' example. This example uses the shadow classes. diff --git a/Examples/GIFPlot/Java/shadow/cmap b/Examples/GIFPlot/Java/shadow/cmap deleted file mode 100644 index a20c331a9573dd8443380680bfe2cc428780d8a9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 768 zcmZQzpd(=A5)hSEP}Mdtvvzdz4h)M)OwTDSuW4%Uoiu&!q7`d5@7R0z#JS5i?>&C` z?#s{r^Z@9-XXO?YlTlLFHMX#G@$?UkN=VBFxv-;m^2~WlR;}N<`@pd?7q8!a^y1xT znmh34m-nxpKDd4D;+bOy_iW#^cE#d(Gbi_Tw$xXZ7G$R-M27|XxI5We80l&#%Snpx zbFrd(h8Vt}lCeu@T6xFJRlCpJeMef510DGC$^DyG&YwK8f9IC 239) c = 239; - p3.solidquad(x,y,z1,x+dx,y,z2,x+dx,y+dy,z3,x,y+dy,z4,(short)(c+16)); - y = y + dy; - } - x = x + dx; - } - - frame.writeGIF(cmap,"image.gif"); - System.out.println( "Wrote image.gif" ); - } - - // Here is the function to plot - public static double func(double x, double y) { - return 5*java.lang.Math.cos(2*java.lang.Math.sqrt(x*x+y*y))*java.lang.Math.exp(-0.3*java.lang.Math.sqrt(x*x+y*y)); - } -} diff --git a/Examples/GIFPlot/Java/simple/Makefile b/Examples/GIFPlot/Java/simple/Makefile deleted file mode 100644 index d707fd458..000000000 --- a/Examples/GIFPlot/Java/simple/Makefile +++ /dev/null @@ -1,21 +0,0 @@ -TOP = ../../.. -SWIG = $(TOP)/../swig -SWIGOPT = -noproxy -SRCS = -TARGET = simple -INTERFACE = simple.i -LIBS = -L../.. -lgifplot -INCLUDES = -I../../Include - -all:: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ - INCLUDES='$(INCLUDES)' LIBS='$(LIBS)' SWIGOPT='$(SWIGOPT)' \ - TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' java - javac *.java - - -clean:: - $(MAKE) -f $(TOP)/Makefile java_clean - rm -f *.gif - -check: all diff --git a/Examples/GIFPlot/Java/simple/README b/Examples/GIFPlot/Java/simple/README deleted file mode 100644 index 1fb8453f0..000000000 --- a/Examples/GIFPlot/Java/simple/README +++ /dev/null @@ -1,5 +0,0 @@ -This is a very minimalistic example in which just a few functions -and constants from library are wrapped and used to draw some simple -shapes. After doing a make, run the java program, ie 'java main'. - - diff --git a/Examples/GIFPlot/Java/simple/main.java b/Examples/GIFPlot/Java/simple/main.java deleted file mode 100644 index b165a4baa..000000000 --- a/Examples/GIFPlot/Java/simple/main.java +++ /dev/null @@ -1,41 +0,0 @@ - -public class main { - - static { - try { - System.loadLibrary("simple"); - } catch (UnsatisfiedLinkError e) { - System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e); - System.exit(1); - } - } - - public static void main(String argv[]) { - - // Draw some simple shapes - System.out.println( "Drawing some basic shapes" ); - - SWIGTYPE_p_ColorMap cmap = simple.new_ColorMap(null); - SWIGTYPE_p_FrameBuffer f = simple.new_FrameBuffer(400,400); - - // Clear the picture - simple.FrameBuffer_clear(f,(short)simple.BLACK); - - // Make a red box - simple.FrameBuffer_box(f,40,40,200,200,(short)simple.RED); - - // Make a blue circle - simple.FrameBuffer_circle(f,200,200,40,(short)simple.BLUE); - - // Make green line - simple.FrameBuffer_line(f,10,390,390,200, (short)simple.GREEN); - - // Write an image out to disk - - simple.FrameBuffer_writeGIF(f,cmap,"image.gif"); - System.out.println( "Wrote image.gif" ); - - simple.delete_FrameBuffer(f); - simple.delete_ColorMap(cmap); - } -} diff --git a/Examples/GIFPlot/Java/simple/simple.i b/Examples/GIFPlot/Java/simple/simple.i deleted file mode 100644 index 457bc4c09..000000000 --- a/Examples/GIFPlot/Java/simple/simple.i +++ /dev/null @@ -1,38 +0,0 @@ -/* This example shows a very simple interface wrapping a few - primitive declarations */ - -%module simple -%{ -#include "gifplot.h" -%} - -typedef unsigned char Pixel; - -/* Here are a few useful functions */ - -ColorMap *new_ColorMap(char *filename = 0); -void delete_ColorMap(ColorMap *cmap); - -FrameBuffer *new_FrameBuffer(unsigned int width, unsigned int height); -void delete_FrameBuffer(FrameBuffer *frame); -void FrameBuffer_clear(FrameBuffer *frame, Pixel color); -void FrameBuffer_line(FrameBuffer *frame, int x1, int y1, int x2, int y2, Pixel color); -void FrameBuffer_box(FrameBuffer *frame, int x1, int y1, int x2, int y2, Pixel color); -void FrameBuffer_circle(FrameBuffer *frame, int x1, int y1, int radius, Pixel color); -int FrameBuffer_writeGIF(FrameBuffer *f, ColorMap *c, char *filename); - -/* And some useful constants */ - -#define BLACK 0 -#define WHITE 1 -#define RED 2 -#define GREEN 3 -#define BLUE 4 -#define YELLOW 5 -#define CYAN 6 -#define MAGENTA 7 - - - - - diff --git a/Examples/GIFPlot/Lib/Makefile.in b/Examples/GIFPlot/Lib/Makefile.in deleted file mode 100644 index 9db828eb2..000000000 --- a/Examples/GIFPlot/Lib/Makefile.in +++ /dev/null @@ -1,22 +0,0 @@ -CC = @CC@ -CCSHARED= @CCSHARED@ -INCLUDES= -I../Include -CFLAGS = -O -SRCS = frame.c color.c plot2d.c plot3d.c font.c pixmap.c matrix.c gif.c -OBJS = $(SRCS:.c=.@OBJEXT@) -AR = @AR@ -RANLIB = @RANLIB@ -TARGET = ../libgifplot.a - -.c.@OBJEXT@: - $(CC) $(CCSHARED) $(INCLUDES) $(CFLAGS) -c -o $*.@OBJEXT@ $< - -all: $(OBJS) - @rm -f ../libgifplot.a - $(AR) cr $(TARGET) $(OBJS) - $(RANLIB) $(TARGET) - -clean: - rm -f *.@OBJEXT@ *~ $(TARGET) - -check: all diff --git a/Examples/GIFPlot/Lib/color.c b/Examples/GIFPlot/Lib/color.c deleted file mode 100644 index a4eaf285e..000000000 --- a/Examples/GIFPlot/Lib/color.c +++ /dev/null @@ -1,140 +0,0 @@ -/* ----------------------------------------------------------------------------- - * color.c - * - * Colormaps - * - * Author(s) : David Beazley (beazley@cs.uchicago.edu) - * Copyright (C) 1995-1996 - * - * See the file LICENSE for information on usage and redistribution. - * ----------------------------------------------------------------------------- */ - -#define COLORMAP -#include "gifplot.h" -#include - -/* ------------------------------------------------------------------------ - ColorMap *new_ColorMap(char *filename) - - Read a colormap from a file. - ------------------------------------------------------------------------ */ - -ColorMap *new_ColorMap(char *filename) { - ColorMap *c; - FILE *cm; - void ColorMap_default(ColorMap *); - - if (!filename) { - c = (ColorMap *) malloc(sizeof(ColorMap)); - c->cmap = (unsigned char *) malloc(768*sizeof(char)); - c->name = 0; - ColorMap_default(c); - return c; - } - if (strlen(filename) == 0) { - c = (ColorMap *) malloc(sizeof(ColorMap)); - c->cmap = (unsigned char *) malloc(768*sizeof(char)); - ColorMap_default(c); - return c; - } - if ((cm = fopen(filename,"rb")) == NULL) { - return (ColorMap *) 0; - } - c = (ColorMap *) malloc(sizeof(ColorMap)); - c->cmap = (unsigned char *) malloc(768*sizeof(char)); - if (fread(c->cmap, 768, 1, cm) != 1) { - free((char *)c->cmap); - free((char *)c); - fclose(cm); - return (ColorMap *) 0; - } - fclose(cm); - c->name = (char *) malloc(strlen(filename)+1); - strcpy(c->name, filename); - ColorMap_default(c); - return c; -} - -/* -------------------------------------------------------------------------- - delete_ColorMap(ColorMap *cm) - - Destroy a ColorMap - -------------------------------------------------------------------------- */ - -void delete_ColorMap(ColorMap *cm) { - if (cm) { - free((char *)cm->cmap); - if (cm->name) - free((char *)cm->name); - free((char *)cm); - } -} - -/* -------------------------------------------------------------------------- - ColorMap_default(ColorMap *cm) - - This function fills in default values for the first 8 entries of the - colormap. These are *fixed* values---used internally. - -------------------------------------------------------------------------- */ - -void ColorMap_default(ColorMap *cm) { - unsigned char *r,*g,*b; - if (cm) { - r = cm->cmap; - g = cm->cmap+256; - b = cm->cmap+512; - - r[0] = 0; g[0] = 0; b[0] = 0; /* BLACK */ - r[1] = 255; g[1] = 255; b[1] = 255; /* WHITE */ - r[2] = 255; g[2] = 0; b[2] = 0; /* RED */ - r[3] = 0; g[3] = 255; b[3] = 0; /* GREEN */ - r[4] = 0; g[4] = 0; b[4] = 255; /* BLUE */ - r[5] = 255; g[5] = 255; b[5] = 0; /* YELLOW */ - r[6] = 0; g[6] = 255; b[6] = 255; /* CYAN */ - r[7] = 255; g[7] = 0; b[7] = 255; /* MAGENTA */ - } -} - -void ColorMap_assign(ColorMap *cm, int index, int r, int g, int b) { - unsigned char *rb,*gb,*bb; - - rb = cm->cmap; - gb = cm->cmap+256; - bb = cm->cmap+512; - - rb[index] = r; - gb[index] = g; - bb[index] = b; -} - -int ColorMap_getitem(ColorMap *cm, int index) { - if ((index < 0) && (index >= 768)) return -1; - return cm->cmap[index]; -} - -void ColorMap_setitem(ColorMap *cm, int index, int value) { - if ((index < 0) && (index >= 768)) return; - cm->cmap[index]=value; -} - -/* -------------------------------------------------------------------- - ColorMap_write(ColorMap *cm, char *filename) - - Write out a colormap to disk. - -------------------------------------------------------------------- */ - -int ColorMap_write(ColorMap *cm, char *filename) { - - FILE *f; - if (!cm) return -1; - if (!filename) return -1; - if (strlen(filename) == 0) return -1; - - f = fopen(filename,"w"); - - fwrite(cm->cmap,768,1,f); - fclose(f); - return 0; -} - -#undef COLORMAP diff --git a/Examples/GIFPlot/Lib/font.c b/Examples/GIFPlot/Lib/font.c deleted file mode 100644 index b30ee9b14..000000000 --- a/Examples/GIFPlot/Lib/font.c +++ /dev/null @@ -1,705 +0,0 @@ -/* ----------------------------------------------------------------------------- - * font.c - * - * Some basic fonts. - * - * Author(s) : David Beazley (beazley@cs.uchicago.edu) - * Copyright (C) 1995-1996 - * - * See the file LICENSE for information on usage and redistribution. - * ----------------------------------------------------------------------------- */ - -#define FONT -#include "gifplot.h" - -static char Char_A[80] = "\ -...x....\ -...x....\ -..x.x...\ -..x.x...\ -.x...x..\ -.xxxxx..\ -x.....x.\ -x.....x.\ -x.....x.\ -........"; - -static char Char_B[80] = "\ -xxxxxx..\ -x.....x.\ -x.....x.\ -x.....x.\ -xxxxxx..\ -x.....x.\ -x.....x.\ -x.....x.\ -xxxxxx..\ -........"; - -static char Char_C[80] = "\ -..xxxx..\ -.x....x.\ -x.......\ -x.......\ -x.......\ -x.......\ -x.......\ -.x....x.\ -..xxxx..\ -........"; - -static char Char_D[80] = "\ -xxxxx...\ -x....x..\ -x.....x.\ -x.....x.\ -x.....x.\ -x.....x.\ -x.....x.\ -x....x..\ -xxxxx...\ -........"; -static char Char_E[80] = "\ -xxxxxxx.\ -x.......\ -x.......\ -x.......\ -xxxxx...\ -x.......\ -x.......\ -x.......\ -xxxxxxx.\ -........"; -static char Char_F[80] = "\ -xxxxxxx.\ -x.......\ -x.......\ -x.......\ -xxxxx...\ -x.......\ -x.......\ -x.......\ -x.......\ -........"; -static char Char_G[80] = "\ -.xxxxx..\ -x.....x.\ -x.......\ -x.......\ -x...xxx.\ -x.....x.\ -x.....x.\ -x.....x.\ -.xxxxx..\ -........"; -static char Char_H[80] = "\ -x.....x.\ -x.....x.\ -x.....x.\ -x.....x.\ -xxxxxxx.\ -x.....x.\ -x.....x.\ -x.....x.\ -x.....x.\ -........"; -static char Char_I[80] = "\ -xxxxxxx.\ -...x....\ -...x....\ -...x....\ -...x....\ -...x....\ -...x....\ -...x....\ -xxxxxxx.\ -........"; -static char Char_J[80] = "\ -......x.\ -......x.\ -......x.\ -......x.\ -......x.\ -......x.\ -x.....x.\ -.x...x..\ -..xxx...\ -........"; -static char Char_K[80] = "\ -x.....x.\ -x....x..\ -x...x...\ -x..x....\ -xxx.....\ -x..x....\ -x...x...\ -x....x..\ -x.....x.\ -........"; -static char Char_L[80] = "\ -x.......\ -x.......\ -x.......\ -x.......\ -x.......\ -x.......\ -x.......\ -x.......\ -xxxxxxx.\ -........"; -static char Char_M[80] = "\ -x.....x.\ -xx...xx.\ -xx...xx.\ -x.x.x.x.\ -x.x.x.x.\ -x..x..x.\ -x..x..x.\ -x.....x.\ -x.....x.\ -........"; -static char Char_N[80] = "\ -x.....x.\ -xx....x.\ -x.x...x.\ -x.x...x.\ -x..x..x.\ -x...x.x.\ -x...x.x.\ -x....xx.\ -x.....x.\ -........"; -static char Char_O[80] = "\ -.xxxxx..\ -x.....x.\ -x.....x.\ -x.....x.\ -x.....x.\ -x.....x.\ -x.....x.\ -x.....x.\ -.xxxxx..\ -........"; -static char Char_P[80] = "\ -xxxxxx..\ -x.....x.\ -x.....x.\ -x.....x.\ -xxxxxx..\ -x.......\ -x.......\ -x.......\ -x.......\ -........"; -static char Char_Q[80] = "\ -.xxxxx..\ -x.....x.\ -x.....x.\ -x.....x.\ -x.....x.\ -x.....x.\ -x...x.x.\ -x....x..\ -.xxxx.x.\ -........"; -static char Char_R[80] = "\ -xxxxxx..\ -x.....x.\ -x.....x.\ -x.....x.\ -xxxxxx..\ -x..x....\ -x...x...\ -x....x..\ -x.....x.\ -........"; -static char Char_S[80] = "\ -.xxxxx..\ -x.....x.\ -x.......\ -x.......\ -.xxxxx..\ -......x.\ -......x.\ -x.....x.\ -.xxxxx..\ -........"; -static char Char_T[80] = "\ -xxxxxxx.\ -...x....\ -...x....\ -...x....\ -...x....\ -...x....\ -...x....\ -...x....\ -...x....\ -........"; -static char Char_U[80] = "\ -x.....x.\ -x.....x.\ -x.....x.\ -x.....x.\ -x.....x.\ -x.....x.\ -x.....x.\ -x.....x.\ -.xxxxx..\ -........"; -static char Char_V[80] = "\ -x.....x.\ -x.....x.\ -.x...x..\ -.x...x..\ -..x.x...\ -..x.x...\ -...x....\ -...x....\ -...x....\ -........"; -static char Char_W[80] = "\ -x.....x.\ -x.....x.\ -x.....x.\ -x.....x.\ -x.....x.\ -x..x..x.\ -x..x..x.\ -x.x.x.x.\ -.x...x..\ -........"; -static char Char_X[80] = "\ -x.....x.\ -x.....x.\ -.x...x..\ -..x.x...\ -...x....\ -..x.x...\ -.x...x..\ -x.....x.\ -x.....x.\ -........"; -static char Char_Y[80] = "\ -x.....x.\ -x.....x.\ -.x...x..\ -..x.x...\ -...x....\ -...x....\ -...x....\ -...x....\ -...x....\ -........"; -static char Char_Z[80] = "\ -xxxxxxx.\ -......x.\ -.....x..\ -....x...\ -...x....\ -..x.....\ -.x......\ -x.......\ -xxxxxxx.\ -........"; -static char Char_0[80] = "\ -.xxxxx..\ -x....xx.\ -x...x.x.\ -x..x..x.\ -x..x..x.\ -x.x...x.\ -x.x...x.\ -xx....x.\ -.xxxxx..\ -........"; -static char Char_1[80] = "\ -...x....\ -..xx....\ -...x....\ -...x....\ -...x....\ -...x....\ -...x....\ -...x....\ -..xxx...\ -........"; -static char Char_2[80] = "\ -..xxxx..\ -.x....x.\ -x.....x.\ -.....x..\ -....x...\ -...x....\ -..x.....\ -.x......\ -xxxxxxx.\ -........"; -static char Char_3[80] = "\ -.xxxxx..\ -x.....x.\ -......x.\ -......x.\ -...xxx..\ -......x.\ -......x.\ -x.....x.\ -.xxxxx..\ -........"; -static char Char_4[80] = "\ -....xx..\ -...x.x..\ -..x..x..\ -.x...x..\ -xxxxxxx.\ -.....x..\ -.....x..\ -.....x..\ -.....x..\ -........"; -static char Char_5[80] = "\ -xxxxxxx.\ -x.......\ -x.......\ -x.......\ -xxxxxx..\ -......x.\ -......x.\ -x.....x.\ -.xxxxx..\ -........"; -static char Char_6[80] = "\ -....xxx.\ -..xx....\ -.x......\ -x.......\ -x.xxx...\ -xx...x..\ -x.....x.\ -.x...x..\ -..xxx...\ -........"; -static char Char_7[80] = "\ -xxxxxxx.\ -x.....x.\ -.....x..\ -....x...\ -...x....\ -..x.....\ -.x......\ -x.......\ -x.......\ -........"; -static char Char_8[80] = "\ -.xxxxx..\ -x.....x.\ -x.....x.\ -x.....x.\ -.xxxxx..\ -x.....x.\ -x.....x.\ -x.....x.\ -.xxxxx..\ -........"; -static char Char_9[80] = "\ -..xxxx..\ -.x....x.\ -x.....x.\ -x....xx.\ -.xxxx.x.\ -......x.\ -......x.\ -....xx..\ -.xxx....\ -........"; -static char Char_MINUS[80] = "\ -........\ -........\ -........\ -........\ -.xxxxxx.\ -........\ -........\ -........\ -........\ -........"; -static char Char_PLUS[80] = "\ -........\ -........\ -...x....\ -...x....\ -.xxxxx..\ -...x....\ -...x....\ -........\ -........\ -........"; -static char Char_EQUAL[80] = "\ -........\ -........\ -........\ -.xxxxx..\ -........\ -.xxxxx..\ -........\ -........\ -........\ -........"; -static char Char_LPAREN[80] = "\ -....x...\ -...x....\ -..x.....\ -.x......\ -.x......\ -.x......\ -..x.....\ -...x....\ -....x...\ -........"; -static char Char_RPAREN[80] = "\ -...x....\ -....x...\ -.....x..\ -......x.\ -......x.\ -......x.\ -.....x..\ -....x...\ -...x....\ -........"; -static char Char_QUOTE[80] = "\ -..x.x...\ -..x.x...\ -........\ -........\ -........\ -........\ -........\ -........\ -........\ -........"; -static char Char_COLON[80] = "\ -........\ -........\ -...xx...\ -...xx...\ -........\ -...xx...\ -...xx...\ -........\ -........\ -........"; -static char Char_PERIOD[80] = "\ -........\ -........\ -........\ -........\ -........\ -........\ -........\ -...xx...\ -...xx...\ -........"; -static char Char_COMMA[80] = "\ -........\ -........\ -........\ -........\ -........\ -........\ -...xx...\ -...xx...\ -....x...\ -...x...."; - -static char Char_SLASH[80] = "\ -........\ -......x.\ -.....x..\ -....x...\ -...x....\ -..x.....\ -.x......\ -x.......\ -........\ -........"; - -static char Char_SPACE[80] = "\ -........\ -........\ -........\ -........\ -........\ -........\ -........\ -........\ -........\ -........"; - -static char *GP_Font[128]; -static int InitGP_Font = 0; - -static void initGP_Fonts(void) { - - int i; - for (i = 0; i < 128; i++) - GP_Font[i] = (char *) 0; - - GP_Font['A'] = GP_Font['a'] = Char_A; - GP_Font['B'] = GP_Font['b'] = Char_B; - GP_Font['C'] = GP_Font['c'] = Char_C; - GP_Font['D'] = GP_Font['d'] = Char_D; - GP_Font['E'] = GP_Font['e'] = Char_E; - GP_Font['F'] = GP_Font['f'] = Char_F; - GP_Font['G'] = GP_Font['g'] = Char_G; - GP_Font['H'] = GP_Font['h'] = Char_H; - GP_Font['I'] = GP_Font['i'] = Char_I; - GP_Font['J'] = GP_Font['j'] = Char_J; - GP_Font['K'] = GP_Font['k'] = Char_K; - GP_Font['L'] = GP_Font['l'] = Char_L; - GP_Font['M'] = GP_Font['m'] = Char_M; - GP_Font['N'] = GP_Font['n'] = Char_N; - GP_Font['O'] = GP_Font['o'] = Char_O; - GP_Font['P'] = GP_Font['p'] = Char_P; - GP_Font['Q'] = GP_Font['q'] = Char_Q; - GP_Font['R'] = GP_Font['r'] = Char_R; - GP_Font['S'] = GP_Font['s'] = Char_S; - GP_Font['T'] = GP_Font['t'] = Char_T; - GP_Font['U'] = GP_Font['u'] = Char_U; - GP_Font['V'] = GP_Font['v'] = Char_V; - GP_Font['W'] = GP_Font['w'] = Char_W; - GP_Font['X'] = GP_Font['x'] = Char_X; - GP_Font['Y'] = GP_Font['y'] = Char_Y; - GP_Font['Z'] = GP_Font['z'] = Char_Z; - GP_Font['0'] = Char_0; - GP_Font['1'] = Char_1; - GP_Font['2'] = Char_2; - GP_Font['3'] = Char_3; - GP_Font['4'] = Char_4; - GP_Font['5'] = Char_5; - GP_Font['6'] = Char_6; - GP_Font['7'] = Char_7; - GP_Font['8'] = Char_8; - GP_Font['9'] = Char_9; - GP_Font['.'] = Char_PERIOD; - GP_Font[','] = Char_COMMA; - GP_Font['='] = Char_EQUAL; - GP_Font['-'] = Char_MINUS; - GP_Font['+'] = Char_PLUS; - GP_Font['\"'] = Char_QUOTE; - GP_Font['('] = Char_LPAREN; - GP_Font[')'] = Char_RPAREN; - GP_Font[':'] = Char_COLON; - GP_Font['/'] = Char_SLASH; - GP_Font[' '] = Char_SPACE; - InitGP_Font = 1; -} - -/* ----------------------------------------------------------------------- - void FrameBuffer_drawchar(FrameBuffer *f, int x, int y, Pixel fgcolor, Pixel bgcolor, char chr, int orientation) - - Draws a character at location x, y with given color and orientation parameters. - Orientation can either be HORIZONTAL or VERTICAL - ----------------------------------------------------------------------- */ -void FrameBuffer_drawchar(FrameBuffer *f, int x, int y, int fgcolor, - int bgcolor, char chr, int orientation) { - - Pixel c, bc,*p,*p1; - char *ch; - int i,j; - int xpixels,ypixels; - - if (!InitGP_Font) initGP_Fonts(); - - c = (Pixel) fgcolor; - bc = (Pixel) bgcolor; - xpixels = f->width; - ypixels = f->height; - - if (orientation == HORIZONTAL) { - if ((x < f->xmin) || (x > f->xmax-8) || - (y < f->ymin) || (y > f->ymax-10)) return; - - ch = GP_Font[(int) chr]; - if (!ch) return; - p = &f->pixels[y+9][x]; - for (i = 0; i < 10; i++) { - p1 = p; - for (j = 0; j< 8; j++) { - if (*(ch++) == 'x') *p= c; - else if (bgcolor >= 0) - *p = bc; - p++; - } - p = (p1 - xpixels); - } - } else { - if ((x < f->xmin+10) || (x >= f->xmax) || - (y < f->ymin) || (y > f->ymax-8)) return; - - ch = GP_Font[(int) chr]; - if (!ch) return; - p = &f->pixels[y][x-9]; - for (i = 0; i < 10; i++) { - p1 = p; - for (j = 0; j< 8; j++) { - if (*(ch++) == 'x') *p= c; - else if (bgcolor >= 0) - *p = bc; - p+=xpixels; - } - p = p1 + 1; - } - } -} - -/* ---------------------------------------------------------------------- - void FrameBuffer_drawstring(FrameBuffer *f, int x, int y, int fgcolor, - int bgcolor, char *text, int orientation) - - Draws an ASCII string on the framebuffer. Can be oriented either horizontally - or vertically. - ---------------------------------------------------------------------- */ - -void FrameBuffer_drawstring(FrameBuffer *f, int x, int y, int fgcolor, int bgcolor, char *text, int orientation) { - - char *c; - int x1, y1; - int xpixels, ypixels; - - x1 = x; - y1 = y; - xpixels = f->width; - ypixels = f->height; - c = text; - while (*c) { - if (*c == '\n') { - if (orientation == HORIZONTAL) { - x1 = x; y1= y1- 10*xpixels; - } else { - y1 = y; x1= x1 + 10*ypixels; - } - } else { - FrameBuffer_drawchar(f, x1,y1,fgcolor, bgcolor,*c, orientation); - if (orientation == HORIZONTAL) { - x1+=8; - if (x1 >= (xpixels-8)) { - x1 = x; y1= y1- 10;} - if (y1 < 0) return; - } else { - y1 += 8; - if (y1 >= (ypixels-8)) { - y1 = y; x1 = x1 + 10;} - if (x1 > (xpixels-10)) return; - } - } - c++; - } -} - - - - - - - - diff --git a/Examples/GIFPlot/Lib/frame.c b/Examples/GIFPlot/Lib/frame.c deleted file mode 100644 index e006f0daf..000000000 --- a/Examples/GIFPlot/Lib/frame.c +++ /dev/null @@ -1,924 +0,0 @@ -/* ----------------------------------------------------------------------------- - * frame.c - * - * Frame buffer management - * - * Author(s) : David Beazley (beazley@cs.uchicago.edu) - * Copyright (C) 1995-1996 - * - * See the file LICENSE for information on usage and redistribution. - * ----------------------------------------------------------------------------- */ - -#define FRAME -#include "gifplot.h" -#include - -/* ------------------------------------------------------------------------ - FrameBuffer *new_FrameBuffer(int width, int height) - - Creates a new framebuffer for storing data. - ------------------------------------------------------------------------ */ - -FrameBuffer *new_FrameBuffer(unsigned int width, unsigned int height) { - - FrameBuffer *f; - int FrameBuffer_resize(FrameBuffer *f, int width, int height); - - /* Create a new frame buffer */ - - f = (FrameBuffer *) malloc(sizeof(FrameBuffer)); - f->pixels = (Pixel **) 0; - f->zbuffer = (Zvalue **) 0; - /* Set its size */ - - if (FrameBuffer_resize(f, width, height) == -1) { - free((char *) f); - return (FrameBuffer *) 0; - } - - f->xmin = 0; - f->ymin = 0; - f->xmax = width; - f->ymax = height; - return f; -} - -/* ------------------------------------------------------------------------ - void delete_FrameBuffer(FrameBuffer *f) - - Destroys the given framebuffer - ------------------------------------------------------------------------ */ - -void delete_FrameBuffer(FrameBuffer *f) { - - if (f) { - if (f->pixels) { - free((char *) f->pixels[0]); - free((char *) f->pixels); - } - if (f->zbuffer) { - free((char *) f->zbuffer[0]); - free((char *) f->zbuffer); - } - free((char *)f); - } -} - -/* ------------------------------------------------------------------------ - int *FrameBuffer_resize(FrameBuffer *f, int width, int height) - - Resize the given framebuffer. Returns 0 on success, -1 on failure. - ------------------------------------------------------------------------ */ - -int FrameBuffer_resize(FrameBuffer *f, int width, int height) { - int i; - if ((f) && (width > 0) && (height > 0)) { - if (f->pixels) { - free((char *)f->pixels[0]); - free((char *)f->pixels); - } - f->pixels = (Pixel **) malloc (height*sizeof(Pixel *)); - if (!f->pixels) return -1; - f->pixels[0] = (Pixel *) malloc(height*width*sizeof(Pixel)); - if (!f->pixels[0]) { - free((char *)f->pixels); - return -1; - } - for (i = 0; i < height; i++) - f->pixels[i] = f->pixels[0] + i*width; - f->width = width; - f->height = height; - if (f->zbuffer) { - FrameBuffer_zresize(f,width,height); - } - return 0; - } else { - return -1; - } -} - -/* ------------------------------------------------------------------------ - void FrameBuffer_clear(FrameBuffer *f, Pixel color) - - Clears the current FrameBuffer - ------------------------------------------------------------------------ */ - -void FrameBuffer_clear(FrameBuffer *f, Pixel color) { - Pixel *p; - unsigned int i; - p = &f->pixels[0][0]; - - for (i = 0; i < f->width*f->height; i++, p++) - *p = color; -} - -/* ------------------------------------------------------------------------ - void FrameBuffer_plot(FrameBuffer *f, int x1, int y1, Pixel color) - - Plots a point and does a bounds check. - ------------------------------------------------------------------------ */ - -void FrameBuffer_plot(FrameBuffer *f, int x1, int y1, Pixel color) { - - if ((x1 < f->xmin) || (x1 >= f->xmax) || (y1 < f->ymin) || (y1 >= f->ymax)) - return; - f->pixels[y1][x1] = color; - -} - -/* ------------------------------------------------------------------------ - FrameBuffer_horizontal(Framebuffer *f, int xmin, int xmax, int y, Pixel color) - - Draw a horizontal line (clipped) - ------------------------------------------------------------------------ */ - -void FrameBuffer_horizontal(FrameBuffer *f, int xmin, int xmax, int y, Pixel color) { - - Pixel *p; - int i; - - if ((y < f->ymin) || (y >= f->ymax)) return; - if (xmin < f->xmin) xmin = f->xmin; - if (xmax >= f->xmax) xmax = f->xmax - 1; - - p = &f->pixels[y][xmin]; - for (i = xmin; i <= xmax; i++, p++) - *p = color; - -} - -/* ------------------------------------------------------------------------ - FrameBuffer_horizontalinterp(Framebuffer *f, int xmin, int xmax, int y, - Pixel c1, Pixel c2) - - Draw a horizontal line (clipped) with color interpolation. - ------------------------------------------------------------------------ */ - -void FrameBuffer_horizontalinterp(FrameBuffer *f, int xmin, int xmax, int y, - Pixel c1, Pixel c2) { - - Pixel *p; - int i; - double mc; - int x1; - if ((y < f->ymin) || (y >= f->ymax)) return; - - x1 = xmin; - if (xmin < f->xmin) xmin = f->xmin; - if (xmax >= f->xmax) xmax = f->xmax - 1; - if (xmax < f->xmin) return; - if (xmin >= f->xmax) return; - - if (xmin != xmax) - mc = (double)(c2 - c1)/(double) (xmax - xmin); - else - mc = 0.0; - - p = &f->pixels[y][xmin]; - for (i = xmin; i <= xmax; i++, p++) - *p = (Pixel) (mc*(i-x1) + c1); - -} - - -/* ------------------------------------------------------------------------ - FrameBuffer_vertical(Framebuffer *f, int xmin, int xmax, int y, Pixel color) - - Draw a Vertical line (clipped) - ------------------------------------------------------------------------ */ - -void FrameBuffer_vertical(FrameBuffer *f, int ymin, int ymax, int x, Pixel color) { - - Pixel *p; - int i; - - if ((x < f->xmin) || (x >= f->xmax)) return; - if (ymax < f->ymin) return; - if (ymin > f->ymax) return; - if (ymin < f->ymin) ymin = f->ymin; - if (ymax >= f->ymax) ymax = f->ymax - 1; - - p = &f->pixels[ymin][x]; - for (i = 0; i <= (ymax - ymin); i++, p+=f->width) - *p = color; - -} - -/* ------------------------------------------------------------------------ - void FrameBuffer_box(FrameBuffer *f, int x1, int y1, int x2, int y2, Pixel color) - - Makes an outline box. - ------------------------------------------------------------------------ */ - -void FrameBuffer_box(FrameBuffer *f, int x1, int y1, int x2, int y2, Pixel color) { - - int xt, yt; - - /* Make sure points are in correct order */ - - if (x2 < x1) { - xt = x2; - x2 = x1; - x1 = xt; - } - if (y2 < y1) { - yt = y2; - y2 = y1; - y1 = yt; - } - - /* Draw lower edge */ - - FrameBuffer_horizontal(f,x1,x2,y1,color); - - /* Draw upper edge */ - - FrameBuffer_horizontal(f,x1,x2,y2,color); - - /* Draw left side */ - - FrameBuffer_vertical(f,y1,y2,x1,color); - - /* Draw right side */ - - FrameBuffer_vertical(f,y1,y2,x2,color); - -} - -/* ------------------------------------------------------------------------ - void FrameBuffer_solidbox(FrameBuffer *f, int x1, int y1, int x2, int y2, Pixel color) - - Makes an solid box. - ------------------------------------------------------------------------ */ - -void FrameBuffer_solidbox(FrameBuffer *f, int x1, int y1, int x2, int y2, Pixel color) { - - int xt, yt; - - /* Make sure points are in correct order */ - - if (x2 < x1) { - xt = x2; - x2 = x1; - x1 = xt; - } - if (y2 < y1) { - yt = y2; - y2 = y1; - y1 = yt; - } - - /* Now perform some clipping */ - - if (y1 < f->ymin) y1 = f->ymin; - if (y2 >= f->ymax) y2 = f->ymax - 1; - - /* Fill it in using horizontal lines */ - - for (yt = y1; yt <= y2; yt++) - FrameBuffer_horizontal(f,x1,x2,yt,color); - -} - -/* ------------------------------------------------------------------------ - void FrameBuffer_interpbox(FrameBuffer *f, int x1, int y1, int x2, int y2 - Pixel c1, Pixel c2, Pixel c3, Pixel c4) - - Makes a box with interpolated color. Colors are assigned as follows : - (x1,y1) = c1 - (x1,y2) = c2 - (x2,y1) = c3 - (x2,y2) = c4 - ------------------------------------------------------------------------ */ - -void FrameBuffer_interpbox(FrameBuffer *f, int x1, int y1, int x2, int y2, - Pixel c1, Pixel c2, Pixel c3, Pixel c4) { - - int xt, yt; - Pixel ct; - double mc1,mc2; - int ystart; - /* Make sure points are in correct order */ - - if (x2 < x1) { - xt = x2; - x2 = x1; - x1 = xt; - ct = c1; - c1 = c3; - c3 = ct; - ct = c2; - c2 = c4; - c4 = ct; - } - if (y2 < y1) { - yt = y2; - y2 = y1; - y1 = yt; - ct = c1; - c1 = c2; - c2 = ct; - ct = c3; - c3 = c4; - c4 = ct; - } - - /* Now perform some clipping */ - - ystart = y1; - mc1 = (double) (c2 - c1)/(double) (y2 - y1); - mc2 = (double) (c4 - c3)/(double) (y2 - y1); - if (y1 < f->ymin) y1 = f->ymin; - if (y2 >= f->ymax) y2 = f->ymax - 1; - - /* Fill it in using horizontal lines */ - - for (yt = y1; yt <= y2; yt++) - FrameBuffer_horizontalinterp(f,x1,x2,yt,(Pixel) ((mc1*(yt - ystart)) + c1), - (Pixel) ((mc2*(yt-ystart))+c3)); - -} - -/* --------------------------------------------------------------------------- - FrameBuffer_line(FrameBuffer *f, int x1, int y1, int x2, int y2, color) - - Draws a line on the framebuffer using the Bresenham line algorithm. The - line is clipped to fit within the current view window. - ---------------------------------------------------------------------------- */ - -void FrameBuffer_line(FrameBuffer *f, int x1, int y1, int x2, int y2, Pixel c) { - - int dx,dy,dxneg,dyneg, inc1,inc2,di; - int x, y, xpixels, ypixels, xt, yt; - Pixel *p; - double m; - int end1 = 0, end2 = 0; - - /* Need to figure out where in the heck this line is */ - - dx = x2 - x1; - dy = y2 - y1; - - if (dx == 0) { - /* Draw a Vertical Line */ - if (y1 < y2) - FrameBuffer_vertical(f,y1,y2,x1,c); - else - FrameBuffer_vertical(f,y2,y1,x1,c); - return; - } - if (dy == 0) { - /* Draw a Horizontal Line */ - if (x1 < x2) - FrameBuffer_horizontal(f,x1,x2,y1,c); - else - FrameBuffer_horizontal(f,x2,x1,y1,c); - return; - } - - /* Figure out where in the heck these lines are using the - Cohen-Sutherland Line Clipping Scheme. */ - - end1 = ((x1 - f->xmin) < 0) | - (((f->xmax- 1 - x1) < 0) << 1) | - (((y1 - f->ymin) < 0) << 2) | - (((f->ymax-1 - y1) < 0) << 3); - - end2 = ((x2 - f->xmin) < 0) | - (((f->xmax-1 - x2) < 0) << 1) | - (((y2 - f->ymin) < 0) << 2) | - (((f->ymax-1 - y2) < 0) << 3); - - if (end1 & end2) return; /* Nope : Not visible */ - - /* Make sure points have a favorable orientation */ - - if (x1 > x2) { - xt = x1; - x1 = x2; - x2 = xt; - yt = y1; - y1 = y2; - y2 = yt; - } - - /* Clip against the boundaries */ - m = (y2 - y1)/(double) (x2-x1); - if (x1 < f->xmin) { - y1 = (int) ((f->xmin - x1)*m + y1); - x1 = (int) f->xmin; - } - if (x2 >= f->xmax) { - y2 = (int) ((f->xmax -1 -x1)*m + y1); - x2 = (int) (f->xmax - 1); - } - - if (y1 > y2) { - xt = x1; - x1 = x2; - x2 = xt; - yt = y1; - y1 = y2; - y2 = yt; - } - - m = 1/m; - if (y1 < f->ymin) { - x1 = (int) ((f->ymin - y1)*m + x1); - y1 = (int) f->ymin; - } - if (y2 >= f->ymax) { - x2 = (int) ((f->ymax-1-y1)*m + x1); - y2 = (int) (f->ymax-1); - } - - if ((x1 < f->xmin) || (x1 >= f->xmax) || (y1 < f->ymin) || (y1 >= f->ymax) || - (x2 < f->xmin) || (x2 >= f->xmax) || (y2 < f->ymin) || (y2 >= f->ymax)) return; - - dx = x2 - x1; - dy = y2 - y1; - xpixels = f->width; - ypixels = f->height; - - dxneg = (dx < 0) ? 1 : 0; - dyneg = (dy < 0) ? 1 : 0; - - dx = abs(dx); - dy = abs(dy); - if (dx >= dy) { - /* Slope between -1 and 1. */ - if (dxneg) { - x = x1; - y = y1; - x1 = x2; - y1 = y2; - x2 = x; - y2 = y; - dyneg = !dyneg; - } - inc1 = 2*dy; - inc2 = 2*(dy-dx); - di = 2*dy-dx; - - /* Draw a line using x as independent variable */ - - p = &f->pixels[y1][x1]; - x = x1; - while (x <= x2) { - *(p++) = c; - if (di < 0) { - di = di + inc1; - } else { - if (dyneg) { - p = p - xpixels; - di = di + inc2; - } else { - p = p + xpixels; - di = di + inc2; - } - } - x++; - } - } else { - /* Slope < -1 or > 1 */ - if (dyneg) { - x = x1; - y = y1; - x1 = x2; - y1 = y2; - x2 = x; - y2 = y; - dxneg = !dxneg; - } - inc1 = 2*dx; - inc2 = 2*(dx-dy); - di = 2*dx-dy; - - /* Draw a line using y as independent variable */ - - p = &f->pixels[y1][x1]; - y = y1; - while (y <= y2) { - *p = c; - p = p + xpixels; - if (di < 0) { - di = di + inc1; - } else { - if (dxneg) { - p = p - 1; - di = di + inc2; - } else { - p = p + 1; - di = di + inc2; - } - } - y++; - } - } -} - - -/* ------------------------------------------------------------------------- - FrameBuffer_circle(FrameBuffer f, int xc, int yc, int radius, Pixel c) - - Create an outline circle - ------------------------------------------------------------------------- */ - -#define plot_circle(x,y,c) \ - if ((x >= xmin) && (x < xmax) && \ - (y >= ymin) && (y < ymax)) \ - pixels[y][x] = c; - -void FrameBuffer_circle(FrameBuffer *f, int xc, int yc, int radius, Pixel c) { - - int xpixels, ypixels, x, y, p; - int xmin, ymin, xmax, ymax; - Pixel **pixels; - - if (radius <= 0) return; - xpixels = f->width; - ypixels = f->height; - pixels = f->pixels; - xmin = f->xmin; - ymin = f->ymin; - xmax = f->xmax; - ymax = f->ymax; - x = 0; - y = radius; - p = 3-2*radius; - while (x <= y) { - plot_circle(xc+x,yc+y,c); - plot_circle(xc-x,yc+y,c); - plot_circle(xc+x,yc-y,c); - plot_circle(xc-x,yc-y,c); - plot_circle(xc+y,yc+x,c); - plot_circle(xc-y,yc+x,c); - plot_circle(xc+y,yc-x,c); - plot_circle(xc-y,yc-x,c); - if (p < 0) p = p + 4*x + 6; - else { - p = p + 4*(x-y) + 10; - y = y -1; - } - x++; - } -} - - -/* ------------------------------------------------------------------------- - FrameBuffer_solidcircle(FrameBuffer f, int xc, int yc, int radius, Pixel c) - - Create an filled circle - ------------------------------------------------------------------------- */ - - -#define fill_circle(x,y,c) \ - x1 = xc - x; \ - x2 = xc + x; \ - FrameBuffer_horizontal(f,x1,x2,y,c); - -void FrameBuffer_solidcircle(FrameBuffer *f, int xc, int yc, int radius, Pixel c) { - - int xpixels, ypixels, x, y, p; - int x1,x2; - int xmin, ymin, xmax, ymax; - Pixel **pixels; - - if (radius <= 0) return; - xpixels = f->width; - ypixels = f->height; - pixels = f->pixels; - xmin = f->xmin; - ymin = f->ymin; - xmax = f->xmax; - ymax = f->ymax; - x = 0; - y = radius; - p = 3-2*radius; - while (x <= y) { - fill_circle(x,yc+y,c); - fill_circle(x,yc-y,c); - fill_circle(y,yc+x,c); - fill_circle(y,yc-x,c); - if (p < 0) p = p + 4*x + 6; - else { - p = p + 4*(x-y) + 10; - y = y -1; - } - x++; - } -} - -/* ------------------------------------------------------------------------ - void FrameBuffer_setclip(f,xmin,ymin,xmax,ymax) - - Set clipping region for plotting - ------------------------------------------------------------------------ */ - -void FrameBuffer_setclip(FrameBuffer *f, int xmin, int ymin, int xmax, int ymax) { - - if (xmin >= xmax) return; - if (ymin >= ymax) return; - - if (xmin < 0) xmin = 0; - if (ymin < 0) ymin = 0; - if (xmax > (int) f->width) xmax = f->width; - if (ymax > (int) f->height) ymax = f->height; - - f->xmin = xmin; - f->ymin = ymin; - f->xmax = xmax; - f->ymax = ymax; -} - -/* ------------------------------------------------------------------------ - void FrameBuffer_noclip(f) - - Disable clipping region - ------------------------------------------------------------------------ */ - -void FrameBuffer_noclip(FrameBuffer *f) { - f->xmin = 0; - f->ymin = 0; - f->xmax = f->width; - f->ymax = f->height; -} - - -/* ------------------------------------------------------------------------ - FrameBuffer_zresize(FrameBuffer *f, int width, int height) - - This function resizes the framebuffer's zbuffer. If none exist, it - creates a new one. - ------------------------------------------------------------------------ */ - -void FrameBuffer_zresize(FrameBuffer *f, int width, int height) { - int i; - - if (f->zbuffer) { - free((char *)f->zbuffer[0]); - free((char *)f->zbuffer); - } - f->zbuffer = (Zvalue **) malloc(height*sizeof(Zvalue *)); - f->zbuffer[0] = (Zvalue *) malloc(height*width*sizeof(Zvalue)); - for (i = 0; i < height; i++) - f->zbuffer[i] = f->zbuffer[0]+i*width; -} - -/* ------------------------------------------------------------------------ - FrameBuffer_zclear(FrameBuffer *f) - - Clears the z-buffer for a particular frame. Sets all of the z-values to - ZMIN. - ------------------------------------------------------------------------- */ - -void FrameBuffer_zclear(FrameBuffer *f) { - unsigned int i,j; - if (f) { - if (f->zbuffer) { - for (i = 0; i < f->width; i++) - for (j = 0; j < f->height; j++) - f->zbuffer[j][i] = ZMIN; - } - } -} - - - -/* ------------------------------------------------------------------------- - FrameBuffer_solidtriangle(FrameBuffer *f, int tx1, int ty2, - int tx2, int ty2, - int tx3, int ty3, Pixel color) - - This function draws a 2D filled triangle. - - General idea : - 1. Transform the three points into screen coordinates - 2. Order three points vertically on screen. - 3. Check for degenerate cases (where 3 points are colinear). - 4. Fill in the resulting triangle using horizontal lines. - -------------------------------------------------------------------------- */ - -void FrameBuffer_solidtriangle(FrameBuffer *f, int tx1, int ty1, - int tx2, int ty2, - int tx3, int ty3, Pixel color) { - int tempx, tempy; - double m1,m2,m3; - int y; - int ix1, ix2; - - /* Figure out which point has the greatest "y" value */ - - if (ty2 > ty1) { /* Swap points 1 and 2 if 2 is higher */ - tempx = tx1; - tempy = ty1; - tx1 = tx2; - ty1 = ty2; - tx2 = tempx; - ty2 = tempy; - } - if (ty3 > ty1) { /* Swap points 1 and 3 if 3 is higher */ - tempx = tx1; - tempy = ty1; - tx1 = tx3; - ty1 = ty3; - tx3 = tempx; - ty3 = tempy; - } - if (ty3 > ty2) { /* Swap points 2 and 3 if 3 is higher */ - tempx = tx2; - tempy = ty2; - tx2 = tx3; - ty2 = ty3; - tx3 = tempx; - ty3 = tempy; - } - - /* Points are now order so that t_1 is the highest point, t_2 is the - middle point, and t_3 is the lowest point */ - - /* Check for degenerate cases here */ - - if ((ty1 == ty2) && (ty2 == ty3)) { - - /* Points are aligned horizontally. Handle as a special case */ - /* Just draw three lines using the outline color */ - - FrameBuffer_line(f,tx1,ty1,tx2,ty2,color); - FrameBuffer_line(f,tx1,ty1,tx3,ty3,color); - FrameBuffer_line(f,tx2,ty2,tx3,ty3,color); - - } else { - - if (ty2 < ty1) { - /* First process line segments between (x1,y1)-(x2,y2) - And between (x1,y1),(x3,y3) */ - - m1 = (double) (tx2 - tx1)/(double) (ty2 - ty1); - m2 = (double) (tx3 - tx1)/(double) (ty3 - ty1); - - y = ty1; - while (y >= ty2) { - /* Calculate x values from slope */ - ix1 = (int) (m1*(y-ty1)+0.5) + tx1; - ix2 = (int) (m2*(y-ty1)+0.5) + tx1; - if (ix1 > ix2) - FrameBuffer_horizontal(f,ix2,ix1,y,color); - else - FrameBuffer_horizontal(f,ix1,ix2,y,color); - y--; - } - } - if (ty3 < ty2) { - /* Draw lower half of the triangle */ - m2 = (double) (tx3 - tx1)/(double) (ty3 - ty1); - m3 = (double) (tx3 - tx2)/(double)(ty3 - ty2); - y = ty2; - while (y >= ty3) { - ix1 = (int) (m3*(y-ty2)+0.5)+tx2; - ix2 = (int) (m2*(y-ty1)+0.5)+tx1; - if (ix1 > ix2) - FrameBuffer_horizontal(f,ix2,ix1,y,color); - else - FrameBuffer_horizontal(f,ix1,ix2,y,color); - y--; - } - } - } -} - -/* ------------------------------------------------------------------------- - FrameBuffer_interptriangle(FrameBuffer *f, - int tx1, int ty2, Pixel c1, - int tx2, int ty2, Pixel c2, - int tx3, int ty3, Pixel c3) - - This function draws a filled triangle with color - interpolation. - - General idea : - 1. Transform the three points into screen coordinates - 2. Order three points vertically on screen. - 3. Check for degenerate cases (where 3 points are colinear). - 4. Fill in the resulting triangle using horizontal lines. - 5. Colors are interpolated between end points - -------------------------------------------------------------------------- */ - -void FrameBuffer_interptriangle(FrameBuffer *f, - int tx1, int ty1, Pixel c1, - int tx2, int ty2, Pixel c2, - int tx3, int ty3, Pixel c3) { - int tempx, tempy; - double m1,m2,m3; - double mc1,mc2,mc3; - Pixel ic1,ic2,tempc; - int y; - int ix1, ix2; - - /* Figure out which point has the greatest "y" value */ - - if (ty2 > ty1) { /* Swap points 1 and 2 if 2 is higher */ - tempx = tx1; - tempy = ty1; - tempc = c1; - tx1 = tx2; - ty1 = ty2; - c1 = c2; - tx2 = tempx; - ty2 = tempy; - c2 = tempc; - } - if (ty3 > ty1) { /* Swap points 1 and 3 if 3 is higher */ - tempx = tx1; - tempy = ty1; - tempc = c1; - tx1 = tx3; - ty1 = ty3; - c1 = c3; - tx3 = tempx; - ty3 = tempy; - c3 = tempc; - } - if (ty3 > ty2) { /* Swap points 2 and 3 if 3 is higher */ - tempx = tx2; - tempy = ty2; - tempc = c2; - tx2 = tx3; - ty2 = ty3; - c2 = c3; - tx3 = tempx; - ty3 = tempy; - c3 = tempc; - } - - /* Points are now order so that t_1 is the highest point, t_2 is the - middle point, and t_3 is the lowest point */ - - /* Check for degenerate cases here */ - - if ((ty1 == ty2) && (ty2 == ty3)) { - - /* Points are aligned horizontally. Handle as a special case */ - /* Just draw three lines using the outline color */ - - if (tx2 > tx1) - FrameBuffer_horizontalinterp(f,tx1,tx2,ty1,c1,c2); - else - FrameBuffer_horizontalinterp(f,tx2,tx1,ty1,c2,c1); - if (tx3 > tx1) - FrameBuffer_horizontalinterp(f,tx1,tx3,ty1,c1,c3); - else - FrameBuffer_horizontalinterp(f,tx3,tx1,ty1,c3,c1); - if (tx3 > tx2) - FrameBuffer_horizontalinterp(f,tx2,tx3,ty2,c2,c3); - else - FrameBuffer_horizontalinterp(f,tx3,tx2,ty2,c3,c2); - - } else { - - /* First process line segments between (x1,y1)-(x2,y2) - And between (x1,y1),(x3,y3) */ - - if (ty2 < ty1) { - m1 = (double) (tx2 - tx1)/(double) (ty2 - ty1); - m2 = (double) (tx3 - tx1)/(double) (ty3 - ty1); - mc1 = (c2 - c1)/(double) (ty2 - ty1); - mc2 = (c3 - c1)/(double) (ty3 - ty1); - - y = ty1; - while (y >= ty2) { - /* Calculate x values from slope */ - ix1 = (int) (m1*(y-ty1)+0.5) + tx1; - ix2 = (int) (m2*(y-ty1)+0.5) + tx1; - ic1 = (int) (mc1*(y-ty1) + c1); - ic2 = (int) (mc2*(y-ty1) + c1); - if (ix1 > ix2) - FrameBuffer_horizontalinterp(f,ix2,ix1,y,ic2,ic1); - else - FrameBuffer_horizontalinterp(f,ix1,ix2,y,ic1,ic2); - y--; - } - } - if (ty3 < ty2) { - /* Draw lower half of the triangle */ - m2 = (double) (tx3 - tx1)/(double) (ty3 - ty1); - mc2 = (c3 - c1)/(double) (ty3 - ty1); - m3 = (double) (tx3 - tx2)/(double)(ty3 - ty2); - mc3 = (c3 - c2)/(double) (ty3 - ty2); - y = ty2; - while (y >= ty3) { - ix1 = (int) (m3*(y-ty2)+0.5)+tx2; - ix2 = (int) (m2*(y-ty1)+0.5)+tx1; - ic1 = (int) (mc3*(y-ty2)+c2); - ic2 = (int) (mc2*(y-ty1)+c1); - if (ix1 > ix2) - FrameBuffer_horizontalinterp(f,ix2,ix1,y,ic2,ic1); - else - FrameBuffer_horizontalinterp(f,ix1,ix2,y,ic1,ic2); - y--; - } - } - } -} - - diff --git a/Examples/GIFPlot/Lib/gif.c b/Examples/GIFPlot/Lib/gif.c deleted file mode 100644 index a0cfca1d5..000000000 --- a/Examples/GIFPlot/Lib/gif.c +++ /dev/null @@ -1,668 +0,0 @@ - -/********************************************************************** - * GIFPlot 0.0 - * - * Dave Beazley - * - * Department of Computer Science Theoretical Division (T-11) - * University of Utah Los Alamos National Laboratory - * Salt Lake City, Utah 84112 Los Alamos, New Mexico 87545 - * beazley@cs.utah.edu beazley@lanl.gov - * - * Copyright (c) 1996 - * The Regents of the University of California and the University of Utah - * All Rights Reserved - * - * Permission is hereby granted, without written agreement and without - * license or royalty fees, to use, copy, modify, and distribute this - * software and its documentation for any purpose, provided that - * (1) The above copyright notice and the following two paragraphs - * appear in all copies of the source code and (2) redistributions - * including binaries reproduces these notices in the supporting - * documentation. Substantial modifications to this software may be - * copyrighted by their authors and need not follow the licensing terms - * described here, provided that the new terms are clearly indicated in - * all files where they apply. - * - * IN NO EVENT SHALL THE AUTHOR, THE UNIVERSITY OF CALIFORNIA, THE - * UNIVERSITY OF UTAH OR DISTRIBUTORS OF THIS SOFTWARE BE LIABLE TO ANY - * PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL - * DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, - * EVEN IF THE AUTHORS OR ANY OF THE ABOVE PARTIES HAVE BEEN ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - * - * THE AUTHOR, THE UNIVERSITY OF CALIFORNIA, AND THE UNIVERSITY OF UTAH - * SPECIFICALLY DISCLAIM ANY WARRANTIES,INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND - * THE AUTHORS AND DISTRIBUTORS HAVE NO OBLIGATION TO PROVIDE MAINTENANCE, - * SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. - * - **************************************************************************/ - -/******************************************************************* - * Creates a GIF format file. - * - * Dave Beazley (T-11) - * August 11, 1995 - * - * Rather than writing directly to files, this module fills out - * output buffer. - * - * Note : To save memory, this routine uses approximately 50K of the - * output buffer as temporary storage (for hash tables and compression codes). - * The remainder of the output buffer is used to store the final image. - * This feature allows GIF images to be created with no additional - * memory overhead. - * - * -- Revision History - * $Log$ - * Revision 1.2 2003/09/01 16:23:31 beazley - * Restored the 'mojo'. - * - * Revision 1.2 1996/09/25 22:39:30 dmb - * Fixed prototypes and use of void pointers for compatibility with the Cray T3D - * - * Revision 1.1 1996/09/10 17:44:00 dmb - * Initial revision - * - * Revision 1.2 1995/08/31 14:46:07 beazley - * Minor changes to support comments and a few bug fixes. - * - * - ******************************************************************/ - - -/* - * xvgifwr.c - handles writing of GIF files. based on flgife.c and - * flgifc.c from the FBM Library, by Michael Maudlin - * - * Contains: - * WriteGIF(fp, pic, ptype, w, h, rmap, gmap, bmap, numcols, colorstyle, - * comment) - * - * Note: slightly brain-damaged, in that it'll only write non-interlaced - * GIF files (in the interests of speed, or something) - * - */ - - - -/***************************************************************** - * Portions of this code Copyright (C) 1989 by Michael Mauldin. - * Permission is granted to use this file in whole or in - * part for any purpose, educational, recreational or commercial, - * provided that this copyright notice is retained unchanged. - * This software is available to all free of charge by anonymous - * FTP and in the UUNET archives. - * - * - * Authors: Michael Mauldin (mlm@cs.cmu.edu) - * David Rowley (mgardi@watdcsu.waterloo.edu) - * - * Based on: compress.c - File compression ala IEEE Computer, June 1984. - * - * Spencer W. Thomas (decvax!harpo!utah-cs!utah-gr!thomas) - * Jim McKie (decvax!mcvax!jim) - * Steve Davies (decvax!vax135!petsd!peora!srd) - * Ken Turkowski (decvax!decwrl!turtlevax!ken) - * James A. Woods (decvax!ihnp4!ames!jaw) - * Joe Orost (decvax!vax135!petsd!joe) - *****************************************************************/ - -#include "gifplot.h" -#include -typedef long int count_int; -typedef unsigned char byte; - -static int gif_error; -static unsigned char *op; -static int Width, Height; -static int curx, cury; -static int Interlace; - -static void putgifword(int); -static void compress(int, byte **, int); -static void output_GIF(int); -static void cl_block(void); -static void cl_hash(count_int); -static void char_init(void); -static void char_out(int); -static void flush_char(void); -static void *OutBuffer; -static int OutBufSize; -static FrameBuffer *GIF_frame; - -static unsigned char pc2nc[256],r1[256],g1[256],b1[256]; - -/*************************************************************/ -int FrameBuffer_makeGIF(FrameBuffer *f, ColorMap *c, void *outbuffer, unsigned int outbufsize) -{ - int RWidth, RHeight; - int LeftOfs, TopOfs; - int ColorMapSize, InitCodeSize, Background, BitsPerPixel; - int i,j,nc; - char *rmap, *gmap, *bmap; - char *cmap; - int count; - - Interlace = 0; - Background = 0; - OutBuffer = outbuffer; - OutBufSize = outbufsize; - GIF_frame = f; - cmap = (char *) c->cmap; - - op = (unsigned char *) outbuffer; - gif_error = 0; - for (i=0; i<256; i++) { pc2nc[i] = r1[i] = g1[i] = b1[i] = 0; } - - /* compute number of unique colors */ - nc = 0; - rmap = &cmap[0]; - gmap = &cmap[256]; - bmap = &cmap[512]; - - for (i=0; i<256; i++) { - /* see if color #i is already used */ - for (j=0; j= nc) break; - - BitsPerPixel = i; - - ColorMapSize = 1 << BitsPerPixel; - - RWidth = Width = f->width; - RHeight = Height = f->height; - LeftOfs = TopOfs = 0; - - if (BitsPerPixel <= 1) InitCodeSize = 2; - else InitCodeSize = BitsPerPixel; - - curx = 0; - cury = f->height - 1; - - strcpy((char *) op,"GIF89a"); /* Put in GIF magic number */ - op+=6; - putgifword(RWidth); /* screen descriptor */ - putgifword(RHeight); - - i = 0x80; /* Yes, there is a color map */ - i |= (8-1)<<4; /* OR in the color resolution (hardwired 8) */ - i |= (BitsPerPixel - 1); /* OR in the # of bits per pixel */ - *(op++) = i; - *(op++) = Background; /* background color */ - *(op++) = 0; - for (i=0; ipixels, f->width*f->height); - - *(op++) = 0; - *(op++) = ';'; - - count = (op - (unsigned char *) OutBuffer); - if (gif_error) return -1; - else return count; -} - -/******************************/ -static void putgifword(w) -int w; -{ - /* writes a 16-bit integer in GIF order (LSB first) */ - *(op++) = w & 0xff; - *(op++) = (w>>8)&0xff; -} - -/***********************************************************************/ - - -static unsigned long cur_accum = 0; -static int cur_bits = 0; - - - - -#define GP_BITS 12 /* BITS was already defined on some systems */ - -#define HSIZE 5003 /* 80% occupancy */ - -typedef unsigned char char_type; - -static int n_bits; /* number of bits/code */ -static int maxbits = GP_BITS; /* user settable max # bits/code */ -static int maxcode; /* maximum code, given n_bits */ -static int maxmaxcode = 1 << GP_BITS; /* NEVER generate this */ - -#define MAXCODE(n_bits) ( (1 << (n_bits)) - 1) - -static count_int *htab; -static unsigned short *codetab; -static GIFOutBufSize; - -/* static count_int htab [HSIZE]; -static unsigned short codetab [HSIZE]; */ - -#define HashTabOf(i) htab[i] -#define CodeTabOf(i) codetab[i] - -static int hsize = HSIZE; /* for dynamic table sizing */ - -/* - * To save much memory, we overlay the table used by compress() with those - * used by decompress(). The tab_prefix table is the same size and type - * as the codetab. The tab_suffix table needs 2**BITS characters. We - * get this from the beginning of htab. The output stack uses the rest - * of htab, and contains characters. There is plenty of room for any - * possible stack (stack used to be 8000 characters). - */ - -#define tab_prefixof(i) CodeTabOf(i) -#define tab_suffixof(i) ((char_type *)(htab))[i] -#define de_stack ((char_type *)&tab_suffixof(1<= GIF_frame->width) { - curx = 0; - cury--; - } - len--; - - hshift = 0; - for ( fcode = (long) hsize; fcode < 65536L; fcode *= 2L ) - hshift++; - hshift = 8 - hshift; /* set hash code range bound */ - - hsize_reg = hsize; - cl_hash( (count_int) hsize_reg); /* clear hash table */ - - output_GIF(ClearCode); - while (len) { - c = pc2nc[data[cury][curx]]; - curx++; - if (curx >= GIF_frame->width) { - curx = 0; - cury--; - } - len--; - - fcode = (long) ( ( (long) c << maxbits) + ent); - i = (((int) c << hshift) ^ ent); /* xor hashing */ - - if ( HashTabOf (i) == fcode ) { - ent = CodeTabOf (i); - continue; - } - - if ( (long)HashTabOf (i) < 0 ) /* empty slot */ - goto nomatch; - - disp = hsize_reg - i; /* secondary hash (after G. Knott) */ - if ( i == 0 ) - disp = 1; - -probe: - if ( (i -= disp) < 0 ) - i += hsize_reg; - - if ( HashTabOf (i) == fcode ) { - ent = CodeTabOf (i); - continue; - } - - if ( (long)HashTabOf (i) >= 0 ) - goto probe; - -nomatch: - output_GIF(ent); - out_count++; - ent = c; - - if ( free_ent < maxmaxcode ) { - CodeTabOf (i) = free_ent++; /* code -> hashtable */ - HashTabOf (i) = fcode; - } - else - cl_block(); - - } - /* Put out the final code */ - output_GIF(ent); - output_GIF(EOFCode); -} - - -/***************************************************************** - * TAG( output_GIF ) - * - * Output the given code. - * Inputs: - * code: A n_bits-bit integer. If == -1, then EOF. This assumes - * that n_bits =< (long)wordsize - 1. - * Outputs: - * Outputs code to the file. - * Assumptions: - * Chars are 8 bits long. - * Algorithm: - * Maintain a BITS character long buffer (so that 8 codes will - * fit in it exactly). Use the VAX insv instruction to insert each - * code in turn. When the buffer fills up empty it and start over. - */ - -static -unsigned long masks[] = { 0x0000, 0x0001, 0x0003, 0x0007, 0x000F, - 0x001F, 0x003F, 0x007F, 0x00FF, - 0x01FF, 0x03FF, 0x07FF, 0x0FFF, - 0x1FFF, 0x3FFF, 0x7FFF, 0xFFFF }; - -static void output_GIF(code) -int code; -{ - cur_accum &= masks[cur_bits]; - - if (cur_bits > 0) - cur_accum |= ((long)code << cur_bits); - else - cur_accum = code; - - cur_bits += n_bits; - - while( cur_bits >= 8 ) { - char_out( (int) (cur_accum & 0xff) ); - cur_accum >>= 8; - cur_bits -= 8; - } - - /* - * If the next entry is going to be too big for the code size, - * then increase it, if possible. - */ - - if (free_ent > maxcode || clear_flg) { - - if( clear_flg ) { - maxcode = MAXCODE (n_bits = g_init_bits); - clear_flg = 0; - } - else { - n_bits++; - if ( n_bits == maxbits ) - maxcode = maxmaxcode; - else - maxcode = MAXCODE(n_bits); - } - } - - if( code == EOFCode ) { - /* At EOF, write the rest of the buffer */ - while( cur_bits > 0 ) { - char_out( (int)(cur_accum & 0xff) ); - cur_accum >>= 8; - cur_bits -= 8; - } - - flush_char(); - } -} - - -/********************************/ -static void cl_block () /* table clear for block compress */ -{ - /* Clear out the hash table */ - - cl_hash ( (count_int) hsize ); - free_ent = ClearCode + 2; - clear_flg = 1; - - output_GIF(ClearCode); -} - - -/********************************/ -static void cl_hash(hsize) /* reset code table */ -register count_int hsize; -{ - register count_int *htab_p = htab+hsize; - register long i; - register long m1 = -1; - - i = hsize - 16; - do { /* might use Sys V memset(3) here */ - *(htab_p-16) = m1; - *(htab_p-15) = m1; - *(htab_p-14) = m1; - *(htab_p-13) = m1; - *(htab_p-12) = m1; - *(htab_p-11) = m1; - *(htab_p-10) = m1; - *(htab_p-9) = m1; - *(htab_p-8) = m1; - *(htab_p-7) = m1; - *(htab_p-6) = m1; - *(htab_p-5) = m1; - *(htab_p-4) = m1; - *(htab_p-3) = m1; - *(htab_p-2) = m1; - *(htab_p-1) = m1; - htab_p -= 16; - } while ((i -= 16) >= 0); - - for ( i += 16; i > 0; i-- ) - *--htab_p = m1; -} - - -/****************************************************************************** - * - * GIF Specific routines - * - ******************************************************************************/ - -/* - * Number of characters so far in this 'packet' - */ -static int a_count; - -/* - * Set up the 'byte output' routine - */ -static void char_init() -{ - a_count = 0; -} - -/* - * Define the storage for the packet accumulator - */ -static char accum[ 256 ]; - -/* - * Add a character to the end of the current packet, and if it is 254 - * characters, flush the packet to disk. - */ -static void char_out(c) -int c; -{ - accum[ a_count++ ] = c; - if( a_count >= 254 ) - flush_char(); -} - -/* - * Flush the packet to disk, and reset the accumulator - */ -static void flush_char() -{ - if (gif_error) return; - if( a_count > 0 ) { - *(op++) = a_count; - memcpy(op,accum,a_count); - op+=a_count; - a_count = 0; - - if (op > (unsigned char *) ((char *) OutBuffer + (GIFOutBufSize - 2048))) { - gif_error = 1; - } - } -} - - -/* ---------------------------------------------------------------------- - int FrameBuffer_writeGIF(char *filename) - - Write a GIF file to filename - ----------------------------------------------------------------------- */ - -int FrameBuffer_writeGIF(FrameBuffer *f, ColorMap *c, char *filename) { - - FILE *file; - void *buffer; - int nbytes; - int bufsize; - - file = fopen(filename,"wb"); - if (file == NULL) return -1; - - bufsize = (f->width*f->height*3)/2; - buffer = (void *) malloc(bufsize); - nbytes = FrameBuffer_makeGIF(f,c,buffer,bufsize); - if (nbytes == -1) { - free(buffer); - fclose(file); - return -1; - } - fwrite(buffer,nbytes,1,file); - fclose(file); - free(buffer); - return 0; -} - - - - - diff --git a/Examples/GIFPlot/Lib/matrix.c b/Examples/GIFPlot/Lib/matrix.c deleted file mode 100644 index ef0cf3aab..000000000 --- a/Examples/GIFPlot/Lib/matrix.c +++ /dev/null @@ -1,343 +0,0 @@ -/* ----------------------------------------------------------------------------- - * matrix.c - * - * Some 4x4 matrix operations - * - * Author(s) : David Beazley (beazley@cs.uchicago.edu) - * Copyright (C) 1995-1996 - * - * See the file LICENSE for information on usage and redistribution. - * ----------------------------------------------------------------------------- */ - -#define MATRIX -#include "gifplot.h" -#include - -/* ------------------------------------------------------------------------ - Matrix new_Matrix() - - Create a new 4x4 matrix. - ------------------------------------------------------------------------ */ -Matrix -new_Matrix() { - Matrix m; - m = (Matrix) malloc(16*sizeof(double)); - return m; -} - -/* ------------------------------------------------------------------------ - delete_Matrix(Matrix *m); - - Destroy a matrix - ------------------------------------------------------------------------ */ - -void -delete_Matrix(Matrix m) { - if (m) - free((char *) m); -} - -/* ------------------------------------------------------------------------ - Matrix Matrix_copy(Matrix a) - - Makes a copy of matrix a and returns it. - ------------------------------------------------------------------------ */ - -Matrix Matrix_copy(Matrix a) { - int i; - Matrix r = 0; - if (a) { - r = new_Matrix(); - if (r) { - for (i = 0; i < 16; i++) - r[i] = a[i]; - } - } - return r; -} - -/* ------------------------------------------------------------------------ - Matrix_multiply(Matrix a, Matrix b, Matrix c) - - Multiplies a*b = c - c may be one of the source matrices - ------------------------------------------------------------------------ */ -void -Matrix_multiply(Matrix a, Matrix b, Matrix c) { - double temp[16]; - int i,j,k; - - for (i =0; i < 4; i++) - for (j = 0; j < 4; j++) { - temp[i*4+j] = 0.0; - for (k = 0; k < 4; k++) - temp[i*4+j] += a[i*4+k]*b[k*4+j]; - } - for (i = 0; i < 16; i++) - c[i] = temp[i]; -} - -/* ------------------------------------------------------------------------ - Matrix_identity(Matrix a) - - Puts an identity matrix in matrix a - ------------------------------------------------------------------------ */ - -void -Matrix_identity(Matrix a) { - int i; - for (i = 0; i < 16; i++) a[i] = 0; - a[0] = 1; - a[5] = 1; - a[10] = 1; - a[15] = 1; -} - -/* ------------------------------------------------------------------------ - Matrix_zero(Matrix a) - - Puts a zero matrix in matrix a - ------------------------------------------------------------------------ */ -void -Matrix_zero(Matrix a) { - int i; - for (i = 0; i < 16; i++) a[i] = 0; -} - -/* ------------------------------------------------------------------------ - Matrix_transpose(Matrix a, Matrix result) - - Transposes matrix a and puts it in result. - ------------------------------------------------------------------------ */ -void -Matrix_transpose(Matrix a, Matrix result) { - double temp[16]; - int i,j; - - for (i = 0; i < 4; i++) - for (j = 0; j < 4; j++) - temp[4*i+j] = a[4*j+i]; - - for (i = 0; i < 16; i++) - result[i] = temp[i]; -} - - -/* ------------------------------------------------------------------------ - Matrix_gauss(Matrix a, Matrix b) - - Solves ax=b for x, using Gaussian elimination. Destroys a. - Really only used for calculating inverses of 4x4 transformation - matrices. - ------------------------------------------------------------------------ */ - -void Matrix_gauss(Matrix a, Matrix b) { - int ipiv[4], indxr[4], indxc[4]; - int i,j,k,l,ll; - int irow=0, icol=0; - double big, pivinv; - double dum; - for (j = 0; j < 4; j++) - ipiv[j] = 0; - for (i = 0; i < 4; i++) { - big = 0; - for (j = 0; j < 4; j++) { - if (ipiv[j] != 1) { - for (k = 0; k < 4; k++) { - if (ipiv[k] == 0) { - if (fabs(a[4*j+k]) >= big) { - big = fabs(a[4*j+k]); - irow = j; - icol = k; - } - } else if (ipiv[k] > 1) - return; /* Singular matrix */ - } - } - } - ipiv[icol] = ipiv[icol]+1; - if (irow != icol) { - for (l = 0; l < 4; l++) { - dum = a[4*irow+l]; - a[4*irow+l] = a[4*icol+l]; - a[4*icol+l] = dum; - } - for (l = 0; l < 4; l++) { - dum = b[4*irow+l]; - b[4*irow+l] = b[4*icol+l]; - b[4*icol+l] = dum; - } - } - indxr[i] = irow; - indxc[i] = icol; - if (a[4*icol+icol] == 0) return; - pivinv = 1.0/a[4*icol+icol]; - a[4*icol+icol] = 1.0; - for (l = 0; l < 4; l++) - a[4*icol+l] = a[4*icol+l]*pivinv; - for (l = 0; l < 4; l++) - b[4*icol+l] = b[4*icol+l]*pivinv; - for (ll = 0; ll < 4; ll++) { - if (ll != icol) { - dum = a[4*ll+icol]; - a[4*ll+icol] = 0; - for (l = 0; l < 4; l++) - a[4*ll+l] = a[4*ll+l] - a[4*icol+l]*dum; - for (l = 0; l < 4; l++) - b[4*ll+l] = b[4*ll+l] - b[4*icol+l]*dum; - } - } - } - for (l = 3; l >= 0; l--) { - if (indxr[l] != indxc[l]) { - for (k = 0; k < 4; k++) { - dum = a[4*k+indxr[l]]; - a[4*k+indxr[l]] = a[4*k+indxc[l]]; - a[4*k+indxc[l]] = dum; - } - } - } -} - -/* ------------------------------------------------------------------------ - Matrix_invert(Matrix a, Matrix inva) - - Inverts Matrix a and places the result in inva. - Relies on the Gaussian Elimination code above. (See Numerical recipes). - ------------------------------------------------------------------------ */ -void -Matrix_invert(Matrix a, Matrix inva) { - - double temp[16]; - int i; - - for (i = 0; i < 16; i++) - temp[i] = a[i]; - Matrix_identity(inva); - Matrix_gauss(temp,inva); -} - -/* ------------------------------------------------------------------------ - Matrix_transform(Matrix a, GL_Vector *r, GL_Vector *t) - - Transform a vector. a*r ----> t - ------------------------------------------------------------------------ */ - -void Matrix_transform(Matrix a, GL_Vector *r, GL_Vector *t) { - - double rx, ry, rz, rw; - - rx = r->x; - ry = r->y; - rz = r->z; - rw = r->w; - t->x = a[0]*rx + a[1]*ry + a[2]*rz + a[3]*rw; - t->y = a[4]*rx + a[5]*ry + a[6]*rz + a[7]*rw; - t->z = a[8]*rx + a[9]*ry + a[10]*rz + a[11]*rw; - t->w = a[12]*rx + a[13]*ry + a[14]*rz + a[15]*rw; -} - -/* ------------------------------------------------------------------------ - Matrix_transform4(Matrix a, double x, double y, double z, double w, GL_Vector *t) - - Transform a vector from a point specified as 4 doubles - ------------------------------------------------------------------------ */ - -void Matrix_transform4(Matrix a, double rx, double ry, double rz, double rw, - GL_Vector *t) { - - t->x = a[0]*rx + a[1]*ry + a[2]*rz + a[3]*rw; - t->y = a[4]*rx + a[5]*ry + a[6]*rz + a[7]*rw; - t->z = a[8]*rx + a[9]*ry + a[10]*rz + a[11]*rw; - t->w = a[12]*rx + a[13]*ry + a[14]*rz + a[15]*rw; -} - -/* --------------------------------------------------------------------- - Matrix_translate(Matrix a, double tx, double ty, double tz) - - Put a translation matrix in Matrix a - ---------------------------------------------------------------------- */ - -void Matrix_translate(Matrix a, double tx, double ty, double tz) { - Matrix_identity(a); - a[3] = tx; - a[7] = ty; - a[11] = tz; - a[15] = 1; -} - -/* ----------------------------------------------------------------------- - Matrix_rotatex(Matrix a, double deg) - - Produce an x-rotation matrix for given angle in degrees. - ----------------------------------------------------------------------- */ -void -Matrix_rotatex(Matrix a, double deg) { - double r; - - r = 3.1415926*deg/180.0; - Matrix_zero(a); - a[0] = 1.0; - a[5] = cos(r); - a[6] = -sin(r); - a[9] = sin(r); - a[10] = cos(r); - a[15] = 1.0; -} - -/* ----------------------------------------------------------------------- - Matrix_rotatey(Matrix a, double deg) - - Produce an y-rotation matrix for given angle in degrees. - ----------------------------------------------------------------------- */ -void -Matrix_rotatey(Matrix a, double deg) { - double r; - - r = 3.1415926*deg/180.0; - Matrix_zero(a); - a[0] = cos(r); - a[2] = sin(r); - a[5] = 1.0; - a[8] = -sin(r); - a[10] = cos(r); - a[15] = 1; - -} -/* ----------------------------------------------------------------------- - Matrix_RotateZ(Matrix a, double deg) - - Produce an z-rotation matrix for given angle in degrees. - ----------------------------------------------------------------------- */ -void -Matrix_rotatez(Matrix a, double deg) { - double r; - - r = 3.1415926*deg/180.0; - Matrix_zero(a); - a[0] = cos(r); - a[1] = -sin(r); - a[4] = sin(r); - a[5] = cos(r); - a[10] = 1.0; - a[15] = 1.0; -} - - -/* A debugging routine */ - -void Matrix_set(Matrix a, int i, int j, double val) { - a[4*j+i] = val; -} - -void Matrix_print(Matrix a) { - int i,j; - for (i = 0; i < 4; i++) { - for (j = 0; j < 4; j++) { - fprintf(stdout,"%10f ",a[4*i+j]); - } - fprintf(stdout,"\n"); - } - fprintf(stdout,"\n"); -} - diff --git a/Examples/GIFPlot/Lib/pixmap.c b/Examples/GIFPlot/Lib/pixmap.c deleted file mode 100644 index a55cf041f..000000000 --- a/Examples/GIFPlot/Lib/pixmap.c +++ /dev/null @@ -1,159 +0,0 @@ -/* ----------------------------------------------------------------------------- - * pixmap.c - * - * Pixel maps (i.e., bitmaps) - * - * Author(s) : David Beazley (beazley@cs.uchicago.edu) - * Copyright (C) 1995-1996 - * - * See the file LICENSE for information on usage and redistribution. - * ----------------------------------------------------------------------------- */ - -#define PIXMAP -#include "gifplot.h" - -/* ----------------------------------------------------------------------- - PixMap *new_PixMap(int width, int height, int centerx, int centery) - - Create a new pixmap of given size - ----------------------------------------------------------------------- */ -PixMap *new_PixMap(int width, int height, int centerx, int centery) { - PixMap *pm; - if ((width > 0) && (height > 0)) { - pm = (PixMap *) malloc(sizeof(PixMap)); - pm->width = width; - pm->height = height; - pm->centerx = centerx; - pm->centery = centery; - pm->map = (int *) malloc(height*width*sizeof(int)); - return pm; - } - return (PixMap *) 0; -} - -/* -------------------------------------------------------------------------- - void delete_PixMap(PixMap *pm) - - Destroy a pixmap - -------------------------------------------------------------------------- */ - -void delete_PixMap(PixMap *pm) { - if (pm) { - free((char *) pm->map); - free((char *) pm); - } -} - -/* --------------------------------------------------------------------------- - void PixMap_set(PixMap *pm, int x, int y, int pix) - - Set a pixel in the bitmap - --------------------------------------------------------------------------- */ -void -PixMap_set(PixMap *pm, int x, int y, int pix) { - if ((x < 0) || (x>=pm->width)) return; - if ((y < 0) || (y>=pm->height)) return; - - pm->map[pm->width*y + x] = pix; -} - -/* ----------------------------------------------------------------------------- - void FrameBuffer_drawpixmap(FrameBuffer *f, PixMap *pm, int x, int y, int fgcolor, int bgcolor) - - Draw a pixmap onto the framebuffer. This is somewhat optimized for speed. - ------------------------------------------------------------------------------ */ - -void -FrameBuffer_drawpixmap(FrameBuffer *f, PixMap *pm, int x, int y, int fgcolor, int bgcolor) { - - int startx, starty; /* Starting location on framebuffer */ - int startpixx = 0, startpixy = 0; /* Starting location in pixmap */ - int endx, endy; /* Ending location on framebuffer */ - int i,j, px, py; - int c; - - startx = x - pm->centerx; - starty = y + pm->centery; - endx = startx + pm->width; - endy = starty - pm->height; - - /* Figure out if we need to clip */ - - if (startx < f->xmin) { - startpixx = f->xmin - startx; - startx = f->xmin; - } - if (starty >= f->ymax) { - startpixy = starty - f->ymax; - starty = f->ymax-1; - } - if (endx >= f->xmax) { - endx = f->xmax-1; - } - if (endy < f->ymin) { - endy = f->ymin; - } - py = startpixy; - for (j = starty; j >= endy; j--) { - px = startpixx; - for (i = startx; i < endx; i++) { - c = pm->map[py*pm->width + px]; - switch (c) { - case GIFPLOT_FOREGROUND: - f->pixels[j][i] = fgcolor; - break; - case GIFPLOT_BACKGROUND: - f->pixels[j][i] = bgcolor; - break; - default: - break; - } - px++; - } - py++; - } -} - -/************************************************************************** - * Some common PixMaps (for plotting) - * - **************************************************************************/ - -int _SQUARE_MAP[] = { - 0,1,1,1,1,1,1,1, - 0,1,1,1,1,1,1,1, - 0,1,1,1,1,1,1,1, - 0,1,1,1,1,1,1,1, - 0,1,1,1,1,1,1,1, - 0,1,1,1,1,1,1,1, - 0,1,1,1,1,1,1,1, - 0,0,0,0,0,0,0,0 }; - -PixMap PixMap_SQUARE = { 8,8,4,4, _SQUARE_MAP}; - -int _TRIANGLE_MAP[] = { - 0,0,0,1,0,0,0,0, - 0,0,0,1,0,0,0,0, - 0,0,1,1,1,0,0,0, - 0,0,1,1,1,0,0,0, - 0,1,1,1,1,1,0,0, - 0,1,1,1,1,1,0,0, - 1,1,1,1,1,1,1,0, - 0,0,0,0,0,0,0,0 }; - -PixMap PixMap_TRIANGLE = { 8,8,4,4,_TRIANGLE_MAP}; - -int _CROSS_MAP[] = { - 0,0,0,1,0,0,0,0, - 0,0,0,1,0,0,0,0, - 0,0,0,1,0,0,0,0, - 1,1,1,1,1,1,1,0, - 0,0,0,1,0,0,0,0, - 0,0,0,1,0,0,0,0, - 0,0,0,1,0,0,0,0, - 0,0,0,0,0,0,0,0 }; - -PixMap PixMap_CROSS = { 8,8,4,4,_CROSS_MAP}; - - - diff --git a/Examples/GIFPlot/Lib/plot2d.c b/Examples/GIFPlot/Lib/plot2d.c deleted file mode 100644 index e78107bf1..000000000 --- a/Examples/GIFPlot/Lib/plot2d.c +++ /dev/null @@ -1,445 +0,0 @@ -/* ----------------------------------------------------------------------------- - * plot2d.c - * - * 2-Dimensional plotting - * - * Author(s) : David Beazley (beazley@cs.uchicago.edu) - * Copyright (C) 1995-1996 - * - * See the file LICENSE for information on usage and redistribution. - * ----------------------------------------------------------------------------- */ - -#define PLOT2D - -#include "gifplot.h" - -/* ------------------------------------------------------------------------ - Plot2D *new_Plot2D(FrameBuffer *frame, xmin, ymin, xmax, ymax) - - Create a new 2D plot with given minimum and maximum coordinates. - ------------------------------------------------------------------------ */ -Plot2D *new_Plot2D(FrameBuffer *frame,double xmin,double ymin,double xmax,double ymax) { - Plot2D *p2; - if (frame) { - if (xmax <= xmin) return (Plot2D *) 0; - if (ymax <= ymin) return (Plot2D *) 0; - p2 = (Plot2D *) malloc(sizeof(Plot2D)); - p2->frame = frame; - p2->xmin = xmin; - p2->ymin = ymin; - p2->xmax = xmax; - p2->ymax = ymax; - p2->view_xmin = 0; - p2->view_xmax = frame->width; - p2->view_ymin = 0; - p2->view_ymax = frame->height; - p2->xscale = LINEAR; - p2->yscale = LINEAR; - p2->dx = (p2->view_xmax - p2->view_xmin)/(p2->xmax - p2->xmin); - p2->dy = (p2->view_ymax - p2->view_ymin)/(p2->ymax - p2->ymin); - return p2; - } - return (Plot2D *) 0; -} - -/* ---------------------------------------------------------------------------- - delete_Plot2D(Plot2D *p2) - - Delete a 2D plot - ---------------------------------------------------------------------------- */ -void -delete_Plot2D(Plot2D *p2) { - if (p2) - free((char *) p2); -} - -/* ----------------------------------------------------------------------------- - Plot2D *Plot2D_copy(Plot2D *p2) - - Makes a copy of the Plot2D data structure. - ----------------------------------------------------------------------------- */ - -Plot2D *Plot2D_copy(Plot2D *p2) { - Plot2D *c2; - if (p2) { - c2 = (Plot2D *) malloc(sizeof(Plot2D)); - if (c2) { - c2->frame = p2->frame; - c2->view_xmin = p2->view_xmin; - c2->view_ymin = p2->view_ymin; - c2->view_xmax = p2->view_xmax; - c2->view_ymax = p2->view_ymax; - c2->xmin = p2->xmin; - c2->ymin = p2->ymin; - c2->xmax = p2->xmax; - c2->ymax = p2->ymax; - c2->xscale = p2->xscale; - c2->yscale = p2->yscale; - c2->dx = p2->dx; - c2->dy = p2->dy; - } - return c2; - } else { - return (Plot2D *) 0; - } -} - -/* ----------------------------------------------------------------------------- - Plot2D_clear(Plot2D *p2, Pixel c) - - Clear the region assigned to this plot to the given color. - -------------------------------------------------------------------------- */ - -void Plot2D_clear(Plot2D *p2, Pixel c) { - int i,j; - for (i = p2->view_xmin; i < p2->view_xmax; i++) - for (j = p2->view_ymin; j < p2->view_ymax; j++) { - p2->frame->pixels[j][i] = c; - } -} - -/* ------------------------------------------------------------------------------ - Plot2D_setview - - Sets the plot region on the framebuffer - ------------------------------------------------------------------------------ */ - -void -Plot2D_setview(Plot2D *p2, int vxmin, int vymin, int vxmax, int vymax) { - if (p2) { - p2->view_xmin = vxmin; - p2->view_ymin = vymin; - p2->view_xmax = vxmax; - p2->view_ymax = vymax; - p2->dx = (p2->view_xmax - p2->view_xmin)/(p2->xmax - p2->xmin); - p2->dy = (p2->view_ymax - p2->view_ymin)/(p2->ymax - p2->ymin); - FrameBuffer_setclip(p2->frame,vxmin,vymin,vxmax,vymax); - } -} - -/* ------------------------------------------------------------------------------- - Plot2D_setrange(Plot2D *p2, double xmin, double ymin, double xmax, double ymax) - - Sets the plotting range. - ------------------------------------------------------------------------------- */ - -void -Plot2D_setrange(Plot2D *p2, double xmin, double ymin, double xmax, double ymax) { - if (p2) { - p2->xmin = xmin; - p2->ymin = ymin; - p2->xmax = xmax; - p2->ymax = ymax; - p2->dx = (p2->view_xmax - p2->view_xmin)/(p2->xmax - p2->xmin); - p2->dy = (p2->view_ymax - p2->view_ymin)/(p2->ymax - p2->ymin); - } -} - -/* ------------------------------------------------------------------------------- - Plot2D_setscale(Plot2D *p2, int xscale, int yscale) - - Sets the plotting scaling method - ------------------------------------------------------------------------------- */ - -void -Plot2D_setscale(Plot2D *p2, int xscale, int yscale) { - if (p2) { - p2->xscale = xscale; - p2->yscale = yscale; - } -} - -/* ---------------------------------------------------------------------------- - Plot2D_transform(Plot2D *p2, double x, double y, int *px, int *py) - - Transforms x,y into screen coordinates px and py. Result is returned - in px and py. Rounds to the nearest pixel instead of truncating. - ----------------------------------------------------------------------------- */ - -void -Plot2D_transform(Plot2D *p2, double x, double y, int *px, int *py) { - if (p2) { - *px = p2->view_xmin + (int) (p2->dx*(x-p2->xmin) + 0.5); - *py = p2->view_ymin + (int) (p2->dy*(y-p2->ymin) + 0.5); - } -} - -/* ------------------------------------------------------------------------------- - Plot2D_plot(Plot2D *p2, double x, double y, Pixel color) - - Plot a 2D Point of a given color - ------------------------------------------------------------------------------- */ -void -Plot2D_plot(Plot2D *p2, double x, double y, Pixel color) { - int px, py; - - Plot2D_transform(p2,x,y,&px,&py); - FrameBuffer_plot(p2->frame, px, py, color); -} - -/* ------------------------------------------------------------------------------- - Plot2D_box(Plot2D *p2, double x1, double y1, double x2, double y2, Pixel Color) - - Plot an outline box on the 2D plot - ------------------------------------------------------------------------------- */ -void -Plot2D_box(Plot2D *p2, double x1, double y1,double x2, double y2, Pixel color) { - int ix1, ix2,iy1, iy2; - - Plot2D_transform(p2,x1,y1,&ix1,&iy1); - Plot2D_transform(p2,x2,y2,&ix2,&iy2); - FrameBuffer_box(p2->frame,ix1,iy1,ix2,iy2,color); -} - -/* ------------------------------------------------------------------------------- - Plot2D_solidbox(Plot2D *p2, double x1, double y1, double x2, double y2, Pixel Color) - - Plot a solid box box on the 2D plot - ------------------------------------------------------------------------------- */ -void -Plot2D_solidbox(Plot2D *p2, double x1, double y1,double x2, double y2, Pixel color) { - int ix1, ix2,iy1, iy2; - - Plot2D_transform(p2,x1,y1,&ix1,&iy1); - Plot2D_transform(p2,x2,y2,&ix2,&iy2); - FrameBuffer_solidbox(p2->frame,ix1,iy1,ix2,iy2,color); -} - -/* ------------------------------------------------------------------------------- - Plot2D_interpbox(Plot2D *p2, double x1, double y1, double x2, double y2, - Pixel c1, Pixel c2, Pixel c3, Pixel c4) - - Plot a color-interpolated box on the 2D plot - ------------------------------------------------------------------------------- */ -void -Plot2D_interpbox(Plot2D *p2, double x1, double y1,double x2, double y2, - Pixel c1, Pixel c2, Pixel c3, Pixel c4) { - int ix1, ix2,iy1, iy2; - - Plot2D_transform(p2,x1,y1,&ix1,&iy1); - Plot2D_transform(p2,x2,y2,&ix2,&iy2); - FrameBuffer_interpbox(p2->frame,ix1,iy1,ix2,iy2,c1,c2,c3,c4); -} - -/* ------------------------------------------------------------------------------- - Plot2D_circle(Plot2D *p2, double x, double y, double radius, Pixel color) - - Make an outline circle on the 2D plot. - ------------------------------------------------------------------------------- */ -void -Plot2D_circle(Plot2D *p2, double x, double y, double radius, Pixel color) { - int ix, iy, ir; - - Plot2D_transform(p2,x,y,&ix,&iy); - ir = p2->dx * radius; /* This is really incorrect. Will need ellipse */ - if (ir > 1) - FrameBuffer_circle(p2->frame,ix,iy,ir,color); - else - FrameBuffer_plot(p2->frame,ix,iy,color); - -} - -/* ------------------------------------------------------------------------------- - Plot2D_solidcircle(Plot2D *p2, double x, double y, double radius, Pixel color) - - Make an solid circle on the 2D plot. - ------------------------------------------------------------------------------- */ -void -Plot2D_solidcircle(Plot2D *p2, double x, double y, double radius, Pixel color) { - int ix, iy, ir; - - Plot2D_transform(p2,x,y,&ix,&iy); - ir = p2->dx * radius; /* This is really incorrect. Will need ellipse */ - if (ir > 1) - FrameBuffer_solidcircle(p2->frame,ix,iy,ir,color); - else - FrameBuffer_plot(p2->frame,ix,iy,color); -} - -/* ------------------------------------------------------------------------------- - Plot2D_line(Plot2D *p2, double x1, double y1, double x2, double y2, Pixel color) - - Draw a line - ------------------------------------------------------------------------------- */ - -void -Plot2D_line(Plot2D *p2, double x1, double y1, double x2, double y2, Pixel color) { - int ix1, ix2, iy1, iy2; - - Plot2D_transform(p2,x1,y1,&ix1,&iy1); - Plot2D_transform(p2,x2,y2,&ix2,&iy2); - FrameBuffer_line(p2->frame,ix1,iy1,ix2,iy2,color); -} - - - -/* ------------------------------------------------------------------------------- - Plot2D_start(Plot2D *p2) - - This should be called before starting to make a 2D plot. It will change - the viewport coordinates for the framebuffer and do other stuff. - ------------------------------------------------------------------------------- */ - -void Plot2D_start(Plot2D *p2) { - if (p2) { - FrameBuffer_setclip(p2->frame, p2->view_xmin,p2->view_ymin,p2->view_xmax, p2->view_ymax); - p2->dx = (p2->view_xmax - p2->view_xmin)/(p2->xmax - p2->xmin); - p2->dy = (p2->view_ymax - p2->view_ymin)/(p2->ymax - p2->ymin); - } -} - -/* -------------------------------------------------------------------------- - void Plot2D_drawpixmap(Plot2D *p2, PixMap *pm, double x, double y, Pixel color, Pixel bgcolor) - - Draw a pixel map at the given coordinates. (Used for putting symbols on 2D - plots). - -------------------------------------------------------------------------- */ -void -Plot2D_drawpixmap(Plot2D *p2, PixMap *pm, double x, double y, Pixel color, Pixel bgcolor) { - int ix, iy; - - Plot2D_transform(p2,x,y,&ix,&iy); - FrameBuffer_drawpixmap(p2->frame,pm,ix,iy,color,bgcolor); -} - -/* ---------------------------------------------------------------------------- - void Plot2D_xaxis(Plot2D *p2, double x, double y, double xtick, int ticklength, Pixel color) - - Draw an X axis bar at location x,y with ticks spaced every xtick units. - Ticks are spaced starting at "x" - ----------------------------------------------------------------------------- */ - -void Plot2D_xaxis(Plot2D *p2, double x, double y, double xtick, int ticklength, Pixel color) { - int ix, iy,iy2; - double xt; - - /* Draw a line fox the axis */ - - Plot2D_line(p2,p2->xmin,y,p2->xmax,y,color); - xt = x; - while (xt >= p2->xmin) { - Plot2D_transform(p2,xt,y,&ix,&iy); - iy2 = iy+ticklength; - iy = iy-ticklength; - FrameBuffer_line(p2->frame,ix,iy,ix,iy2,color); - xt = xt - xtick; - } - xt = x + xtick; - while (xt < p2->xmax) { - Plot2D_transform(p2,xt,y,&ix,&iy); - iy2 = iy+ticklength; - iy = iy-ticklength; - FrameBuffer_line(p2->frame,ix,iy,ix,iy2,color); - xt = xt + xtick; - } -} - - -/* ---------------------------------------------------------------------------- - void Plot2D_yaxis(Plot2D *p2, double x, double y, double ytick, int ticklength, Pixel c) - - Draw an Y axis bar at location x,y with ticks spaced every xtick units. - Ticks are spaced starting at "y" - ----------------------------------------------------------------------------- */ - -void Plot2D_yaxis(Plot2D *p2, double x, double y, double ytick, int ticklength, Pixel color) { - int ix, iy, ix2; - double yt; - - /* Draw a line fox the axis */ - - Plot2D_line(p2,x,p2->ymin,x,p2->ymax,color); - yt = y; - while (yt >= p2->ymin) { - Plot2D_transform(p2,x,yt,&ix,&iy); - ix2 = ix+ticklength; - ix = ix-ticklength; - FrameBuffer_line(p2->frame,ix,iy,ix2,iy,color); - yt = yt - ytick; - } - yt = y + ytick; - while (yt < p2->ymax) { - Plot2D_transform(p2,x,yt,&ix,&iy); - ix2 = ix+ticklength; - ix = ix-ticklength; - FrameBuffer_line(p2->frame,ix,iy,ix2,iy,color); - yt = yt + ytick; - } -} - - -/* ------------------------------------------------------------------------- - Plot2D_triangle(Plot2D *p2, double x1, double y1, - double x2, double y2, - double x3, double y3, - Pixel fillcolor) - - This function draws a 2D outline triangle. - -------------------------------------------------------------------------- */ - -void Plot2D_triangle(Plot2D *p2, double x1, double y1, - double x2, double y2, - double x3, double y3, Pixel color) { - - Plot2D_line(p2,x1,y1,x2,y2,color); - Plot2D_line(p2,x2,y2,x3,y3,color); - Plot2D_line(p2,x3,y3,x1,y1,color); - -} - - -/* ------------------------------------------------------------------------- - Plot2D_solidtriangle(Plot2D *p2, double x1, double y1, - double x2, double y2, - double x3, double y3, - Pixel color) - - This function draws a 2D filled triangle. Can be used to - draw other primitives such as quadralaterals, etc... - - -------------------------------------------------------------------------- */ - -void Plot2D_solidtriangle(Plot2D *p2, double x1, double y1, - - double x2, double y2, - double x3, double y3, Pixel color) { - - int tx1, tx2, tx3, ty1, ty2, ty3; - - /* Transform the three points into screen coordinates */ - - Plot2D_transform(p2,x1,y1,&tx1,&ty1); - Plot2D_transform(p2,x2,y2,&tx2,&ty2); - Plot2D_transform(p2,x3,y3,&tx3,&ty3); - - FrameBuffer_solidtriangle(p2->frame,tx1,ty1,tx2,ty2,tx3,ty3,color); - -} - -/* ------------------------------------------------------------------------- - Plot2D_interptriangle(Plot2D *p2, double x1, double y1, Pixel c1, - double x2, double y2, Pixel c2, - double x3, double y3, Pixel c3); - - This function draws a 2D filled triangle with color interpolation. - Can be used to draw other primitives such as quadralaterals, etc... - -------------------------------------------------------------------------- */ - -void Plot2D_interptriangle(Plot2D *p2, double x1, double y1, Pixel c1, - double x2, double y2, Pixel c2, - double x3, double y3, Pixel c3) { - - int tx1, tx2, tx3, ty1, ty2, ty3; - - /* Transform the three points into screen coordinates */ - - Plot2D_transform(p2,x1,y1,&tx1,&ty1); - Plot2D_transform(p2,x2,y2,&tx2,&ty2); - Plot2D_transform(p2,x3,y3,&tx3,&ty3); - - FrameBuffer_interptriangle(p2->frame,tx1,ty1,c1,tx2,ty2,c2,tx3,ty3,c3); - -} - - - diff --git a/Examples/GIFPlot/Lib/plot3d.c b/Examples/GIFPlot/Lib/plot3d.c deleted file mode 100644 index 387e420e2..000000000 --- a/Examples/GIFPlot/Lib/plot3d.c +++ /dev/null @@ -1,2181 +0,0 @@ -/* ----------------------------------------------------------------------------- - * plot3d.c - * - * Three-dimensional plotting. - * - * Author(s) : David Beazley (beazley@cs.uchicago.edu) - * Copyright (C) 1995-1996 - * - * See the file LICENSE for information on usage and redistribution. - * ----------------------------------------------------------------------------- */ - -#define PLOT3D -#include "gifplot.h" -#include -#include - -#define ORTHO 1 -#define PERSPECTIVE 2 -/* ------------------------------------------------------------------------ - Plot3D *new_Plot3D(FrameBuffer *f, double xmin, double ymin, double zmin, - double xmax, double ymax, double zmax) - - Creates a new 3D plot. Min and max coordinates are primarily used to - pick some default parameters. Returns NULL on failure - ------------------------------------------------------------------------- */ - -Plot3D *new_Plot3D(FrameBuffer *f, double xmin, double ymin, double zmin, - double xmax, double ymax, double zmax) { - - Plot3D *p3; - void Plot3D_maketransform(Plot3D *p3); - - /* Check to make sure the framebuffer and min/max parameters are valid */ - - if (!f) return (Plot3D *) 0; - if ((xmin > xmax) || (ymin > ymax) || (zmin > zmax)) return (Plot3D *) 0; - - p3 = (Plot3D *) malloc(sizeof(Plot3D)); - p3->frame = f; - p3->xmin = xmin; - p3->ymin = ymin; - p3->zmin = zmin; - p3->xmax = xmax; - p3->ymax = ymax; - p3->zmax = zmax; - - /* Set view region to the entire size of the framebuffer */ - - p3->view_xmin = 0; - p3->view_ymin = 0; - p3->view_xmax = f->width; - p3->view_ymax = f->height; - p3->width = f->width; - p3->height = f->height; - - /* Calculate a center point based off the min and max coordinates given */ - - p3->xcenter = (xmax - xmin)/2.0 + xmin; - p3->ycenter = (ymax - ymin)/2.0 + ymin; - p3->zcenter = (zmax - zmin)/2.0 + zmin; - - /* Calculate the aspect ratio of the viewing region */ - - p3->aspect = (double) f->width/(double) f->height; - - /* Set default view parameters */ - p3->xshift = 1.0; - p3->yshift = 1.0; - p3->zoom = 0.5; - p3->fovy = 40.0; /* 40 degree field of view */ - - /* Create matrices */ - - p3->model_mat = new_Matrix(); - p3->view_mat = new_Matrix(); - p3->center_mat = new_Matrix(); - p3->fullmodel_mat = new_Matrix(); - p3->trans_mat = new_Matrix(); - p3->pers_mode = ORTHO; - - FrameBuffer_zresize(p3->frame,p3->width, p3->height); - Matrix_identity(p3->view_mat); - Matrix_identity(p3->model_mat); - Matrix_translate(p3->center_mat, -p3->xcenter,-p3->ycenter,-p3->zcenter); - Plot3D_maketransform(p3); - return p3; -} - -/* --------------------------------------------------------------------- - delete_Plot3D(Plot3D *p3) - - Deletes a 3D plot - --------------------------------------------------------------------- */ - -void delete_Plot3D(Plot3D *p3) { - if (p3) { - delete_Matrix(p3->view_mat); - delete_Matrix(p3->model_mat); - delete_Matrix(p3->trans_mat); - free((char *) p3); - } -} - -/* --------------------------------------------------------------------- - Plot3D *Plot3D_copy(Plot3D *p3) - - This makes a copy of the 3D plot structure and returns a pointer to it. - --------------------------------------------------------------------- */ - -Plot3D *Plot3D_copy(Plot3D *p3) { - Plot3D *c3; - if (p3) { - c3 = (Plot3D *) malloc(sizeof(Plot3D)); - if (c3) { - c3->frame = p3->frame; - c3->view_xmin = p3->view_xmin; - c3->view_ymin = p3->view_ymin; - c3->view_xmax = p3->view_xmax; - c3->view_ymax = p3->view_ymax; - c3->xmin = p3->xmin; - c3->ymin = p3->ymin; - c3->zmin = p3->zmin; - c3->xmax = p3->xmax; - c3->ymax = p3->ymax; - c3->zmax = p3->zmax; - c3->xcenter = p3->xcenter; - c3->ycenter = p3->ycenter; - c3->zcenter = p3->zcenter; - c3->fovy = p3->fovy; - c3->aspect = p3->aspect; - c3->znear = p3->znear; - c3->zfar = p3->zfar; - c3->center_mat = Matrix_copy(p3->center_mat); - c3->model_mat = Matrix_copy(p3->model_mat); - c3->view_mat = Matrix_copy(p3->view_mat); - c3->fullmodel_mat = Matrix_copy(p3->fullmodel_mat); - c3->trans_mat = Matrix_copy(p3->trans_mat); - c3->lookatz = p3->lookatz; - c3->xshift = p3->xshift; - c3->yshift = p3->yshift; - c3->zoom = p3->zoom; - c3->width = p3->width; - c3->height = p3->height; - c3->pers_mode = p3->pers_mode; - } - return c3; - } else { - return (Plot3D *) 0; - } -} - -/* ---------------------------------------------------------------------- - Plot3D_clear(Plot3D *p3, Pixel bgcolor) - - Clear the pixel and zbuffer only for the view region of this image. - ---------------------------------------------------------------------- */ -void -Plot3D_clear(Plot3D *p3, Pixel bgcolor) { - int i,j; - - for (i = p3->view_xmin; i < p3->view_xmax; i++) - for (j = p3->view_ymin; j < p3->view_ymax; j++) { - p3->frame->pixels[j][i] = bgcolor; - p3->frame->zbuffer[j][i] = ZMIN; - } -} - -/* --------------------------------------------------------------------- - Plot3D_maketransform(Plot3D *p3) - - This function builds the total 3D transformation matrix from a - collection of components. - - Trans = View * Rotation * Center - - Where View is the viewing transformation matrix, Rotation is the - model rotation matrix, Center is the translation matrix used to - center the Model at the origin. - --------------------------------------------------------------------- */ - -void -Plot3D_maketransform(Plot3D *p3) { - - Matrix_multiply(p3->model_mat,p3->center_mat, p3->fullmodel_mat); - Matrix_multiply(p3->view_mat,p3->fullmodel_mat, p3->trans_mat); -} - -/* --------------------------------------------------------------------- - Plot3D_perspective(Plot3D *p3, double fovy, double znear, double zfar) - - Sets up the perspective viewing transformation. Assumes "lookat" - has already been called. - --------------------------------------------------------------------- */ - -void -Plot3D_perspective(Plot3D *p3, double fovy, double znear, double zfar) { - double theta; - double mat[16]; - - p3->fovy = fovy; - p3->znear = znear; - p3->zfar = zfar; - - theta = 3.1415926*fovy/180.0; - - Matrix_identity(mat); - mat[0] = cos(theta/2.0)/(sin(theta/2.0)*p3->aspect); - mat[5] = cos(theta/2.0)/(sin(theta/2.0)); - mat[10] = -(zfar + znear)/(zfar-znear); - mat[14] = -1.0; - mat[11] = -(2*zfar*znear)/(zfar - znear); - mat[15] = 0.0; - - /* Update the view transformation matrix */ - - Matrix_multiply(mat,p3->view_mat,p3->view_mat); - - /* Update the global transformation matrix */ - - Plot3D_maketransform(p3); - p3->pers_mode = PERSPECTIVE; - -} - -/* --------------------------------------------------------------------- - Plot3D_lookat(Plot3D *p3, double z) - - A greatly simplified version of (lookat). Specifies the position - of the viewpoint. (can be used for moving image in or out). - - Destroys the current viewing transformation matrix, so it will have - to be recalculated. - --------------------------------------------------------------------- */ - -void -Plot3D_lookat(Plot3D *p3, double z) { - if (p3) { - Matrix_translate(p3->view_mat, 0,0,-z); - p3->lookatz = z; - Plot3D_maketransform(p3); - } -} - -/* ------------------------------------------------------------------------- - Plot3D_autoperspective(Plot3D *p3, double fovy) - - Automatically figures out a semi-decent viewpoint given the - min,max parameters currently set for this image - ------------------------------------------------------------------------- */ - -void -Plot3D_autoperspective(Plot3D *p3, double fovy) { - - /* Make a perspective transformation matrix for this system */ - - double zfar; - double znear; - double d, dmax; - double cx,cy,cz; - double xmin,xmax,ymin,ymax,zmin,zmax; - - xmin = p3->xmin; - ymin = p3->ymin; - zmin = p3->zmin; - xmax = p3->xmax; - ymax = p3->ymax; - zmax = p3->zmax; - cx = p3->xcenter; - cy = p3->ycenter; - cz = p3->zcenter; - - /* Calculate longest point from center point */ - - dmax = (xmin-cx)*(xmin-cx) + (ymin-cy)*(ymin-cy) + (zmin-cz)*(zmin-cz); - d = (xmax-cx)*(xmax-cx) + (ymin-cy)*(ymin-cy) + (zmin-cz)*(zmin-cz); - if (d > dmax) dmax = d; - d = (xmin-cx)*(xmin-cx) + (ymax-cy)*(ymax-cy) + (zmin-cz)*(zmin-cz); - if (d > dmax) dmax = d; - d = (xmax-cx)*(xmax-cx) + (ymax-cy)*(ymax-cy) + (zmin-cz)*(zmin-cz); - if (d > dmax) dmax = d; - d = (xmin-cx)*(xmin-cx) + (ymin-cy)*(ymin-cy) + (zmax-cz)*(zmax-cz); - if (d > dmax) dmax = d; - d = (xmax-cx)*(xmax-cx) + (ymin-cy)*(ymin-cy) + (zmax-cz)*(zmax-cz); - if (d > dmax) dmax = d; - d = (xmin-cx)*(xmin-cx) + (ymax-cy)*(ymax-cy) + (zmax-cz)*(zmax-cz); - if (d > dmax) dmax = d; - d = (xmax-cx)*(xmax-cx) + (ymax-cy)*(ymax-cy) + (zmax-cz)*(zmax-cz); - if (d > dmax) dmax = d; - - dmax = sqrt(dmax); - d = p3->lookatz; - - znear = d - dmax; - zfar = znear+1.5*dmax; - Plot3D_perspective(p3, fovy,znear,zfar); - -} - - -/* --------------------------------------------------------------------- - Plot3D_ortho(Plot3D *p3, double left, double right, double bottom, double top) - - Sets up an orthographic viewing transformation. - --------------------------------------------------------------------- */ - -void -Plot3D_ortho(Plot3D *p3, double left, double right, double bottom, double top) { - - - Matrix_identity(p3->view_mat); - p3->view_mat[0] = (2.0/(right - left))/p3->aspect; - p3->view_mat[5] = 2.0/(top - bottom); - p3->view_mat[10] = -1; - p3->view_mat[15] = 1.0; - p3->view_mat[3] = -(right+left)/(right-left); - p3->view_mat[7] = -(top+bottom)/(top-bottom); - - /* Update the global transformation matrix */ - - Plot3D_maketransform(p3); - p3->pers_mode = ORTHO; - p3->ortho_left = left; - p3->ortho_right = right; - p3->ortho_bottom = bottom; - p3->ortho_top = top; - -} - -/* --------------------------------------------------------------------- - Plot3D_autoortho(Plot3D *p3) - - Automatically pick an orthographic projection that's probably - pretty good. - --------------------------------------------------------------------- */ - -void -Plot3D_autoortho(Plot3D *p3) { - - /* Make a perspective transformation matrix for this system */ - - double d, dmax; - double cx,cy,cz; - double xmin,xmax,ymin,ymax,zmin,zmax; - - xmin = p3->xmin; - ymin = p3->ymin; - zmin = p3->zmin; - xmax = p3->xmax; - ymax = p3->ymax; - zmax = p3->zmax; - cx = p3->xcenter; - cy = p3->ycenter; - cz = p3->zcenter; - - /* Calculate longest point from center point */ - - dmax = (xmin-cx)*(xmin-cx) + (ymin-cy)*(ymin-cy) + (zmin-cz)*(zmin-cz); - d = (xmax-cx)*(xmax-cx) + (ymin-cy)*(ymin-cy) + (zmin-cz)*(zmin-cz); - if (d > dmax) dmax = d; - d = (xmin-cx)*(xmin-cx) + (ymax-cy)*(ymax-cy) + (zmin-cz)*(zmin-cz); - if (d > dmax) dmax = d; - d = (xmax-cx)*(xmax-cx) + (ymax-cy)*(ymax-cy) + (zmin-cz)*(zmin-cz); - if (d > dmax) dmax = d; - d = (xmin-cx)*(xmin-cx) + (ymin-cy)*(ymin-cy) + (zmax-cz)*(zmax-cz); - if (d > dmax) dmax = d; - d = (xmax-cx)*(xmax-cx) + (ymin-cy)*(ymin-cy) + (zmax-cz)*(zmax-cz); - if (d > dmax) dmax = d; - d = (xmin-cx)*(xmin-cx) + (ymax-cy)*(ymax-cy) + (zmax-cz)*(zmax-cz); - if (d > dmax) dmax = d; - d = (xmax-cx)*(xmax-cx) + (ymax-cy)*(ymax-cy) + (zmax-cz)*(zmax-cz); - if (d > dmax) dmax = d; - - dmax = sqrt(dmax); - - Plot3D_ortho(p3,-dmax,dmax,-dmax,dmax); - -} - - - -/* ------------------------------------------------------------------------- - Plot3D_setview(Plot3D *p3, int vxmin, int vymin, int vxmax, int vymax) - - Sets the viewport for this 3D graph. Will recalculate all of the - local viewing transformation matrices accordingly. - ------------------------------------------------------------------------- */ -void -Plot3D_setview(Plot3D *p3, int vxmin, int vymin, int vxmax, int vymax) { - if (p3) { - if ((vxmin > vxmax) || (vymin >vymax)) return; - p3->view_xmin = vxmin; - p3->view_ymin = vymin; - p3->view_xmax = vxmax; - p3->view_ymax = vymax; - p3->width = (vxmax - vxmin); - p3->height = (vymax - vymin); - p3->aspect = (double) p3->width/(double) p3->height; - - /* Fix up the viewing transformation matrix */ - - if (p3->pers_mode == PERSPECTIVE) { - Plot3D_lookat(p3,p3->lookatz); - Plot3D_perspective(p3,p3->fovy,p3->znear,p3->zfar); - } else { - Plot3D_ortho(p3,p3->ortho_left,p3->ortho_right,p3->ortho_bottom, p3->ortho_top); - } - FrameBuffer_setclip(p3->frame,vxmin,vymin,vxmax,vymax); - } -} - -/* --------------------------------------------------------------------------- - Plot2D_start(Plot2D *p3) - - Set up viewing region and other parameters for this image. - --------------------------------------------------------------------------- */ - -void -Plot3D_start(Plot3D *p3) { - if (p3) - FrameBuffer_setclip(p3->frame, p3->view_xmin,p3->view_ymin,p3->view_xmax, p3->view_ymax); - -} - -/* ------------------------------------------------------------------------- - Plot3D_plot(Plot3D *p3, double x, double y, double z, Pixel Color) - - Plot a 3D point - ------------------------------------------------------------------------- */ - -void -Plot3D_plot(Plot3D *p3, double x, double y, double z, Pixel color) { - - GL_Vector t; - int ix, iy; - double invw; - FrameBuffer *f; - - /* Perform a transformation */ - - Matrix_transform4(p3->trans_mat,x,y,z,1,&t); - - /* Scale the coordinates into unit cube */ - - invw = 1.0/t.w; - t.x = t.x *invw; - t.y = t.y *invw; - t.z = t.z *invw; -#ifdef GL_DEBUG - fprintf(stdout,"t.x = %g, t.y = %g, t.z = %g\n", t.x,t.y,t.z); -#endif - /* Calculate the x and y coordinates */ - - ix = (int) ((t.x +p3->xshift)*p3->zoom*p3->width + 0.5); - iy = (int) ((t.y +p3->yshift)*p3->zoom*p3->height + 0.5); - - if ((ix >= 0) && (ix < p3->width) && - (iy >= 0) && (ix < p3->height)) { - ix += p3->view_xmin; - iy += p3->view_ymin; - f = p3->frame; - if (t.z <= f->zbuffer[iy][ix]) { - f->pixels[iy][ix] = color; - f->zbuffer[iy][ix] = t.z; - } - } -} - -/* ---------------------------------------------------------------------- - Plot3D_rotx(Plot3D *p3, double deg) - - Rotate the model around its x axis. - ---------------------------------------------------------------------- */ - -void -Plot3D_rotx(Plot3D *p3, double deg) { - double temp[16]; - - Matrix_rotatex(temp,deg); /* Construct a x rotation matrix */ - Matrix_multiply(p3->model_mat,temp,p3->model_mat); - Plot3D_maketransform(p3); - -} - -/* ---------------------------------------------------------------------- - Plot3D_roty(Plot3D *p3, double deg) - - Rotate the model around its y axis. - ---------------------------------------------------------------------- */ - -void -Plot3D_roty(Plot3D *p3, double deg) { - double temp[16]; - - Matrix_rotatey(temp,deg); /* Construct a y rotation matrix */ - Matrix_multiply(p3->model_mat,temp,p3->model_mat); - Plot3D_maketransform(p3); - -} - -/* ---------------------------------------------------------------------- - Plot3D_rotz(Plot3D *p3, double deg) - - Rotate the model around its z axis. - ---------------------------------------------------------------------- */ - -void -Plot3D_rotz(Plot3D *p3, double deg) { - double temp[16]; - - Matrix_rotatez(temp,deg); /* Construct a z rotation matrix */ - Matrix_multiply(p3->model_mat,temp,p3->model_mat); - Plot3D_maketransform(p3); - -} - - -/* ---------------------------------------------------------------------- - Plot3D_rotd(Plot3D *p3, double deg) - - Rotate the model down - ---------------------------------------------------------------------- */ - -void -Plot3D_rotd(Plot3D *p3, double deg) { - double temp[16]; - - Matrix_rotatex(temp,deg); /* Construct a x rotation matrix */ - Matrix_multiply(temp, p3->model_mat,p3->model_mat); - Plot3D_maketransform(p3); - -} - - -/* ---------------------------------------------------------------------- - Plot3D_rotu(Plot3D *p3, double deg) - - Rotate the model up - ---------------------------------------------------------------------- */ - -void -Plot3D_rotu(Plot3D *p3, double deg) { - double temp[16]; - - Matrix_rotatex(temp,-deg); /* Construct a x rotation matrix */ - Matrix_multiply(temp,p3->model_mat,p3->model_mat); - Plot3D_maketransform(p3); - -} - - -/* ---------------------------------------------------------------------- - Plot3D_rotr(Plot3D *p3, double deg) - - Rotate the model down - ---------------------------------------------------------------------- */ - -void -Plot3D_rotr(Plot3D *p3, double deg) { - double temp[16]; - - Matrix_rotatey(temp,deg); /* Construct a y rotation matrix */ - Matrix_multiply(temp, p3->model_mat,p3->model_mat); - Plot3D_maketransform(p3); - -} - - -/* ---------------------------------------------------------------------- - Plot3D_rotl(Plot3D *p3, double deg) - - Rotate the model left - ---------------------------------------------------------------------- */ - -void -Plot3D_rotl(Plot3D *p3, double deg) { - double temp[16]; - - Matrix_rotatey(temp,-deg); /* Construct a y rotation matrix */ - Matrix_multiply(temp,p3->model_mat,p3->model_mat); - Plot3D_maketransform(p3); - -} - - -/* ---------------------------------------------------------------------- - Plot3D_rotc(Plot3D *p3, double deg) - - Rotate the model around center point - ---------------------------------------------------------------------- */ - -void -Plot3D_rotc(Plot3D *p3, double deg) { - double temp[16]; - - Matrix_rotatez(temp,-deg); /* Construct a z rotation matrix */ - Matrix_multiply(temp,p3->model_mat,p3->model_mat); - Plot3D_maketransform(p3); -} - -/* ------------------------------------------------------------------------- - Plot3D_zoom(Plot3D *p3, double percent) - - Zooms in or out the current image. percent defines a percentage of - zoom. - - Zooming is actually done by adjusting the perspective field of view - instead of scaling the model or moving in the viewpoint. This - seems to work the best. - ------------------------------------------------------------------------- */ - -void -Plot3D_zoom(Plot3D *p3, double percent) { - - double scale; - double dx; - if (percent <= 0) return; - scale = percent/100.0; - - dx = (1.0/scale - 1.0)/(2*p3->zoom); /* Don't even ask where this came from */ - p3->xshift += dx; - p3->yshift += dx; - p3->zoom = p3->zoom*scale; - -#ifdef OLD - p3->fovy = p3->fovy*scale; - if (p3->fovy > 170.0) p3->fovy = 170.0; - if (p3->fovy == 0) p3->fovy = 0.0001; - Plot3D_lookat(p3,p3->lookatz); - Plot3D_perspective(p3,p3->fovy,p3->znear,p3->zfar); -#endif -} - -/* -------------------------------------------------------------------------- - Plot3D_left(Plot3D *p3, double s) - - Shifts the image to the left by s units. This is a little funky. - - s is scaled so that s = 100 equals one full screen. - -------------------------------------------------------------------------- */ -void -Plot3D_left(Plot3D *p3, double s) { - p3->xshift -= (s/100.0)/p3->zoom; -} - -/* -------------------------------------------------------------------------- - Plot3D_right(Plot3D *p3, double s) - - Shifts the image to the right by s units. - - s is scaled so that s = 100 equals one full screen. - -------------------------------------------------------------------------- */ -void -Plot3D_right(Plot3D *p3, double s) { - p3->xshift += (s/100.0)/p3->zoom; -} - -/* -------------------------------------------------------------------------- - Plot3D_up(Plot3D *p3, double s) - - Shifts the image up left by s units. - - s is scaled so that s = 100 equals one full screen. - -------------------------------------------------------------------------- */ -void -Plot3D_up(Plot3D *p3, double s) { - p3->yshift += (s/100.0)/p3->zoom; -} - -/* -------------------------------------------------------------------------- - Plot3D_down(Plot3D *p3, double s) - - Shifts the image down by s units. - - s is scaled so that s = 100 equals one full screen. - -------------------------------------------------------------------------- */ -void -Plot3D_down(Plot3D *p3, double s) { - p3->yshift -= (s/100.0)/p3->zoom; -} - -/* ------------------------------------------------------------------------- - Plot3D_center(Plot3D *p3, double cx, double cy) - - Centers the image on a point in the range (0,0) - (100,100) - ------------------------------------------------------------------------- */ -void -Plot3D_center(Plot3D *p3, double cx, double cy) { - Plot3D_left(p3,cx-50); - Plot3D_down(p3,cy-50); -} - - - -/*************************************************************************** - * 3d Primitives * - ***************************************************************************/ - -/* ------------------------------------------------------------------------- - Plot3D_horizontal(Plot3D *p3, int xmin, int xmax, int y, double z1, double z2, Pixel color) - - Draws a "Horizontal" line on the framebuffer between two screen coordinates, - but also supplies z-values and zbuffering. This function probably isn't - too useful by itself, but will be used by a number of other primitives. - -------------------------------------------------------------------------- */ - -void Plot3D_horizontal(Plot3D *p3, int xmin, int xmax, int y, Zvalue z1, Zvalue z2, Pixel color) { - Pixel *p; - FrameBuffer *f; - int i; - Zvalue *zbuf,z,mz; - int startx, endx; - - f = p3->frame; - if ((y < f->ymin) || (y >= f->ymax)) return; - if (xmin > f->xmax) return; - if (xmin < f->xmin) startx = f->xmin; - else startx = xmin; - if (xmax < f->xmin) return; - if (xmax >= f->xmax) endx = f->xmax - 1; - else endx = xmax; - - /* Calculate z slope */ - - if (xmax != xmin) { - mz = (Zvalue) ((double) (z2 - z1)/(double) (xmax - xmin)); - } else { - mz = 0; - } - - /* Draw it */ - - p = &f->pixels[y][startx]; - zbuf = &f->zbuffer[y][startx]; - z = (Zvalue) (mz*(startx-xmin) + z1); - for (i = startx; i <= endx; i++, p++, zbuf++,z+=mz) { - if (z <= *zbuf) { - *p = color; - *zbuf = z; - } - } -} - - -/* ------------------------------------------------------------------------- - Plot3D_vertical(Plot3D *p3, int ymin, int ymax, int x, double z1, double z2, Pixel color) - - Draws a "Vertical" line on the framebuffer between two screen coordinates, - but also supplies z-values and zbuffering. This function probably isn't - too useful by itself, but will be used by a number of other primitives. - -------------------------------------------------------------------------- */ - -void Plot3D_vertical(Plot3D *p3, int ymin, int ymax, int x, Zvalue z1, Zvalue z2, Pixel color) { - Pixel *p; - FrameBuffer *f; - int i; - Zvalue *zbuf,z,mz; - int starty, endy; - - f = p3->frame; - if ((x < f->xmin) || (x >= f->xmax)) return; - if (ymin >= f->ymax) return; - if (ymin < f->ymin) starty = f->ymin; - else starty = ymin; - if (ymax < f->ymin) return; - if (ymax >= f->ymax) endy = f->ymax - 1; - else endy = ymax; - - /* Calculate z slope */ - - mz = (double) (z2 - z1)/(double) (ymax - ymin); - - /* Draw it */ - - p = &f->pixels[starty][x]; - zbuf = &f->zbuffer[starty][x]; - for (i = starty; i <= endy; i++, p+=f->width, zbuf+=f->width) { - z = (Zvalue) (mz*(i-ymin) + z1); - if (z <= *zbuf) { - *p = color; - *zbuf = z; - } - } -} - -/* ------------------------------------------------------------------------------- - Plot3D_linetransform(Plot3D *p3, int x1, int y1, Zvalue z1, - int x2, int y2, Zvalue z2, Pixel c) - - Draw a 3D line between points that have already been transformed into - 3D space. - - Uses a Bresenham line algorithm, but with linear interpolation between - Zvalues. - ------------------------------------------------------------------------------- */ - -void -Plot3D_linetransform(Plot3D *p3, int x1, int y1, Zvalue z1, int x2, int y2, Zvalue z2, Pixel c) { - - int orig_x1, orig_y1, orig_x2,orig_y2; - Zvalue zt; - - /* Bresenham line drawing parameters */ - FrameBuffer *f; - int dx,dy,dxneg,dyneg, inc1,inc2,di; - int x, y, xpixels, ypixels, xt, yt; - Pixel *p; - double m; - int end1 = 0, end2 = 0; - Zvalue *zbuf,mz,z; - - f = p3->frame; - - /* Need to figure out where in the heck this line is */ - - dx = x2 - x1; - dy = y2 - y1; - - if ((dx == 0) && (dy == 0)) { - if ((x1 < f->xmin) || (x1 >= f->xmax) || - (y1 < f->ymin) || (y1 >= f->ymax)) return; - if (z1 <= f->zbuffer[y1][x1]) { - f->pixels[y1][x1] = c; - } - return; - } - if (dx == 0) { - /* Draw a Vertical Line */ - if (y1 < y2) - Plot3D_vertical(p3,y1,y2,x1,z1,z2,c); - else - Plot3D_vertical(p3,y2,y1,x1,z2,z1,c); - return; - } - if (dy == 0) { - /* Draw a Horizontal Line */ - if (x1 < x2) - Plot3D_horizontal(p3,x1,x2,y1,z1,z2,c); - else - Plot3D_horizontal(p3,x2,x1,y1,z2,z1,c); - return; - } - - /* Figure out where in the heck these lines are using the - Cohen-Sutherland Line Clipping Scheme. */ - - end1 = ((x1 - f->xmin) < 0) | - (((f->xmax- 1 - x1) < 0) << 1) | - (((y1 - f->ymin) < 0) << 2) | - (((f->ymax-1 - y1) < 0) << 3); - - end2 = ((x2 - f->xmin) < 0) | - (((f->xmax-1 - x2) < 0) << 1) | - (((y2 - f->ymin) < 0) << 2) | - (((f->ymax-1 - y2) < 0) << 3); - - if (end1 & end2) return; /* Nope : Not visible */ - - /* Make sure points have a favorable orientation */ - - if (x1 > x2) { - xt = x1; - x1 = x2; - x2 = xt; - yt = y1; - y1 = y2; - y2 = yt; - zt = z1; - z1 = z2; - z2 = zt; - } - - /* Save original points before we clip them off */ - orig_x1 = x1; - orig_y1 = y1; - orig_x2 = x2; - orig_y2 = y2; - - /* Clip against the boundaries */ - m = (y2 - y1)/(double) (x2-x1); - if (x1 < f->xmin) { - y1 = (f->xmin - x1)*m + y1; - x1 = f->xmin; - } - if (x2 >= f->xmax) { - y2 = (f->xmax -1 -x1)*m + y1; - x2 = f->xmax - 1; - } - - if (y1 > y2) { - xt = x1; - x1 = x2; - x2 = xt; - yt = y1; - y1 = y2; - y2 = yt; - zt = z1; - z1 = z2; - z2 = zt; - - /* Swap original points */ - - xt = orig_x1; - orig_x1 = orig_x2; - orig_x2 = xt; - yt = orig_y1; - orig_y1 = orig_y2; - orig_y2 = yt; - } - - m = 1/m; - if (y1 < f->ymin) { - x1 = (f->ymin - y1)*m + x1; - y1 = f->ymin; - } - if (y2 >= f->ymax) { - x2 = (f->ymax-1-y1)*m + x1; - y2 = f->ymax-1; - } - - if ((x1 < f->xmin) || (x1 >= f->xmax) || (y1 < f->ymin) || (y1 >= f->ymax) || - (x2 < f->xmin) || (x2 >= f->xmax) || (y2 < f->ymin) || (y2 >= f->ymax)) return; - - dx = x2 - x1; - dy = y2 - y1; - xpixels = f->width; - ypixels = f->height; - - dxneg = (dx < 0) ? 1 : 0; - dyneg = (dy < 0) ? 1 : 0; - - dx = abs(dx); - dy = abs(dy); - if (dx >= dy) { - /* Slope between -1 and 1. */ - mz = (z2 - z1)/(orig_x2 - orig_x1); /* Z interpolation slope */ - if (dxneg) { - x = x1; - y = y1; - x1 = x2; - y1 = y2; - x2 = x; - y2 = y; - dyneg = !dyneg; - } - inc1 = 2*dy; - inc2 = 2*(dy-dx); - di = 2*dy-dx; - - /* Draw a line using x as independent variable */ - - p = &f->pixels[y1][x1]; - zbuf = &f->zbuffer[y1][x1]; - x = x1; - while (x <= x2) { - /* Do a z-buffer check */ - z = mz*(x-orig_x1)+z1; - if (z <= *zbuf){ - *p = c; - *zbuf = z; - } - p++; - zbuf++; - if (di < 0) { - di = di + inc1; - } else { - if (dyneg) { - p = p - xpixels; - zbuf = zbuf - xpixels; - di = di + inc2; - } else { - p = p + xpixels; - zbuf = zbuf + xpixels; - di = di + inc2; - } - } - x++; - } - } else { - /* Slope < -1 or > 1 */ - mz = (z2 - z1)/(double) (orig_y2 - orig_y1); - if (dyneg) { - x = x1; - y = y1; - x1 = x2; - y1 = y2; - x2 = x; - y2 = y; - dxneg = !dxneg; - } - inc1 = 2*dx; - inc2 = 2*(dx-dy); - di = 2*dx-dy; - - /* Draw a line using y as independent variable */ - - p = &f->pixels[y1][x1]; - zbuf = &f->zbuffer[y1][x1]; - y = y1; - while (y <= y2) { - /* Do a z-buffer check */ - z = mz*(y-orig_y1)+z1; - if (z <= *zbuf) { - *p = c; - *zbuf = z; - } - p = p + xpixels; - zbuf = zbuf + xpixels; - if (di < 0) { - di = di + inc1; - } else { - if (dxneg) { - p = p - 1; - zbuf = zbuf - 1; - di = di + inc2; - } else { - p = p + 1; - zbuf = zbuf + 1; - di = di + inc2; - } - } - y++; - } - } -} - -/* --------------------------------------------------------------------------- - Plot3D_line(Plot3D *p3, double x1, double y1, double z1, double x2, double y2, double z2,int color) - - Draws a line in 3D space. This is done as follows (for lack of a better - method). - - 1. The points (x1,y1,z1) and (x2,y2,z2) are transformed into screen coordinates - 2. We draw the line using a modified Bresenham line algorithm. - 3. Zbuffer values are linearly interpolated between the two points. - ---------------------------------------------------------------------------- */ - -void -Plot3D_line(Plot3D *p3, double fx1, double fy1, double fz1, double fx2, double fy2, - double fz2, Pixel c) { - - /* 3D Transformation parameters */ - GL_Vector t; - double invw; - int x1,y1,x2,y2; - Zvalue z1,z2; - - /* Transform the two points into screen coordinates */ - - Matrix_transform4(p3->trans_mat,fx1,fy1,fz1,1,&t); /* Point 1 */ - invw = 1.0/t.w; - t.x = t.x *invw; - t.y = t.y *invw; - t.z = t.z *invw; - x1 = (int) ((t.x +p3->xshift)*p3->zoom*p3->width + 0.5) + p3->view_xmin; - y1 = (int) ((t.y +p3->yshift)*p3->zoom*p3->height + 0.5) + p3->view_ymin; - z1 = t.z; - - Matrix_transform4(p3->trans_mat,fx2,fy2,fz2,1,&t); /* Point 2 */ - invw = 1.0/t.w; - t.x = t.x *invw; - t.y = t.y *invw; - t.z = t.z *invw; - x2 = (int) ((t.x +p3->xshift)*p3->zoom*p3->width + 0.5) + p3->view_xmin; - y2 = (int) ((t.y +p3->yshift)*p3->zoom*p3->height + 0.5) + p3->view_ymin; - z2 = t.z; - Plot3D_linetransform(p3,x1,y1,z1,x2,y2,z2,c); -} - - -/* ------------------------------------------------------------------------- - Plot3D_triangle(Plot3D *p3, double x1, double y1, double z1, - double x2, double y2, double z2, - double x3, double y3, double z3, - Pixel fillcolor) - - This function draws a 3D z-buffered outline triangle. - -------------------------------------------------------------------------- */ - -void Plot3D_triangle(Plot3D *p3, double x1, double y1, double z1, - double x2, double y2, double z2, - double x3, double y3, double z3, Pixel color) { - - int tx1, tx2, tx3, ty1, ty2, ty3; - Zvalue tz1, tz2, tz3; - GL_Vector t; - double invw; - - /* Transform the three points into screen coordinates */ - - Matrix_transform4(p3->trans_mat,x1,y1,z1,1,&t); /* Point 1 */ - invw = 1.0/t.w; - t.x = t.x *invw; - t.y = t.y *invw; - t.z = t.z *invw; - tx1 = (int) ((t.x +p3->xshift)*p3->zoom*p3->width + 0.5) + p3->view_xmin; - ty1 = (int) ((t.y +p3->yshift)*p3->zoom*p3->height + 0.5) + p3->view_ymin; - tz1 = (Zvalue) t.z; - - Matrix_transform4(p3->trans_mat,x2,y2,z2,1,&t); /* Point 2 */ - invw = 1.0/t.w; - t.x = t.x *invw; - t.y = t.y *invw; - t.z = t.z *invw; - tx2 = (int) ((t.x +p3->xshift)*p3->zoom*p3->width + 0.5) + p3->view_xmin; - ty2 = (int) ((t.y +p3->yshift)*p3->zoom*p3->height + 0.5) + p3->view_ymin; - tz2 = (Zvalue) t.z; - - Matrix_transform4(p3->trans_mat,x3,y3,z3,1,&t); /* Point 3 */ - invw = 1.0/t.w; - t.x = t.x *invw; - t.y = t.y *invw; - t.z = t.z *invw; - tx3 = (int) ((t.x +p3->xshift)*p3->zoom*p3->width + 0.5) + p3->view_xmin; - ty3 = (int) ((t.y +p3->yshift)*p3->zoom*p3->height + 0.5) + p3->view_ymin; - tz3 = (Zvalue) t.z; - - - Plot3D_linetransform(p3,tx1,ty1,tz1,tx2,ty2,tz2,color); - Plot3D_linetransform(p3,tx1,ty1,tz1,tx3,ty3,tz3,color); - Plot3D_linetransform(p3,tx2,ty2,tz2,tx3,ty3,tz3,color); -} - - -/* ------------------------------------------------------------------------- - Plot3D_solidtriangletransform(Plot3D *p3, int tx1, int ty2, Zvalue tz1, - int tx2, int ty2, Zvalue tz2, - int tx3, int ty3, Zvalue tz3, Pixel color) - - This function draws a 3D z-buffered filled triangle. Assumes three - points have already been transformed into screen coordinates. - - General idea : - 1. Transform the three points into screen coordinates - 2. Order three points vertically on screen. - 3. Check for degenerate cases (where 3 points are colinear). - 4. Fill in the resulting triangle using horizontal lines. - -------------------------------------------------------------------------- */ - -void Plot3D_solidtriangletransform(Plot3D *p3, int tx1, int ty1, Zvalue tz1, - int tx2, int ty2, Zvalue tz2, - int tx3, int ty3, Zvalue tz3, Pixel color) { - int tempx, tempy; - Zvalue tempz; - double m1,m2,m3, mz1, mz2, mz3; - int y; - int ix1, ix2; - Zvalue zz1, zz2; - FrameBuffer *f; - register double fy1,fy2; - register Zvalue fz1,fz2; - - f = p3->frame; - - /* Check for degenerate cases here */ - - if ((ty1 == ty2) && (ty2 == ty3)) { - if (tx2 < tx1) { /* Swap points 1 and 2 if 2 is higher */ - tempx = tx1; - tempz = tz1; - tx1 = tx2; - tz1 = tz2; - tx2 = tempx; - tz2 = tempz; - } - if (tx3 < tx1) { /* Swap points 1 and 3 if 3 is higher */ - tempx = tx1; - tempz = tz1; - tx1 = tx3; - tz1 = tz3; - tx3 = tempx; - tz3 = tempz; - } - if (tx3 < tx2) { /* Swap points 2 and 3 if 3 is higher */ - tempx = tx2; - tempz = tz2; - tx2 = tx3; - tz2 = tz3; - tx3 = tempx; - tz3 = tempz; - } - - /* Points are aligned horizontally. Handle as a special case */ - /* Just draw three lines using the outline color */ - - Plot3D_horizontal(p3,tx1,tx2,ty1,tz1,tz3,color); - - /* Plot3D_linetransform(p3,tx1,ty1,tz1,tx2,ty2,tz2,color); - Plot3D_linetransform(p3,tx1,ty1,tz1,tx3,ty3,tz3,color); - Plot3D_linetransform(p3,tx2,ty2,tz2,tx3,ty3,tz3,color); - */ - - return; - } - - /* Figure out which point has the greatest "y" value */ - - if (ty2 > ty1) { /* Swap points 1 and 2 if 2 is higher */ - tempx = tx1; - tempy = ty1; - tempz = tz1; - tx1 = tx2; - ty1 = ty2; - tz1 = tz2; - tx2 = tempx; - ty2 = tempy; - tz2 = tempz; - } - if (ty3 > ty1) { /* Swap points 1 and 3 if 3 is higher */ - tempx = tx1; - tempy = ty1; - tempz = tz1; - tx1 = tx3; - ty1 = ty3; - tz1 = tz3; - tx3 = tempx; - ty3 = tempy; - tz3 = tempz; - } - if (ty3 > ty2) { /* Swap points 2 and 3 if 3 is higher */ - tempx = tx2; - tempy = ty2; - tempz = tz2; - tx2 = tx3; - ty2 = ty3; - tz2 = tz3; - tx3 = tempx; - ty3 = tempy; - tz3 = tempz; - } - - /* Points are now order so that t_1 is the highest point, t_2 is the - middle point, and t_3 is the lowest point */ - - if (ty2 < ty1) { - /* First process line segments between (x1,y1)-(x2,y2) - And between (x1,y1),(x3,y3) */ - - m1 = (double) (tx2 - tx1)/(double) (ty2 - ty1); - m2 = (double) (tx3 - tx1)/(double) (ty3 - ty1); - mz1 = (tz2 - tz1)/(double) (ty2 - ty1); - mz2 = (tz3 - tz1)/(double) (ty3 - ty1); - - y = ty1; - fy1 = m1*(y-ty1)+0.5 + tx1; - fy2 = m2*(y-ty1)+0.5 + tx1; - fz1 = mz1*(y-ty1) + tz1; - fz2 = mz2*(y-ty1) + tz1; - while (y >= ty2) { - /* Replace with bresenham scheme */ - /* Calculate x values from slope */ - ix1 = (int) fy1; - ix2 = (int) fy2; - zz1 = fz1; - zz2 = fz2; - fy1-= m1; - fy2-= m2; - fz1-= mz1; - fz2-= mz2; - if (ix1 > ix2) - Plot3D_horizontal(p3,ix2,ix1,y,zz2,zz1,color); - else - Plot3D_horizontal(p3,ix1,ix2,y,zz1,zz2,color); - y--; - } - } - if (ty3 < ty2) { - /* Draw lower half of the triangle */ - m2 = (double) (tx3 - tx1)/(double) (ty3 - ty1); - m3 = (double) (tx3 - tx2)/(double)(ty3 - ty2); - mz2 = (tz3 - tz1)/(double) (ty3 - ty1); - mz3 = (tz3 - tz2)/(double) (ty3 - ty2); - y = ty2; - while (y >= ty3) { - ix1 = (int) (m3*(y-ty2)+0.5)+tx2; - ix2 = (int) (m2*(y-ty1)+0.5)+tx1; - zz1 = mz3*(y-ty2)+tz2; - zz2 = mz2*(y-ty1)+tz1; - if (ix1 > ix2) - Plot3D_horizontal(p3,ix2,ix1,y,zz2,zz1,color); - else - Plot3D_horizontal(p3,ix1,ix2,y,zz1,zz2,color); - y--; - } - } -} - -/* ------------------------------------------------------------------------- - Plot3D_solidtriangle(Plot3D *p3, double x1, double y1, double z1, - double x2, double y2, double z2, - double x3, double y3, double z3, - Pixel color) - - This function draws a 3D z-buffered filled triangle. Can be used to - draw other primitives such as quadralaterals, etc... - - This function simply transforms the given points and calls - Plot3D_SolidTriangleTransform(). - -------------------------------------------------------------------------- */ - -void Plot3D_solidtriangle(Plot3D *p3, double x1, double y1, double z1, - double x2, double y2, double z2, - double x3, double y3, double z3, Pixel color) { - - int tx1, tx2, tx3, ty1, ty2, ty3; - Zvalue tz1, tz2, tz3; - GL_Vector t; - double invw; - Matrix a; - register double xshift, yshift, zoom, width, height, view_xmin, view_ymin; - - a = p3->trans_mat; - xshift = p3->xshift; - yshift = p3->yshift; - zoom = p3->zoom; - height = p3->height; - width = p3->width; - view_xmin = p3->view_xmin; - view_ymin = p3->view_ymin; - - /* Transform the three points into screen coordinates */ - - t.w = a[12]*x1 + a[13]*y1 + a[14]*z1 + a[15]; - invw = 1.0/t.w; - t.x = (a[0]*x1 + a[1]*y1 + a[2]*z1 + a[3])*invw; - t.y = (a[4]*x1 + a[5]*y1 + a[6]*z1 + a[7])*invw; - t.z = (a[8]*x1 + a[9]*y1 + a[10]*z1 + a[11])*invw; - - tx1 = (int) ((t.x +xshift)*zoom*width + 0.5) + view_xmin; - ty1 = (int) ((t.y +yshift)*zoom*height + 0.5) + view_ymin; - tz1 = (Zvalue) t.z; - - - t.w = a[12]*x2 + a[13]*y2 + a[14]*z2 + a[15]; - invw = 1.0/t.w; - t.x = (a[0]*x2 + a[1]*y2 + a[2]*z2 + a[3])*invw; - t.y = (a[4]*x2 + a[5]*y2 + a[6]*z2 + a[7])*invw; - t.z = (a[8]*x2 + a[9]*y2 + a[10]*z2 + a[11])*invw; - tx2 = (int) ((t.x +xshift)*zoom*width + 0.5) + view_xmin; - ty2 = (int) ((t.y +yshift)*zoom*height + 0.5) + view_ymin; - tz2 = (Zvalue) t.z; - - t.w = a[12]*x3 + a[13]*y3 + a[14]*z3 + a[15]; - invw = 1.0/t.w; - t.x = (a[0]*x3 + a[1]*y3 + a[2]*z3 + a[3])*invw; - t.y = (a[4]*x3 + a[5]*y3 + a[6]*z3 + a[7])*invw; - t.z = (a[8]*x3 + a[9]*y3 + a[10]*z3 + a[11])*invw; - tx3 = (int) ((t.x +xshift)*zoom*width + 0.5) + view_xmin; - ty3 = (int) ((t.y +yshift)*zoom*height + 0.5) + view_ymin; - tz3 = (Zvalue) t.z; - - Plot3D_solidtriangletransform(p3,tx1,ty1,tz1,tx2,ty2,tz2,tx3,ty3,tz3,color); - -} - - -/* ------------------------------------------------------------------------- - Plot3D_horizontalinterp(Plot3D *p3, int xmin, int xmax, int y, - double z1, double z2, Pixel c1, Pixel c2) - - Draws a "Horizontal" line on the framebuffer between two screen coordinates, - but also supplies z-values and zbuffering. Performs a color interpolation - between c1 and c2. This is primarily used by the SolidTriangleInterp() - function to give the illusion of smooth surfaces. - -------------------------------------------------------------------------- */ - -void Plot3D_horizontalinterp(Plot3D *p3, int xmin, int xmax, int y, - Zvalue z1, Zvalue z2, Pixel c1, Pixel c2) { - Pixel *p; - FrameBuffer *f; - int i; - Zvalue *zbuf,z,mz; - double mc; - int startx, endx; - double invdx; - - f = p3->frame; - if ((y < f->ymin) || (y >= f->ymax)) return; - if (xmin >= f->xmax) return; - if (xmin < f->xmin) startx = f->xmin; - else startx = xmin; - if (xmax < f->xmin) return; - if (xmax >= f->xmax) endx = f->xmax - 1; - else endx = xmax; - - /* Calculate z slope */ - if (xmax != xmin) { - invdx = 1.0/(double) (xmax-xmin); - } else { - invdx = 0; - } - - mz = (Zvalue) (z2 - z1)*invdx; - - /* Calculate c slope */ - - mc = (double) (c2 - c1)*invdx; - - /* Draw it */ - - p = &f->pixels[y][startx]; - zbuf = &f->zbuffer[y][startx]; - for (i = startx; i <= endx; i++, p++, zbuf++) { - z = (Zvalue) (mz*(i-xmin) + z1); - if (z <= *zbuf) { - *p = (Pixel) (mc*(i-xmin)+c1); - *zbuf = z; - } - } -} - -/* ------------------------------------------------------------------------- - Plot3D_interptriangletransform(Plot3D *p3, - int tx1, int ty2, Zvalue tz1, Pixel c1, - int tx2, int ty2, Zvalue tz2, Pixel c2, - int tx3, int ty3, Zvalue tz3, Pixel c3) - - This function draws a 3D z-buffered filled triangle with color - interpolation. Assumes three points have already been transformed - into screen coordinates. - - General idea : - 1. Transform the three points into screen coordinates - 2. Order three points vertically on screen. - 3. Check for degenerate cases (where 3 points are colinear). - 4. Fill in the resulting triangle using horizontal lines. - 5. Colors are interpolated between end points - -------------------------------------------------------------------------- */ - -void Plot3D_interptriangletransform(Plot3D *p3, - int tx1, int ty1, Zvalue tz1, Pixel c1, - int tx2, int ty2, Zvalue tz2, Pixel c2, - int tx3, int ty3, Zvalue tz3, Pixel c3) { - int tempx, tempy; - Zvalue tempz; - double m1,m2,m3, mz1, mz2, mz3; - double mc1,mc2,mc3; - Pixel ic1,ic2,tempc; - int y; - int ix1, ix2; - Zvalue zz1, zz2; - FrameBuffer *f; - - f = p3->frame; - - /* Figure out which point has the greatest "y" value */ - - if (ty2 > ty1) { /* Swap points 1 and 2 if 2 is higher */ - tempx = tx1; - tempy = ty1; - tempz = tz1; - tempc = c1; - tx1 = tx2; - ty1 = ty2; - tz1 = tz2; - c1 = c2; - tx2 = tempx; - ty2 = tempy; - tz2 = tempz; - c2 = tempc; - } - if (ty3 > ty1) { /* Swap points 1 and 3 if 3 is higher */ - tempx = tx1; - tempy = ty1; - tempz = tz1; - tempc = c1; - tx1 = tx3; - ty1 = ty3; - tz1 = tz3; - c1 = c3; - tx3 = tempx; - ty3 = tempy; - tz3 = tempz; - c3 = tempc; - } - if (ty3 > ty2) { /* Swap points 2 and 3 if 3 is higher */ - tempx = tx2; - tempy = ty2; - tempz = tz2; - tempc = c2; - tx2 = tx3; - ty2 = ty3; - tz2 = tz3; - c2 = c3; - tx3 = tempx; - ty3 = tempy; - tz3 = tempz; - c3 = tempc; - } - - /* Points are now order so that t_1 is the highest point, t_2 is the - middle point, and t_3 is the lowest point */ - - /* Check for degenerate cases here */ - - if ((ty1 == ty2) && (ty2 == ty3)) { - - /* Points are aligned horizontally. Handle as a special case */ - /* Just draw three lines using the outline color */ - - if (tx2 > tx1) - Plot3D_horizontalinterp(p3,tx1,tx2,ty1,tz1,tz2,c1,c2); - else - Plot3D_horizontalinterp(p3,tx2,tx1,ty1,tz2,tz1,c2,c1); - if (tx3 > tx1) - Plot3D_horizontalinterp(p3,tx1,tx3,ty1,tz1,tz3,c1,c3); - else - Plot3D_horizontalinterp(p3,tx3,tx1,ty1,tz3,tz1,c3,c1); - if (tx3 > tx2) - Plot3D_horizontalinterp(p3,tx2,tx3,ty2,tz2,tz3,c2,c3); - else - Plot3D_horizontalinterp(p3,tx3,tx2,ty2,tz3,tz2,c3,c2); - - } else { - - /* First process line segments between (x1,y1)-(x2,y2) - And between (x1,y1),(x3,y3) */ - - if (ty2 < ty1) { - m1 = (double) (tx2 - tx1)/(double) (ty2 - ty1); - m2 = (double) (tx3 - tx1)/(double) (ty3 - ty1); - mz1 = (tz2 - tz1)/(double) (ty2 - ty1); - mz2 = (tz3 - tz1)/(double) (ty3 - ty1); - mc1 = (c2 - c1)/(double) (ty2 - ty1); - mc2 = (c3 - c1)/(double) (ty3 - ty1); - - y = ty1; - while (y >= ty2) { - /* Calculate x values from slope */ - ix1 = (int) (m1*(y-ty1)+0.5) + tx1; - ix2 = (int) (m2*(y-ty1)+0.5) + tx1; - zz1 = mz1*(y-ty1) + tz1; - zz2 = mz2*(y-ty1) + tz1; - ic1 = mc1*(y-ty1) + c1; - ic2 = mc2*(y-ty1) + c1; - if (ix1 > ix2) - Plot3D_horizontalinterp(p3,ix2,ix1,y,zz2,zz1,ic2,ic1); - else - Plot3D_horizontalinterp(p3,ix1,ix2,y,zz1,zz2,ic1,ic2); - y--; - } - } - if (ty3 < ty2) { - /* Draw lower half of the triangle */ - m2 = (double) (tx3 - tx1)/(double) (ty3 - ty1); - mz2 = (tz3 - tz1)/(double) (ty3 - ty1); - mc2 = (c3 - c1)/(double) (ty3 - ty1); - m3 = (double) (tx3 - tx2)/(double)(ty3 - ty2); - mz3 = (tz3 - tz2)/(double) (ty3 - ty2); - mc3 = (c3 - c2)/(double) (ty3 - ty2); - y = ty2; - while (y >= ty3) { - ix1 = (int) (m3*(y-ty2)+0.5)+tx2; - ix2 = (int) (m2*(y-ty1)+0.5)+tx1; - zz1 = mz3*(y-ty2)+tz2; - zz2 = mz2*(y-ty1)+tz1; - ic1 = mc3*(y-ty2)+c2; - ic2 = mc2*(y-ty1)+c1; - if (ix1 > ix2) - Plot3D_horizontalinterp(p3,ix2,ix1,y,zz2,zz1,ic2,ic1); - else - Plot3D_horizontalinterp(p3,ix1,ix2,y,zz1,zz2,ic1,ic2); - y--; - } - } - } -} - -/* ------------------------------------------------------------------------- - Plot3D_interptriangle(Plot3D *p3, - double x1, double y1, double z1, Pixel c1, - double x2, double y2, double z2, Pixel c2, - double x3, double y3, double z3, Pixel c3) - - This function draws a 3D z-buffered filled triangle with color - interpolation. - - This function simply transforms the given points and calls - Plot3D_InterpTriangleTransform(). - -------------------------------------------------------------------------- */ - -void Plot3D_interptriangle(Plot3D *p3, - double x1, double y1, double z1, Pixel c1, - double x2, double y2, double z2, Pixel c2, - double x3, double y3, double z3, Pixel c3) { - - int tx1, tx2, tx3, ty1, ty2, ty3; - Zvalue tz1, tz2, tz3; - GL_Vector t; - double invw; - - /* Transform the three points into screen coordinates */ - - Matrix_transform4(p3->trans_mat,x1,y1,z1,1,&t); /* Point 1 */ - invw = 1.0/t.w; - t.x = t.x *invw; - t.y = t.y *invw; - t.z = t.z *invw; - tx1 = (int) ((t.x +p3->xshift)*p3->zoom*p3->width + 0.5) + p3->view_xmin; - ty1 = (int) ((t.y +p3->yshift)*p3->zoom*p3->height + 0.5) + p3->view_ymin; - tz1 = (Zvalue) t.z; - - Matrix_transform4(p3->trans_mat,x2,y2,z2,1,&t); /* Point 2 */ - invw = 1.0/t.w; - t.x = t.x *invw; - t.y = t.y *invw; - t.z = t.z *invw; - tx2 = (int) ((t.x +p3->xshift)*p3->zoom*p3->width + 0.5) + p3->view_xmin; - ty2 = (int) ((t.y +p3->yshift)*p3->zoom*p3->height + 0.5) + p3->view_ymin; - tz2 = (Zvalue) t.z; - - Matrix_transform4(p3->trans_mat,x3,y3,z3,1,&t); /* Point 3 */ - invw = 1.0/t.w; - t.x = t.x *invw; - t.y = t.y *invw; - t.z = t.z *invw; - tx3 = (int) ((t.x +p3->xshift)*p3->zoom*p3->width + 0.5) + p3->view_xmin; - ty3 = (int) ((t.y +p3->yshift)*p3->zoom*p3->height + 0.5) + p3->view_ymin; - tz3 = (Zvalue) t.z; - - Plot3D_interptriangletransform(p3,tx1,ty1,tz1,c1,tx2,ty2,tz2,c2,tx3,ty3,tz3,c3); -} - -/* ------------------------------------------------------------------------- - Plot3D_quad(Plot3D *p3, double x1, double y1, double z1, - double x2, double y2, double z2, - double x3, double y3, double z3, - double x4, double y4, double z4, - Pixel fillcolor) - - This function draws a 3D outlined Quadralateral. Used primarily for - drawing meshes and other things. - - Plotting is done in the following order : - (x1,y1,z1) --> (x2,y2,z2) - (x2,y2,z2) --> (x3,y3,z3) - (x3,y3,z3) --> (x4,y4,z4) - (x4,y4,z4) --> (x1,y1,z1) - -------------------------------------------------------------------------- */ - -void Plot3D_quad(Plot3D *p3, double x1, double y1, double z1, - double x2, double y2, double z2, - double x3, double y3, double z3, - double x4, double y4, double z4, - Pixel color) { - - int tx1, tx2, tx3, tx4, ty1, ty2, ty3, ty4; - Zvalue tz1, tz2, tz3, tz4; - GL_Vector t; - double invw; - - /* Transform the three points into screen coordinates */ - - Matrix_transform4(p3->trans_mat,x1,y1,z1,1,&t); /* Point 1 */ - invw = 1.0/t.w; - t.x = t.x *invw; - t.y = t.y *invw; - t.z = t.z *invw; - tx1 = (int) ((t.x +p3->xshift)*p3->zoom*p3->width + 0.5) + p3->view_xmin; - ty1 = (int) ((t.y +p3->yshift)*p3->zoom*p3->height + 0.5) + p3->view_ymin; - tz1 = (Zvalue) t.z; - - Matrix_transform4(p3->trans_mat,x2,y2,z2,1,&t); /* Point 2 */ - invw = 1.0/t.w; - t.x = t.x *invw; - t.y = t.y *invw; - t.z = t.z *invw; - tx2 = (int) ((t.x +p3->xshift)*p3->zoom*p3->width + 0.5) + p3->view_xmin; - ty2 = (int) ((t.y +p3->yshift)*p3->zoom*p3->height + 0.5) + p3->view_ymin; - tz2 = (Zvalue) t.z; - - Matrix_transform4(p3->trans_mat,x3,y3,z3,1,&t); /* Point 3 */ - invw = 1.0/t.w; - t.x = t.x *invw; - t.y = t.y *invw; - t.z = t.z *invw; - tx3 = (int) ((t.x +p3->xshift)*p3->zoom*p3->width + 0.5) + p3->view_xmin; - ty3 = (int) ((t.y +p3->yshift)*p3->zoom*p3->height + 0.5) + p3->view_ymin; - tz3 = (Zvalue) t.z; - - Matrix_transform4(p3->trans_mat,x4,y4,z4,1,&t); /* Point 3 */ - invw = 1.0/t.w; - t.x = t.x *invw; - t.y = t.y *invw; - t.z = t.z *invw; - tx4 = (int) ((t.x +p3->xshift)*p3->zoom*p3->width + 0.5) + p3->view_xmin; - ty4 = (int) ((t.y +p3->yshift)*p3->zoom*p3->height + 0.5) + p3->view_ymin; - tz4 = (Zvalue) t.z; - - Plot3D_linetransform(p3,tx1,ty1,tz1,tx2,ty2,tz2,color); - Plot3D_linetransform(p3,tx2,ty2,tz2,tx3,ty3,tz3,color); - Plot3D_linetransform(p3,tx3,ty3,tz3,tx4,ty4,tz4,color); - Plot3D_linetransform(p3,tx4,ty4,tz4,tx1,ty1,tz1,color); - -} - - -/* ------------------------------------------------------------------------- - Plot3D_solidquad(Plot3D *p3, double x1, double y1, double z1, - double x2, double y2, double z2, - double x3, double y3, double z3, - double x4, double y4, double z4, - Pixel fillcolor) - - This function draws a 3D solid Quadralateral. Uses the function - Plot3D_SolidTriangleTransform() to fill in the region. - - Plotting is done in the following order : - (x1,y1,z1) --> (x2,y2,z2) - (x2,y2,z2) --> (x3,y3,z3) - (x3,y3,z3) --> (x4,y4,z4) - (x4,y4,z4) --> (x1,y1,z1) - -------------------------------------------------------------------------- */ - -void Plot3D_solidquad(Plot3D *p3, double x1, double y1, double z1, - double x2, double y2, double z2, - double x3, double y3, double z3, - double x4, double y4, double z4, - Pixel color) { - - int tx1, tx2, tx3, tx4, ty1, ty2, ty3, ty4; - Zvalue tz1, tz2, tz3, tz4; - GL_Vector t; - double invw; - - /* Transform the three points into screen coordinates */ - - Matrix_transform4(p3->trans_mat,x1,y1,z1,1,&t); /* Point 1 */ - invw = 1.0/t.w; - t.x = t.x *invw; - t.y = t.y *invw; - t.z = t.z *invw; - tx1 = (int) ((t.x +p3->xshift)*p3->zoom*p3->width + 0.5) + p3->view_xmin; - ty1 = (int) ((t.y +p3->yshift)*p3->zoom*p3->height + 0.5) + p3->view_ymin; - tz1 = (Zvalue) t.z; - - Matrix_transform4(p3->trans_mat,x2,y2,z2,1,&t); /* Point 2 */ - invw = 1.0/t.w; - t.x = t.x *invw; - t.y = t.y *invw; - t.z = t.z *invw; - tx2 = (int) ((t.x +p3->xshift)*p3->zoom*p3->width + 0.5) + p3->view_xmin; - ty2 = (int) ((t.y +p3->yshift)*p3->zoom*p3->height + 0.5) + p3->view_ymin; - tz2 = (Zvalue) t.z; - - Matrix_transform4(p3->trans_mat,x3,y3,z3,1,&t); /* Point 3 */ - invw = 1.0/t.w; - t.x = t.x *invw; - t.y = t.y *invw; - t.z = t.z *invw; - tx3 = (int) ((t.x +p3->xshift)*p3->zoom*p3->width + 0.5) + p3->view_xmin; - ty3 = (int) ((t.y +p3->yshift)*p3->zoom*p3->height + 0.5) + p3->view_ymin; - tz3 = (Zvalue) t.z; - - Matrix_transform4(p3->trans_mat,x4,y4,z4,1,&t); /* Point 3 */ - invw = 1.0/t.w; - t.x = t.x *invw; - t.y = t.y *invw; - t.z = t.z *invw; - tx4 = (int) ((t.x +p3->xshift)*p3->zoom*p3->width + 0.5) + p3->view_xmin; - ty4 = (int) ((t.y +p3->yshift)*p3->zoom*p3->height + 0.5) + p3->view_ymin; - tz4 = (Zvalue) t.z; - - Plot3D_solidtriangletransform(p3,tx1,ty1,tz1,tx2,ty2,tz2,tx3,ty3,tz3,color); - Plot3D_solidtriangletransform(p3,tx1,ty1,tz1,tx4,ty4,tz4,tx3,ty3,tz3,color); -} - -/* ------------------------------------------------------------------------- - Plot3D_interpquad(Plot3D *p3, double x1, double y1, double z1, Pixel c1, - double x2, double y2, double z2, Pixel c2, - double x3, double y3, double z3, Pixel c3, - double x4, double y4, double z4, Pixel c4) - - This function draws a 3D color-interpolated Quadralateral. Uses the function - Plot3D_InterpTriangleTransform() to fill in the region. - - Plotting is done in the following order : - (x1,y1,z1) --> (x2,y2,z2) - (x2,y2,z2) --> (x3,y3,z3) - (x3,y3,z3) --> (x4,y4,z4) - (x4,y4,z4) --> (x1,y1,z1) - -------------------------------------------------------------------------- */ - -void Plot3D_interpquad(Plot3D *p3, double x1, double y1, double z1, Pixel c1, - double x2, double y2, double z2, Pixel c2, - double x3, double y3, double z3, Pixel c3, - double x4, double y4, double z4, Pixel c4) { - - - int tx1, tx2, tx3, tx4, ty1, ty2, ty3, ty4; - Zvalue tz1, tz2, tz3, tz4; - GL_Vector t; - double invw; - - /* Transform the three points into screen coordinates */ - - Matrix_transform4(p3->trans_mat,x1,y1,z1,1,&t); /* Point 1 */ - invw = 1.0/t.w; - t.x = t.x *invw; - t.y = t.y *invw; - t.z = t.z *invw; - tx1 = (int) ((t.x +p3->xshift)*p3->zoom*p3->width + 0.5) + p3->view_xmin; - ty1 = (int) ((t.y +p3->yshift)*p3->zoom*p3->height + 0.5) + p3->view_ymin; - tz1 = (Zvalue) t.z; - - Matrix_transform4(p3->trans_mat,x2,y2,z2,1,&t); /* Point 2 */ - invw = 1.0/t.w; - t.x = t.x *invw; - t.y = t.y *invw; - t.z = t.z *invw; - tx2 = (int) ((t.x +p3->xshift)*p3->zoom*p3->width + 0.5) + p3->view_xmin; - ty2 = (int) ((t.y +p3->yshift)*p3->zoom*p3->height + 0.5) + p3->view_ymin; - tz2 = (Zvalue) t.z; - - Matrix_transform4(p3->trans_mat,x3,y3,z3,1,&t); /* Point 3 */ - invw = 1.0/t.w; - t.x = t.x *invw; - t.y = t.y *invw; - t.z = t.z *invw; - tx3 = (int) ((t.x +p3->xshift)*p3->zoom*p3->width + 0.5) + p3->view_xmin; - ty3 = (int) ((t.y +p3->yshift)*p3->zoom*p3->height + 0.5) + p3->view_ymin; - tz3 = (Zvalue) t.z; - - Matrix_transform4(p3->trans_mat,x4,y4,z4,1,&t); /* Point 3 */ - invw = 1.0/t.w; - t.x = t.x *invw; - t.y = t.y *invw; - t.z = t.z *invw; - tx4 = (int) ((t.x +p3->xshift)*p3->zoom*p3->width + 0.5) + p3->view_xmin; - ty4 = (int) ((t.y +p3->yshift)*p3->zoom*p3->height + 0.5) + p3->view_ymin; - tz4 = (Zvalue) t.z; - - Plot3D_interptriangletransform(p3,tx1,ty1,tz1,c1,tx2,ty2,tz2,c2,tx3,ty3,tz3,c3); - Plot3D_interptriangletransform(p3,tx1,ty1,tz1,c1,tx4,ty4,tz4,c4,tx3,ty3,tz3,c3); - -} - -/* -------------------------------------------------------------------------- - Plot3D_solidsphere(Plot3 *p3, double x, double y, double z, double radius, - Pixel c) - - Makes a 3D sphere at x,y,z with given radius and color. - - Basic strategy : - 1. Transform point to screen coordinates - 2. Figure out what the radius is in screen coordinates - 3. Use bresenham algorithm for large spheres - 4. Use bitmaps for small spheres - -------------------------------------------------------------------------- */ - -/* This is used to fill in spheres */ -static int s_xmin; -static int s_ymin; -static int s_xmax; -static int s_ymax; -static Pixel **s_pixels; -static Zvalue **s_zbuffer; - -void Plot3D_spherehorizontal(int xmin, int xmax, int y, Zvalue z, Pixel color) { - int i; - int startx, endx; - Pixel *p; - Zvalue *zbuf; - - if ((y < s_ymin) || (y >= s_ymax)) return; - if (xmin < s_xmin) startx = s_xmin; - else startx = xmin; - if (xmax >= s_xmax) endx = s_xmax - 1; - else endx = xmax; - - /* Draw it */ - - p = &s_pixels[y][xmin]; - zbuf = &s_zbuffer[y][xmin]; - for (i = startx; i <= endx; i++, p++, zbuf++) { - if (z <= *zbuf) { - *p = color; - *zbuf = z; - } - } -} - -void Plot3D_solidsphere(Plot3D *p3, double x, double y, double z, double radius, - Pixel c) { - - GL_Vector t,r; - double rad; - int tx,ty, irad; - Zvalue tz; - double invw; - int ix, iy, ix1,ix2,p; - FrameBuffer *f; - - /* First transform the point into model coordinates */ - - Matrix_transform4(p3->fullmodel_mat,x,y,z,1,&t); - - /* Now transform two points in order to find proper sphere radius */ - - Matrix_transform4(p3->view_mat,t.x+radius,t.y,t.z,t.w,&r); /* transform radius */ - Matrix_transform4(p3->view_mat,t.x,t.y,t.z,t.w,&t); - - invw = 1.0/t.w; - t.x = t.x*invw; - t.y = t.y*invw; - t.z = t.z*invw; - invw = 1.0/r.w; - r.x = r.x*invw; - r.y = r.y*invw; - r.z = r.z*invw; - invw = 1.0/r.w; - - rad = fabs(t.x - r.x); - - /* Transform everything into screen coordinates */ - - tx = (int) ((t.x +p3->xshift)*p3->zoom*p3->width + 0.5) + p3->view_xmin; - ty = (int) ((t.y +p3->yshift)*p3->zoom*p3->height + 0.5) + p3->view_ymin; - tz = (Zvalue) t.z; - irad = (int) (p3->zoom*(rad*p3->width + 0.5)); - - /* This is only a temporary solution (maybe). */ - -#define fill_zcircle(x,y,c) \ - ix1 = tx - x; \ - ix2 = tx + x; \ - if (ix1 < s_xmin) ix1 = s_xmin; \ - if (ix2 >= s_xmax) ix2 = s_xmax; \ - Plot3D_spherehorizontal(ix1,ix2,y,tz,c); - - f = p3->frame; - s_xmin = f->xmin; - s_ymin = f->ymin; - s_xmax = f->xmax; - s_ymax = f->ymax; - s_pixels = f->pixels; - s_zbuffer = f->zbuffer; - if (irad <= 1) { - /* Plot a single pixel */ - if ((tx >= f->xmin) && (tx < f->xmax)) { - if ((ty >= f->ymin) && (ty ymax)) { - if (tz <= f->zbuffer[ty][tx]) { - f->pixels[ty][tx] = c; - f->zbuffer[ty][tx] = tz; - } - } - } - return; - } - ix = 0; - iy = irad; - p = 3-2*irad; - while (ix <= iy) { - fill_zcircle(ix,ty+iy,c); - fill_zcircle(ix,ty-iy,c); - fill_zcircle(iy,ty+ix,c); - fill_zcircle(iy,ty-ix,c); - if (p < 0) p = p + 4*ix + 6; - else { - p = p + 4*(ix-iy) + 10; - iy = iy -1; - } - ix++; - } -} - - -/* -------------------------------------------------------------------- - Plot3D_outlinesphere(Plot3D *p3, double x, double y, double z, - double radius, Pixel color, Pixel bc) - - Draws an outlined sphere. - -------------------------------------------------------------------- */ - -void Plot3D_outlinesphere(Plot3D *p3, double x, double y, double z, - double radius, Pixel c, Pixel bc) -{ - GL_Vector t,r; - double rad; - int tx,ty, irad; - Zvalue tz; - double invw; - int ix, iy, ix1,ix2,p; - - FrameBuffer *f; - - /* First transform the point into model coordinates */ - - Matrix_transform4(p3->fullmodel_mat,x,y,z,1,&t); - - /* Now transform two points in order to find proper sphere radius */ - - Matrix_transform4(p3->view_mat,t.x+radius,t.y,t.z,t.w,&r); /* transform radius */ - Matrix_transform4(p3->view_mat,t.x,t.y,t.z,t.w,&t); - - invw = 1.0/t.w; - t.x = t.x*invw; - t.y = t.y*invw; - t.z = t.z*invw; - invw = 1.0/r.w; - r.x = r.x*invw; - r.y = r.y*invw; - r.z = r.z*invw; - invw = 1.0/r.w; - - rad = fabs(t.x - r.x); - - /* Transform everything into screen coordinates */ - - tx = (int) ((t.x +p3->xshift)*p3->zoom*p3->width + 0.5) + p3->view_xmin; - ty = (int) ((t.y +p3->yshift)*p3->zoom*p3->height + 0.5) + p3->view_ymin; - tz = (Zvalue) t.z; - irad = (int) (p3->zoom*(rad*p3->width + 0.5)); - - /* This is only a temporary solution (maybe). */ -#define plot_zcircle(x,y,c) \ - if ((x >= s_xmin) && (x < s_xmax) && \ - (y >= s_ymin) && (y < s_ymax)) {\ - if (tz <= s_zbuffer[y][x]) { \ - s_pixels[y][x] = c; \ - s_zbuffer[y][x] = tz; } \ - } - - f = p3->frame; - s_xmin = f->xmin; - s_ymin = f->ymin; - s_xmax = f->xmax; - s_ymax = f->ymax; - s_pixels = f->pixels; - s_zbuffer = f->zbuffer; - - if (irad <= 1) { - /* Plot a single pixel */ - if ((tx >= f->xmin) && (tx < f->xmax)) { - if ((ty >= f->ymin) && (ty ymax)) { - if (tz <= f->zbuffer[ty][tx]) { - f->pixels[ty][tx] = c; - f->zbuffer[ty][tx] = tz; - } - } - } - return; - } - ix = 0; - iy = irad; - p = 3-2*irad; - while (ix <= iy) { - fill_zcircle(ix,ty+iy,c); - fill_zcircle(ix,ty-iy,c); - fill_zcircle(iy,ty+ix,c); - fill_zcircle(iy,ty-ix,c); - - plot_zcircle(tx+ix,ty+iy,bc); - plot_zcircle(tx-ix,ty+iy,bc); - plot_zcircle(tx+ix,ty-iy,bc); - plot_zcircle(tx-ix,ty-iy,bc); - plot_zcircle(tx+iy,ty+ix,bc); - plot_zcircle(tx-iy,ty+ix,bc); - plot_zcircle(tx+iy,ty-ix,bc); - plot_zcircle(tx-iy,ty-ix,bc); - if (p < 0) p = p + 4*ix + 6; - else { - p = p + 4*(ix-iy) + 10; - iy = iy -1; - } - ix++; - } -} - -/* QUAD Test - Test out quad functions for graphing */ - -double zf(double x, double y) { - return cos(sqrt(x*x + y*y)*10.0)/(sqrt(x*x+y*y)+1); -} - -void Quad_Test(Plot3D *p3, int npoints) { - int i,j; - double dx; - double x1,y1,z1,x2,y2,z2,x3,y3,z3,x4,y4,z4,za; - int c; - dx = 2.0/npoints; - - - for (i = 0; i < npoints; i++) - for (j = 0; j < npoints; j++) { - x1 = i*dx + -1.0; - y1 = j*dx + -1.0; - x2 = x1 + dx; - x3 = x1 + dx; - x4 = x1; - y2 = y1; - y3 = y1 + dx; - y4 = y1 + dx; - z1 = zf(x1,y1); - z2 = zf(x2,y2); - z3 = zf(x3,y3); - z4 = zf(x4,y4); - za = 0.25*(z1+z2+z3+z4); - c = 16+((za + 1)*120); - if (c > 254) c = 254; - Plot3D_quad(p3,x1,y1,z1,x2,y2,z2,x3,y3,z3,x4,y4,z4,(Pixel) c); - } -} - - -void Quad_SolidTest(Plot3D *p3, int npoints) { - int i,j; - double dx; - double x1,y1,z1,x2,y2,z2,x3,y3,z3,x4,y4,z4,za; - int c; - dx = 2.0/npoints; - - - for (i = 0; i < npoints; i++) - for (j = 0; j < npoints; j++) { - x1 = i*dx + -1.0; - y1 = j*dx + -1.0; - x2 = x1 + dx; - x3 = x1 + dx; - x4 = x1; - y2 = y1; - y3 = y1 + dx; - y4 = y1 + dx; - z1 = zf(x1,y1); - z2 = zf(x2,y2); - z3 = zf(x3,y3); - z4 = zf(x4,y4); - za = 0.25*(z1+z2+z3+z4); - c = 16+((za + 1)*120); - if (c > 254) c = 254; - Plot3D_solidquad(p3,x1,y1,z1,x2,y2,z2,x3,y3,z3,x4,y4,z4,(Pixel) c); - } -} - - - -void Quad_InterpTest(Plot3D *p3, int npoints) { - int i,j; - double dx; - double x1,y1,z1,x2,y2,z2,x3,y3,z3,x4,y4,z4; - int c1,c2,c3,c4; - dx = 2.0/npoints; - - - for (i = 0; i < npoints; i++) - for (j = 0; j < npoints; j++) { - x1 = i*dx + -1.0; - y1 = j*dx + -1.0; - x2 = x1 + dx; - x3 = x1 + dx; - x4 = x1; - y2 = y1; - y3 = y1 + dx; - y4 = y1 + dx; - z1 = zf(x1,y1); - z2 = zf(x2,y2); - z3 = zf(x3,y3); - z4 = zf(x4,y4); - c1 = 16+((z1 + 1)*120); - c2 = 16+((z2 + 1)*120); - c3 = 16+((z3 + 1)*120); - c4 = 16+((z4 + 1)*120); - if (c1 > 254) c1 = 254; - if (c2 > 254) c2 = 254; - if (c3 > 254) c3 = 254; - if (c4 > 254) c4 = 254; - Plot3D_interpquad(p3,x1,y1,z1,(Pixel) c1,x2,y2,z2,(Pixel) c2,x3,y3,z3,(Pixel) c3,x4,y4,z4,(Pixel) c4); - } -} - - - - - - - - - - - - diff --git a/Examples/GIFPlot/Makefile.in b/Examples/GIFPlot/Makefile.in deleted file mode 100644 index 4e51360c8..000000000 --- a/Examples/GIFPlot/Makefile.in +++ /dev/null @@ -1,23 +0,0 @@ -prefix = @prefix@ -exec_prefix = @exec_prefix@ -RANLIB = @RANLIB@ -OPT = - -INSTALL = ../install-sh -c -INSTALL_DATA = ${INSTALL} -m 644 -SHELL = /bin/sh - -all: - cd Lib && $(MAKE) OPT="$(OPT)" - -install: - $(INSTALL_DATA) Include/gifplot.h $(prefix)/include/gifplot.h - $(INSTALL_DATA) libgifplot.a $(exec_prefix)/lib/libgifplot.a - $(RANLIB) $(exec_prefix)/lib/libgifplot.a - -clean:: - rm -f *.@OBJEXT@ *~ libgifplot.a *_wrap* *_man* - cd Lib && $(MAKE) clean - rm -f config.log config.status config.cache - -check: all diff --git a/Examples/GIFPlot/Ocaml/check.list b/Examples/GIFPlot/Ocaml/check.list deleted file mode 100644 index e75ee586a..000000000 --- a/Examples/GIFPlot/Ocaml/check.list +++ /dev/null @@ -1,3 +0,0 @@ -# see top-level Makefile.in -full -simple diff --git a/Examples/GIFPlot/Ocaml/full/Makefile b/Examples/GIFPlot/Ocaml/full/Makefile deleted file mode 100644 index 4f35c43f9..000000000 --- a/Examples/GIFPlot/Ocaml/full/Makefile +++ /dev/null @@ -1,33 +0,0 @@ -TOP = ../../.. -SWIG = $(TOP)/../swig -SWIGOPT = -I../../Include -SRCS = -TARGET = gifcaml -INTERFACE = gifplot.i -LIBS = -L../.. -lgifplot -lm -INCLUDES = -I../../Include -MLFILE = gifplot.ml -IOBJS = runme.cmo -PROGFILE = runme.ml - -all:: static - -static:: - $(MAKE) -f $(TOP)/Makefile TOP='$(TOP)' \ - IOBJS='$(IOBJS)' PROGFILE='$(PROGFILE)' \ - SRCS='$(SRCS)' SWIG='$(SWIG)' MLFILE='$(MLFILE)' \ - INCLUDES='$(INCLUDES)' LIBS='$(LIBS)' SWIGOPT='$(SWIGOPT)' \ - TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' ocaml_static - -dynamic:: - $(MAKE) -f $(TOP)/Makefile TOP='$(TOP)' \ - IOBJS='$(IOBJS)' PROGFILE='$(PROGFILE)' \ - SRCS='$(SRCS)' SWIG='$(SWIG)' MLFILE='$(MLFILE)' \ - INCLUDES='$(INCLUDES)' LIBS='$(LIBS)' SWIGOPT='$(SWIGOPT)' \ - TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' ocaml_dynamic - -clean:: - $(MAKE) -f $(TOP)/Makefile MLFILE='$(MLFILE)' ocaml_clean - rm -f *.gif - -check: all diff --git a/Examples/GIFPlot/Ocaml/full/README b/Examples/GIFPlot/Ocaml/full/README deleted file mode 100644 index 4a2b400b5..000000000 --- a/Examples/GIFPlot/Ocaml/full/README +++ /dev/null @@ -1,8 +0,0 @@ -This example runs the entire gifplot.h header file through SWIG without -any changes. The ocaml program 'runme.ml' does something a little more -interesting. You'll have to go look at the header file to get a complete -listing of the functions. - - - - diff --git a/Examples/GIFPlot/Ocaml/full/cmap b/Examples/GIFPlot/Ocaml/full/cmap deleted file mode 100644 index a20c331a9573dd8443380680bfe2cc428780d8a9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 768 zcmZQzpd(=A5)hSEP}Mdtvvzdz4h)M)OwTDSuW4%Uoiu&!q7`d5@7R0z#JS5i?>&C` z?#s{r^Z@9-XXO?YlTlLFHMX#G@$?UkN=VBFxv-;m^2~WlR;}N<`@pd?7q8!a^y1xT znmh34m-nxpKDd4D;+bOy_iW#^cE#d(Gbi_Tw$xXZ7G$R-M27|XxI5We80l&#%Snpx zbFrd(h8Vt}lCeu@T6xFJRlCpJeMef510DGC$^DyG&YwK8f9IC C_float x) - [ x ; y ; z1 ; - (x +. dx) ; y ; z2 ; - (x +. dx) ; (y +. dy) ; z3 ; - x ; (y +. dx) ; z4 ; - (float_of_int (c + 16)) ]))) ; - y_loop (y +. dy) (j + 1) - end in - begin - y_loop ymin 0 ; - x_loop (x +. dx) (i + 1) - end - end in - x_loop xmin 0 - end - -let _ = print_endline "Making a nice 3D plot..." -let _ = drawsolid () - -let _ = _FrameBuffer_writeGIF (C_list [ frame ; cmap ; C_string "image.gif" ]) -let _ = print_endline "Write image.gif" diff --git a/Examples/GIFPlot/Ocaml/simple/Makefile b/Examples/GIFPlot/Ocaml/simple/Makefile deleted file mode 100644 index 50492efc7..000000000 --- a/Examples/GIFPlot/Ocaml/simple/Makefile +++ /dev/null @@ -1,33 +0,0 @@ -TOP = ../../.. -SWIG = $(TOP)/../swig -SWIGOPT = -I../../Include -SRCS = -TARGET = gifsimple -INTERFACE = simple.i -LIBS = -L../.. -lgifplot -lm -INCLUDES = -I../../Include -MLFILE = simple.ml -IOBJS = simple_wrap.o simple.cmo runme.cmo -PROGFILE = runme.ml - -all:: static - -static:: - $(MAKE) -f $(TOP)/Makefile TOP='$(TOP)' \ - IOBJS='$(IOBJS)' PROGFILE='$(PROGFILE)' \ - SRCS='$(SRCS)' SWIG='$(SWIG)' MLFILE='$(MLFILE)' \ - INCLUDES='$(INCLUDES)' LIBS='$(LIBS)' SWIGOPT='$(SWIGOPT)' \ - TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' ocaml_static - -dynamic:: - $(MAKE) -f $(TOP)/Makefile TOP='$(TOP)' \ - IOBJS='$(IOBJS)' PROGFILE='$(PROGFILE)' \ - SRCS='$(SRCS)' SWIG='$(SWIG)' MLFILE='$(MLFILE)' \ - INCLUDES='$(INCLUDES)' LIBS='$(LIBS)' SWIGOPT='$(SWIGOPT)' \ - TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' ocaml_static - -clean:: - $(MAKE) -f $(TOP)/Makefile MLFILE='$(MLFILE)' ocaml_clean - rm -f *.gif - -check: all diff --git a/Examples/GIFPlot/Ocaml/simple/cmap b/Examples/GIFPlot/Ocaml/simple/cmap deleted file mode 100644 index a20c331a9573dd8443380680bfe2cc428780d8a9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 768 zcmZQzpd(=A5)hSEP}Mdtvvzdz4h)M)OwTDSuW4%Uoiu&!q7`d5@7R0z#JS5i?>&C` z?#s{r^Z@9-XXO?YlTlLFHMX#G@$?UkN=VBFxv-;m^2~WlR;}N<`@pd?7q8!a^y1xT znmh34m-nxpKDd4D;+bOy_iW#^cE#d(Gbi_Tw$xXZ7G$R-M27|XxI5We80l&#%Snpx zbFrd(h8Vt}lCeu@T6xFJRlCpJeMef510DGC$^DyG&YwK8f9IC&C` z?#s{r^Z@9-XXO?YlTlLFHMX#G@$?UkN=VBFxv-;m^2~WlR;}N<`@pd?7q8!a^y1xT znmh34m-nxpKDd4D;+bOy_iW#^cE#d(Gbi_Tw$xXZ7G$R-M27|XxI5We80l&#%Snpx zbFrd(h8Vt}lCeu@T6xFJRlCpJeMef510DGC$^DyG&YwK8f9IC 239) { $c = 239; } - Plot3D_solidquad($p3,$x,$y,$z1,$x+$dx,$y,$z2,$x+$dx,$y+$dy,$z3,$x,$y+$dy,$z4,$c+16); - $y = $y + $dy; - } - $x = $x + $dx; - } -} - -print "Making a nice 3D plot...\n"; -drawsolid(); - -FrameBuffer_writeGIF($frame,$cmap,"image.gif"); -print "Wrote image.gif\n"; - diff --git a/Examples/GIFPlot/Perl5/shadow/Makefile b/Examples/GIFPlot/Perl5/shadow/Makefile deleted file mode 100644 index c5cb7aec4..000000000 --- a/Examples/GIFPlot/Perl5/shadow/Makefile +++ /dev/null @@ -1,24 +0,0 @@ -TOP = ../../.. -SWIG = $(TOP)/../swig -SWIGOPT = -I../../Interface -SRCS = -TARGET = gifplot -INTERFACE = gifplot.i -LIBS = -L../.. -lgifplot -lm -INCLUDES = -I../../Include - -all:: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ - INCLUDES='$(INCLUDES)' LIBS='$(LIBS)' SWIGOPT='$(SWIGOPT)' \ - TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' perl5 - -static:: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ - INCLUDES='$(INCLUDES)' LIBS='$(LIBS)' SWIGOPT='$(SWIGOPT)' \ - TARGET='myperl' INTERFACE='$(INTERFACE)' perl5_static - -clean:: - $(MAKE) -f $(TOP)/Makefile perl5_clean - rm -f *.gif - -check: all diff --git a/Examples/GIFPlot/Perl5/shadow/README b/Examples/GIFPlot/Perl5/shadow/README deleted file mode 100644 index ab12e344e..000000000 --- a/Examples/GIFPlot/Perl5/shadow/README +++ /dev/null @@ -1,2 +0,0 @@ -This example use the file in ../../Interface/gifplot.i to build -an interface with shadow classes. Run the script 'runme.pl'. diff --git a/Examples/GIFPlot/Perl5/shadow/cmap b/Examples/GIFPlot/Perl5/shadow/cmap deleted file mode 100644 index a20c331a9573dd8443380680bfe2cc428780d8a9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 768 zcmZQzpd(=A5)hSEP}Mdtvvzdz4h)M)OwTDSuW4%Uoiu&!q7`d5@7R0z#JS5i?>&C` z?#s{r^Z@9-XXO?YlTlLFHMX#G@$?UkN=VBFxv-;m^2~WlR;}N<`@pd?7q8!a^y1xT znmh34m-nxpKDd4D;+bOy_iW#^cE#d(Gbi_Tw$xXZ7G$R-M27|XxI5We80l&#%Snpx zbFrd(h8Vt}lCeu@T6xFJRlCpJeMef510DGC$^DyG&YwK8f9ICclear($BLACK); - -$p3 = new gifplot::Plot3D($frame,$xmin,$ymin,$zmin,$xmax,$ymax,$zmax); -$p3->lookat(2*($zmax-$zmin)); -$p3->autoperspective(40); -$p3->rotu(60); -$p3->rotr(30); -$p3->rotd(10); - -sub drawsolid { - $p3->clear($BLACK); - $p3->start(); - my $dx = 1.0*($xmax-$xmin)/$nxpoints; - my $dy = 1.0*($ymax-$ymin)/$nypoints; - my $cscale = 240.0/($zmax-$zmin); - my $x = $xmin; - for ($i = 0; $i < $nxpoints; $i++) { - my $y = $ymin; - for ($j = 0; $j < $nypoints; $j++) { - my $z1 = func($x,$y); - my $z2 = func($x+$dx,$y); - my $z3 = func($x+$dx,$y+$dy); - my $z4 = func($x,$y+$dy); - my $c1 = $cscale*($z1-$zmin); - my $c2 = $cscale*($z2-$zmin); - my $c3 = $cscale*($z3-$zmin); - my $c4 = $cscale*($z4-$zmin); - my $c = ($c1+$c2+$c3+$c4)/4; - if ($c < 0) { $c = 0; } - if ($c > 239) { $c = 239; } - $p3->solidquad($x,$y,$z1,$x+$dx,$y,$z2,$x+$dx,$y+$dy,$z3,$x,$y+$dy,$z4,$c+16); - $y = $y + $dy; - } - $x = $x + $dx; - } -} - -print "Making a nice 3D plot...\n"; -drawsolid(); - -$frame->writeGIF($cmap,"image.gif"); -print "Wrote image.gif\n"; - diff --git a/Examples/GIFPlot/Perl5/simple/Makefile b/Examples/GIFPlot/Perl5/simple/Makefile deleted file mode 100644 index 36a8fa938..000000000 --- a/Examples/GIFPlot/Perl5/simple/Makefile +++ /dev/null @@ -1,24 +0,0 @@ -TOP = ../../.. -SWIG = $(TOP)/../swig -SWIGOPT = -SRCS = -TARGET = simple -INTERFACE = simple.i -LIBS = -L../.. -lgifplot -INCLUDES = -I../../Include - -all:: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ - INCLUDES='$(INCLUDES)' LIBS='$(LIBS)' SWIGOPT='$(SWIGOPT)' \ - TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' perl5 - -static:: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ - INCLUDES='$(INCLUDES)' LIBS='$(LIBS)' SWIGOPT='$(SWIGOPT)' \ - TARGET='myperl' INTERFACE='$(INTERFACE)' perl5_static - -clean:: - $(MAKE) -f $(TOP)/Makefile perl5_clean - rm -f *.gif - -check: all diff --git a/Examples/GIFPlot/Perl5/simple/README b/Examples/GIFPlot/Perl5/simple/README deleted file mode 100644 index c2c799a70..000000000 --- a/Examples/GIFPlot/Perl5/simple/README +++ /dev/null @@ -1,5 +0,0 @@ -This is a very minimalistic example in which just a few functions -and constants from library are wrapped and used to draw some simple -shapes. The script 'runme.pl' runs the example. - - diff --git a/Examples/GIFPlot/Perl5/simple/runme.pl b/Examples/GIFPlot/Perl5/simple/runme.pl deleted file mode 100644 index f28255e7c..000000000 --- a/Examples/GIFPlot/Perl5/simple/runme.pl +++ /dev/null @@ -1,28 +0,0 @@ -# Draw some simple shapes -print "Drawing some basic shapes\n"; - -use simple; - -$cmap = simple::new_ColorMap(); -$f = simple::new_FrameBuffer(400,400); - -# Clear the picture -simple::FrameBuffer_clear($f,$simple::BLACK); - -# Make a red box -simple::FrameBuffer_box($f,40,40,200,200,$simple::RED); - -# Make a blue circle -simple::FrameBuffer_circle($f,200,200,40,$simple::BLUE); - -# Make green line -simple::FrameBuffer_line($f,10,390,390,200, $simple::GREEN); - -# Write an image out to disk - -simple::FrameBuffer_writeGIF($f,$cmap,"image.gif"); -print "Wrote image.gif\n"; - -simple::delete_FrameBuffer($f); -simple::delete_ColorMap($cmap); - diff --git a/Examples/GIFPlot/Perl5/simple/simple.i b/Examples/GIFPlot/Perl5/simple/simple.i deleted file mode 100644 index 457bc4c09..000000000 --- a/Examples/GIFPlot/Perl5/simple/simple.i +++ /dev/null @@ -1,38 +0,0 @@ -/* This example shows a very simple interface wrapping a few - primitive declarations */ - -%module simple -%{ -#include "gifplot.h" -%} - -typedef unsigned char Pixel; - -/* Here are a few useful functions */ - -ColorMap *new_ColorMap(char *filename = 0); -void delete_ColorMap(ColorMap *cmap); - -FrameBuffer *new_FrameBuffer(unsigned int width, unsigned int height); -void delete_FrameBuffer(FrameBuffer *frame); -void FrameBuffer_clear(FrameBuffer *frame, Pixel color); -void FrameBuffer_line(FrameBuffer *frame, int x1, int y1, int x2, int y2, Pixel color); -void FrameBuffer_box(FrameBuffer *frame, int x1, int y1, int x2, int y2, Pixel color); -void FrameBuffer_circle(FrameBuffer *frame, int x1, int y1, int radius, Pixel color); -int FrameBuffer_writeGIF(FrameBuffer *f, ColorMap *c, char *filename); - -/* And some useful constants */ - -#define BLACK 0 -#define WHITE 1 -#define RED 2 -#define GREEN 3 -#define BLUE 4 -#define YELLOW 5 -#define CYAN 6 -#define MAGENTA 7 - - - - - diff --git a/Examples/GIFPlot/Php4/check.list b/Examples/GIFPlot/Php4/check.list deleted file mode 100644 index e75ee586a..000000000 --- a/Examples/GIFPlot/Php4/check.list +++ /dev/null @@ -1,3 +0,0 @@ -# see top-level Makefile.in -full -simple diff --git a/Examples/GIFPlot/Php4/full/Makefile b/Examples/GIFPlot/Php4/full/Makefile deleted file mode 100644 index 3aa632b99..000000000 --- a/Examples/GIFPlot/Php4/full/Makefile +++ /dev/null @@ -1,20 +0,0 @@ -TOP = ../../.. -SWIG = $(TOP)/../swig -SWIGOPT = -I../../Include -noproxy -SRCS = -TARGET = php_gifplot -INTERFACE = gifplot.i -LIBS = -L../.. -lgifplot -lm -INCLUDES = -I../../Include - -all:: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ - INCLUDES='$(INCLUDES)' LIBS='$(LIBS)' SWIGOPT='$(SWIGOPT)' \ - TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' php4 - -clean:: - $(MAKE) -f $(TOP)/Makefile php4_clean - rm -f *.gif - rm -f php_gifplot.h - -check: all diff --git a/Examples/GIFPlot/Php4/full/README b/Examples/GIFPlot/Php4/full/README deleted file mode 100644 index f8d38d9af..000000000 --- a/Examples/GIFPlot/Php4/full/README +++ /dev/null @@ -1,4 +0,0 @@ -This example runs the entire gifplot.h header file through SWIG without -any changes. The script 'runme.php3' does something a little more -interesting. You'll have to go look at the header file to get a complete -listing of the functions. diff --git a/Examples/GIFPlot/Php4/full/cmap b/Examples/GIFPlot/Php4/full/cmap deleted file mode 100644 index a20c331a9573dd8443380680bfe2cc428780d8a9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 768 zcmZQzpd(=A5)hSEP}Mdtvvzdz4h)M)OwTDSuW4%Uoiu&!q7`d5@7R0z#JS5i?>&C` z?#s{r^Z@9-XXO?YlTlLFHMX#G@$?UkN=VBFxv-;m^2~WlR;}N<`@pd?7q8!a^y1xT znmh34m-nxpKDd4D;+bOy_iW#^cE#d(Gbi_Tw$xXZ7G$R-M27|XxI5We80l&#%Snpx zbFrd(h8Vt}lCeu@T6xFJRlCpJeMef510DGC$^DyG&YwK8f9IC 239) { $c = 239; } - Plot3D_solidquad($p3, $x,$y,$z1,$x+$dx,$y,$z2,$x+$dx,$y+$dy,$z3,$x,$y+$dy,$z4,$c+16); - $y = $y + $dy; - } - $x = $x + $dx; - } -} - -print "Making a nice 3D plot...\n"; -drawsolid(); - -FrameBuffer_writeGIF($frame, $cmap,"image.gif"); -print "Wrote image.gif\n"; - -?> diff --git a/Examples/GIFPlot/Php4/shadow/Makefile b/Examples/GIFPlot/Php4/shadow/Makefile deleted file mode 100644 index 5627e53a0..000000000 --- a/Examples/GIFPlot/Php4/shadow/Makefile +++ /dev/null @@ -1,19 +0,0 @@ -TOP = ../../.. -SWIG = $(TOP)/../swig -SWIGOPT = -I../../Interface -SRCS = -TARGET = php_gifplot -INTERFACE = gifplot.i -LIBS = -L../.. -lgifplot -lm -INCLUDES = -I../../Include - -all:: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ - INCLUDES='$(INCLUDES)' LIBS='$(LIBS)' SWIGOPT='$(SWIGOPT)' \ - TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' php4 - -clean:: - $(MAKE) -f $(TOP)/Makefile php4_clean - rm -f *.gif - -check: all diff --git a/Examples/GIFPlot/Php4/shadow/README b/Examples/GIFPlot/Php4/shadow/README deleted file mode 100644 index 3e91f7d59..000000000 --- a/Examples/GIFPlot/Php4/shadow/README +++ /dev/null @@ -1,2 +0,0 @@ -This example use the file in ../../Interface/gifplot.i to build -an interface with shadow classes. Run the script 'runme.php3'. diff --git a/Examples/GIFPlot/Php4/shadow/cmap b/Examples/GIFPlot/Php4/shadow/cmap deleted file mode 100644 index a20c331a9573dd8443380680bfe2cc428780d8a9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 768 zcmZQzpd(=A5)hSEP}Mdtvvzdz4h)M)OwTDSuW4%Uoiu&!q7`d5@7R0z#JS5i?>&C` z?#s{r^Z@9-XXO?YlTlLFHMX#G@$?UkN=VBFxv-;m^2~WlR;}N<`@pd?7q8!a^y1xT znmh34m-nxpKDd4D;+bOy_iW#^cE#d(Gbi_Tw$xXZ7G$R-M27|XxI5We80l&#%Snpx zbFrd(h8Vt}lCeu@T6xFJRlCpJeMef510DGC$^DyG&YwK8f9ICclear(BLACK); - - -$p3 = new Plot3D($frame,$xmin,$ymin,$zmin,$xmax,$ymax,$zmax); -$p3->lookat(2*($zmax-$zmin)); -$p3->autoperspective(40); -$p3->rotu(60); -$p3->rotr(30); -$p3->rotd(10); - -function drawsolid() { - global $xmax; - global $xmin; - global $ymax; - global $ymin; - global $zmin; - global $zmax; - global $nxpoints; - global $nypoints; - global $p3; - - $p3->clear(BLACK); - $p3->start(); - $dx = 1.0*($xmax-$xmin)/$nxpoints; - $dy = 1.0*($ymax-$ymin)/$nypoints; - $cscale = 240.0/($zmax-$zmin); - $x = $xmin; - for ($i = 0; $i < $nxpoints; $i++) { - $y = $ymin; - for ($j = 0; $j < $nypoints; $j++) { - $z1 = func($x,$y); - $z2 = func($x+$dx,$y); - $z3 = func($x+$dx,$y+$dy); - $z4 = func($x,$y+$dy); - $c1 = $cscale*($z1-$zmin); - $c2 = $cscale*($z2-$zmin); - $c3 = $cscale*($z3-$zmin); - $c4 = $cscale*($z4-$zmin); - $c = ($c1+$c2+$c3+$c4)/4; - if ($c < 0) { $c = 0; } - if ($c > 239) { $c = 239; } - $p3->solidquad($x,$y,$z1,$x+$dx,$y,$z2,$x+$dx,$y+$dy,$z3,$x,$y+$dy,$z4,$c+16); - $y = $y + $dy; - } - $x = $x + $dx; - } -} - -print "Making a nice 3D plot...\n"; -drawsolid(); - -$frame->writeGIF($cmap,"image.gif"); -print "Wrote image.gif\n"; - -?> diff --git a/Examples/GIFPlot/Php4/simple/Makefile b/Examples/GIFPlot/Php4/simple/Makefile deleted file mode 100644 index 6903bec0b..000000000 --- a/Examples/GIFPlot/Php4/simple/Makefile +++ /dev/null @@ -1,20 +0,0 @@ -TOP = ../../.. -SWIG = $(TOP)/../swig -SWIGOPT = -noproxy -SRCS = -TARGET = php_simple -INTERFACE = simple.i -LIBS = -L../.. -lgifplot -INCLUDES = -I../../Include - -all:: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ - INCLUDES='$(INCLUDES)' LIBS='$(LIBS)' SWIGOPT='$(SWIGOPT)' \ - TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' php4 - -clean:: - $(MAKE) -f $(TOP)/Makefile php4_clean - rm -f *.gif - rm -f php_simple.h - -check: all diff --git a/Examples/GIFPlot/Php4/simple/README b/Examples/GIFPlot/Php4/simple/README deleted file mode 100644 index c2c799a70..000000000 --- a/Examples/GIFPlot/Php4/simple/README +++ /dev/null @@ -1,5 +0,0 @@ -This is a very minimalistic example in which just a few functions -and constants from library are wrapped and used to draw some simple -shapes. The script 'runme.pl' runs the example. - - diff --git a/Examples/GIFPlot/Php4/simple/runme.php4 b/Examples/GIFPlot/Php4/simple/runme.php4 deleted file mode 100644 index cf21a0927..000000000 --- a/Examples/GIFPlot/Php4/simple/runme.php4 +++ /dev/null @@ -1,32 +0,0 @@ - - diff --git a/Examples/GIFPlot/Php4/simple/simple.i b/Examples/GIFPlot/Php4/simple/simple.i deleted file mode 100644 index 457bc4c09..000000000 --- a/Examples/GIFPlot/Php4/simple/simple.i +++ /dev/null @@ -1,38 +0,0 @@ -/* This example shows a very simple interface wrapping a few - primitive declarations */ - -%module simple -%{ -#include "gifplot.h" -%} - -typedef unsigned char Pixel; - -/* Here are a few useful functions */ - -ColorMap *new_ColorMap(char *filename = 0); -void delete_ColorMap(ColorMap *cmap); - -FrameBuffer *new_FrameBuffer(unsigned int width, unsigned int height); -void delete_FrameBuffer(FrameBuffer *frame); -void FrameBuffer_clear(FrameBuffer *frame, Pixel color); -void FrameBuffer_line(FrameBuffer *frame, int x1, int y1, int x2, int y2, Pixel color); -void FrameBuffer_box(FrameBuffer *frame, int x1, int y1, int x2, int y2, Pixel color); -void FrameBuffer_circle(FrameBuffer *frame, int x1, int y1, int radius, Pixel color); -int FrameBuffer_writeGIF(FrameBuffer *f, ColorMap *c, char *filename); - -/* And some useful constants */ - -#define BLACK 0 -#define WHITE 1 -#define RED 2 -#define GREEN 3 -#define BLUE 4 -#define YELLOW 5 -#define CYAN 6 -#define MAGENTA 7 - - - - - diff --git a/Examples/GIFPlot/Pike/check.list b/Examples/GIFPlot/Pike/check.list deleted file mode 100644 index d38998cab..000000000 --- a/Examples/GIFPlot/Pike/check.list +++ /dev/null @@ -1,2 +0,0 @@ -# see top-level Makefile.in -simple diff --git a/Examples/GIFPlot/Pike/simple/Makefile b/Examples/GIFPlot/Pike/simple/Makefile deleted file mode 100644 index d339e0333..000000000 --- a/Examples/GIFPlot/Pike/simple/Makefile +++ /dev/null @@ -1,24 +0,0 @@ -TOP = ../../.. -SWIG = $(TOP)/../swig -SWIGOPT = -SRCS = -TARGET = simple -INTERFACE = simple.i -LIBS = -L../.. -lgifplot -INCLUDES = -I../../Include - -all:: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ - INCLUDES='$(INCLUDES)' LIBS='$(LIBS)' SWIGOPT='$(SWIGOPT)' \ - TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' pike - -static:: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ - INCLUDES='$(INCLUDES)' LIBS='$(LIBS)' SWIGOPT='$(SWIGOPT)' \ - TARGET='mypike' INTERFACE='$(INTERFACE)' pike_static - -clean:: - $(MAKE) -f $(TOP)/Makefile pike_clean - rm -f *.gif - -check: all diff --git a/Examples/GIFPlot/Pike/simple/README b/Examples/GIFPlot/Pike/simple/README deleted file mode 100644 index 177b3633b..000000000 --- a/Examples/GIFPlot/Pike/simple/README +++ /dev/null @@ -1,5 +0,0 @@ -This is a very minimalistic example in which just a few functions -and constants from library are wrapped and used to draw some simple -shapes. The script 'runme.pike' runs the example. - - diff --git a/Examples/GIFPlot/Pike/simple/runme.pike b/Examples/GIFPlot/Pike/simple/runme.pike deleted file mode 100644 index 0e70235f1..000000000 --- a/Examples/GIFPlot/Pike/simple/runme.pike +++ /dev/null @@ -1,30 +0,0 @@ -int main() -{ - // Draw some simple shapes - write("Drawing some basic shapes\n"); - - .simple.ColorMap cmap = .simple.new_ColorMap(); - .simple.FrameBuffer f = .simple.new_FrameBuffer(400, 400); - - // Clear the picture - .simple.FrameBuffer_clear(f, .simple.BLACK); - - // Make a red box - .simple.FrameBuffer_box(f, 40, 40, 200, 200, .simple.RED); - - // Make a blue circle - .simple.FrameBuffer_circle(f, 200, 200, 40, .simple.BLUE); - - // Make green line - .simple.FrameBuffer_line(f, 10, 390, 390, 200, .simple.GREEN); - - // Write an image out to disk - .simple.FrameBuffer_writeGIF(f, cmap, "image.gif"); - write("Wrote image.gif\n"); - - .simple.delete_FrameBuffer(f); - .simple.delete_ColorMap(cmap); - - return 0; -} - diff --git a/Examples/GIFPlot/Pike/simple/simple.i b/Examples/GIFPlot/Pike/simple/simple.i deleted file mode 100644 index 457bc4c09..000000000 --- a/Examples/GIFPlot/Pike/simple/simple.i +++ /dev/null @@ -1,38 +0,0 @@ -/* This example shows a very simple interface wrapping a few - primitive declarations */ - -%module simple -%{ -#include "gifplot.h" -%} - -typedef unsigned char Pixel; - -/* Here are a few useful functions */ - -ColorMap *new_ColorMap(char *filename = 0); -void delete_ColorMap(ColorMap *cmap); - -FrameBuffer *new_FrameBuffer(unsigned int width, unsigned int height); -void delete_FrameBuffer(FrameBuffer *frame); -void FrameBuffer_clear(FrameBuffer *frame, Pixel color); -void FrameBuffer_line(FrameBuffer *frame, int x1, int y1, int x2, int y2, Pixel color); -void FrameBuffer_box(FrameBuffer *frame, int x1, int y1, int x2, int y2, Pixel color); -void FrameBuffer_circle(FrameBuffer *frame, int x1, int y1, int radius, Pixel color); -int FrameBuffer_writeGIF(FrameBuffer *f, ColorMap *c, char *filename); - -/* And some useful constants */ - -#define BLACK 0 -#define WHITE 1 -#define RED 2 -#define GREEN 3 -#define BLUE 4 -#define YELLOW 5 -#define CYAN 6 -#define MAGENTA 7 - - - - - diff --git a/Examples/GIFPlot/Python/check.list b/Examples/GIFPlot/Python/check.list deleted file mode 100644 index 13de977af..000000000 --- a/Examples/GIFPlot/Python/check.list +++ /dev/null @@ -1,4 +0,0 @@ -# see top-level Makefile.in -full -shadow -simple diff --git a/Examples/GIFPlot/Python/full/Makefile b/Examples/GIFPlot/Python/full/Makefile deleted file mode 100644 index 83a7c864b..000000000 --- a/Examples/GIFPlot/Python/full/Makefile +++ /dev/null @@ -1,26 +0,0 @@ -TOP = ../../.. -SWIG = $(TOP)/../preinst-swig -SWIGOPT = -I../../Include -SRCS = -TARGET = gifplot -INTERFACE = gifplot.i -LIBS = -L../.. -lgifplot -INCLUDES = -I../../Include - -all:: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ - INCLUDES='$(INCLUDES)' LIBS='$(LIBS)' SWIGOPT='$(SWIGOPT)' \ - TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' python - -static:: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ - INCLUDES='$(INCLUDES)' LIBS='$(LIBS)' SWIGOPT='$(SWIGOPT)' \ - TARGET='mypython' INTERFACE='$(INTERFACE)' python_static - -clean:: - $(MAKE) -f $(TOP)/Makefile python_clean - rm -f $(TARGET).py - rm -f *.gif - -check: all - $(MAKE) -f $(TOP)/Makefile python_run diff --git a/Examples/GIFPlot/Python/full/README b/Examples/GIFPlot/Python/full/README deleted file mode 100644 index 52971e40a..000000000 --- a/Examples/GIFPlot/Python/full/README +++ /dev/null @@ -1,8 +0,0 @@ -This example runs the entire gifplot.h header file through SWIG without -any changes. The script 'runme.py' does something a little more -interesting. You'll have to go look at the header file to get a complete -listing of the functions. - - - - diff --git a/Examples/GIFPlot/Python/full/cmap b/Examples/GIFPlot/Python/full/cmap deleted file mode 100644 index a20c331a9573dd8443380680bfe2cc428780d8a9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 768 zcmZQzpd(=A5)hSEP}Mdtvvzdz4h)M)OwTDSuW4%Uoiu&!q7`d5@7R0z#JS5i?>&C` z?#s{r^Z@9-XXO?YlTlLFHMX#G@$?UkN=VBFxv-;m^2~WlR;}N<`@pd?7q8!a^y1xT znmh34m-nxpKDd4D;+bOy_iW#^cE#d(Gbi_Tw$xXZ7G$R-M27|XxI5We80l&#%Snpx zbFrd(h8Vt}lCeu@T6xFJRlCpJeMef510DGC$^DyG&YwK8f9IC 239 : c = 239 - Plot3D_solidquad(p3,x,y,z1,x+dx,y,z2,x+dx,y+dy,z3,x,y+dy,z4,c+16) - y = y + dy - x = x + dx - -print "Making a nice 3D plot..." -drawsolid() - -FrameBuffer_writeGIF(frame,cmap,"image.gif") -print "Wrote image.gif" - diff --git a/Examples/GIFPlot/Python/shadow/Makefile b/Examples/GIFPlot/Python/shadow/Makefile deleted file mode 100644 index 73fca9673..000000000 --- a/Examples/GIFPlot/Python/shadow/Makefile +++ /dev/null @@ -1,26 +0,0 @@ -TOP = ../../.. -SWIG = $(TOP)/../preinst-swig -SWIGOPT = -I../../Interface -SRCS = -TARGET = gifplot -INTERFACE = gifplot.i -LIBS = -L../.. -lgifplot -INCLUDES = -I../../Include - -all:: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ - INCLUDES='$(INCLUDES)' LIBS='$(LIBS)' SWIGOPT='$(SWIGOPT)' \ - TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' python - -static:: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ - INCLUDES='$(INCLUDES)' LIBS='$(LIBS)' SWIGOPT='$(SWIGOPT)' \ - TARGET='mypython' INTERFACE='$(INTERFACE)' python_static - -clean:: - $(MAKE) -f $(TOP)/Makefile python_clean - rm -f $(TARGET).py - rm -f *.gif - -check: all - $(MAKE) -f $(TOP)/Makefile python_run diff --git a/Examples/GIFPlot/Python/shadow/README b/Examples/GIFPlot/Python/shadow/README deleted file mode 100644 index aa761e240..000000000 --- a/Examples/GIFPlot/Python/shadow/README +++ /dev/null @@ -1,8 +0,0 @@ -This example illustrates Python shadow classes. Take a look at -the file GIFPlot/Interface/gifplot.i - - - - - - diff --git a/Examples/GIFPlot/Python/shadow/cmap b/Examples/GIFPlot/Python/shadow/cmap deleted file mode 100644 index a20c331a9573dd8443380680bfe2cc428780d8a9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 768 zcmZQzpd(=A5)hSEP}Mdtvvzdz4h)M)OwTDSuW4%Uoiu&!q7`d5@7R0z#JS5i?>&C` z?#s{r^Z@9-XXO?YlTlLFHMX#G@$?UkN=VBFxv-;m^2~WlR;}N<`@pd?7q8!a^y1xT znmh34m-nxpKDd4D;+bOy_iW#^cE#d(Gbi_Tw$xXZ7G$R-M27|XxI5We80l&#%Snpx zbFrd(h8Vt}lCeu@T6xFJRlCpJeMef510DGC$^DyG&YwK8f9IC 239 : c = 239 - p3.solidquad(x,y,z1,x+dx,y,z2,x+dx,y+dy,z3,x,y+dy,z4,c+16) - y = y + dy - x = x + dx - -print "Making a nice 3D plot..." -drawsolid() - -frame.writeGIF(cmap,"image.gif") -print "Wrote image.gif" - diff --git a/Examples/GIFPlot/Python/simple/Makefile b/Examples/GIFPlot/Python/simple/Makefile deleted file mode 100644 index 9fc9a6c72..000000000 --- a/Examples/GIFPlot/Python/simple/Makefile +++ /dev/null @@ -1,26 +0,0 @@ -TOP = ../../.. -SWIG = $(TOP)/../preinst-swig -SWIGOPT = -SRCS = -TARGET = simple -INTERFACE = simple.i -LIBS = -L../.. -lgifplot -INCLUDES = -I../../Include - -all:: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ - INCLUDES='$(INCLUDES)' LIBS='$(LIBS)' SWIGOPT='$(SWIGOPT)' \ - TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' python - -static:: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ - INCLUDES='$(INCLUDES)' LIBS='$(LIBS)' SWIGOPT='$(SWIGOPT)' \ - TARGET='mypython' INTERFACE='$(INTERFACE)' python_static - -clean:: - $(MAKE) -f $(TOP)/Makefile python_clean - rm -f $(TARGET).py - rm -f *.gif - -check: all - $(MAKE) -f $(TOP)/Makefile python_run diff --git a/Examples/GIFPlot/Python/simple/README b/Examples/GIFPlot/Python/simple/README deleted file mode 100644 index 22152c665..000000000 --- a/Examples/GIFPlot/Python/simple/README +++ /dev/null @@ -1,5 +0,0 @@ -This is a very minimalistic example in which just a few functions -and constants from library are wrapped and used to draw some simple -shapes. The script 'runme.py' runs the example. - - diff --git a/Examples/GIFPlot/Python/simple/runme.py b/Examples/GIFPlot/Python/simple/runme.py deleted file mode 100644 index dade67767..000000000 --- a/Examples/GIFPlot/Python/simple/runme.py +++ /dev/null @@ -1,27 +0,0 @@ -# Draw some simple shapes -print "Drawing some basic shapes" -import simple - -cmap = simple.new_ColorMap() -f = simple.new_FrameBuffer(400,400) - -# Clear the picture -simple.FrameBuffer_clear(f,simple.BLACK) - -# Make a red box -simple.FrameBuffer_box(f,40,40,200,200,simple.RED) - -# Make a blue circle -simple.FrameBuffer_circle(f,200,200,40,simple.BLUE) - -# Make green line -simple.FrameBuffer_line(f,10,390,390,200, simple.GREEN) - -# Write an image out to disk - -simple.FrameBuffer_writeGIF(f,cmap,"image.gif") -print "Wrote image.gif" - -simple.delete_FrameBuffer(f) -simple.delete_ColorMap(cmap) - diff --git a/Examples/GIFPlot/Python/simple/simple.i b/Examples/GIFPlot/Python/simple/simple.i deleted file mode 100644 index 457bc4c09..000000000 --- a/Examples/GIFPlot/Python/simple/simple.i +++ /dev/null @@ -1,38 +0,0 @@ -/* This example shows a very simple interface wrapping a few - primitive declarations */ - -%module simple -%{ -#include "gifplot.h" -%} - -typedef unsigned char Pixel; - -/* Here are a few useful functions */ - -ColorMap *new_ColorMap(char *filename = 0); -void delete_ColorMap(ColorMap *cmap); - -FrameBuffer *new_FrameBuffer(unsigned int width, unsigned int height); -void delete_FrameBuffer(FrameBuffer *frame); -void FrameBuffer_clear(FrameBuffer *frame, Pixel color); -void FrameBuffer_line(FrameBuffer *frame, int x1, int y1, int x2, int y2, Pixel color); -void FrameBuffer_box(FrameBuffer *frame, int x1, int y1, int x2, int y2, Pixel color); -void FrameBuffer_circle(FrameBuffer *frame, int x1, int y1, int radius, Pixel color); -int FrameBuffer_writeGIF(FrameBuffer *f, ColorMap *c, char *filename); - -/* And some useful constants */ - -#define BLACK 0 -#define WHITE 1 -#define RED 2 -#define GREEN 3 -#define BLUE 4 -#define YELLOW 5 -#define CYAN 6 -#define MAGENTA 7 - - - - - diff --git a/Examples/GIFPlot/README b/Examples/GIFPlot/README deleted file mode 100644 index ac1025a42..000000000 --- a/Examples/GIFPlot/README +++ /dev/null @@ -1,59 +0,0 @@ -GIFPlot -======= - -To illustrate various SWIG features, the following examples involve -building an interface to a small, but somewhat useful graphics library -for creating 2D and 3D images in the form of GIF files. The Perl, -Python, Tcl, Java, Ruby etc. directories contain various examples specific to -those languages. - -This library was originally developed as part of the SPaSM molecular -dynamics project at Los Alamos National Laboratory. However, due to -patent enforcement issues related to LZW encoding and a general lack -of time on the part of the author, the library was never officially -released. On the plus side, a number of people have found it to be a -useful easter egg within the SWIG distribution :-). - - -DUE TO PATENT RESTRICTIONS ON THE LZW COMPRESSION ALGORITHM, THIS -LIBRARY ONLY PRODUCES UNCOMPRESSED GIF FILES. SO THERE. - - -Building the Library -==================== - -In order to run the examples, it is first necessary to build the GIFPlot -C library. To do this, simply run make: - - make - -Running the Examples -==================== - -Once the library has been built, go to your chosen language directory, -that is, Perl, Python, Tcl, Java, Ruby etc. Each example should have a -README file with a description. - -Each example can be compiled using the makefile in each example directory. This -makefile uses the top level makefile in the "Examples" directory of the distribution. -If the example doesn't compile, you will need to adjust the settings in this file. - -Documentation -============= - -Read the source Luke. The examples should be pretty much self-explanatory. -The header file Include/gifplot.h contains the full API. - -The original documentation for the library can be found online at: - - http://www.dabeaz.com/gifplot/index.html - - -Let me know what you think! -=========================== -If you found this example to be useful, confusing, or otherwise, I would like to know -about it. Suggestions for improvement are welcome. - --- Dave (dave@dabeaz.com) - - diff --git a/Examples/GIFPlot/Ruby/check.list b/Examples/GIFPlot/Ruby/check.list deleted file mode 100644 index 13de977af..000000000 --- a/Examples/GIFPlot/Ruby/check.list +++ /dev/null @@ -1,4 +0,0 @@ -# see top-level Makefile.in -full -shadow -simple diff --git a/Examples/GIFPlot/Ruby/full/Makefile b/Examples/GIFPlot/Ruby/full/Makefile deleted file mode 100644 index 5af8bc832..000000000 --- a/Examples/GIFPlot/Ruby/full/Makefile +++ /dev/null @@ -1,24 +0,0 @@ -TOP = ../../.. -SWIG = $(TOP)/../swig -SWIGOPT = -I../../Include -SRCS = -TARGET = gifplot -INTERFACE = gifplot.i -LIBS = -L../.. -lgifplot -INCLUDES = -I../../Include - -all:: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ - INCLUDES='$(INCLUDES)' LIBS='$(LIBS)' SWIGOPT='$(SWIGOPT)' \ - TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' ruby - -static:: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ - INCLUDES='$(INCLUDES)' LIBS='$(LIBS)' SWIGOPT='$(SWIGOPT)' \ - TARGET='myruby' INTERFACE='$(INTERFACE)' ruby_static - -clean:: - $(MAKE) -f $(TOP)/Makefile ruby_clean - rm -f *.gif - -check: all diff --git a/Examples/GIFPlot/Ruby/full/README b/Examples/GIFPlot/Ruby/full/README deleted file mode 100644 index 22af6cb06..000000000 --- a/Examples/GIFPlot/Ruby/full/README +++ /dev/null @@ -1,8 +0,0 @@ -This example runs the entire gifplot.h header file through SWIG without -any changes. The script 'runme.rb' does something a little more -interesting. You'll have to go look at the header file to get a complete -listing of the functions. - - - - diff --git a/Examples/GIFPlot/Ruby/full/cmap b/Examples/GIFPlot/Ruby/full/cmap deleted file mode 100644 index a20c331a9573dd8443380680bfe2cc428780d8a9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 768 zcmZQzpd(=A5)hSEP}Mdtvvzdz4h)M)OwTDSuW4%Uoiu&!q7`d5@7R0z#JS5i?>&C` z?#s{r^Z@9-XXO?YlTlLFHMX#G@$?UkN=VBFxv-;m^2~WlR;}N<`@pd?7q8!a^y1xT znmh34m-nxpKDd4D;+bOy_iW#^cE#d(Gbi_Tw$xXZ7G$R-M27|XxI5We80l&#%Snpx zbFrd(h8Vt}lCeu@T6xFJRlCpJeMef510DGC$^DyG&YwK8f9IC 239 - Plot3D_solidquad(P3,x,y,z1,x+dx,y,z2,x+dx,y+dy,z3,x,y+dy,z4,c+16) - y = y + dy - end - x = x + dx - end -end - -puts "Making a nice 3D plot..." -drawsolid() - -FrameBuffer_writeGIF(frame,cmap,"image.gif") -puts "Wrote image.gif" diff --git a/Examples/GIFPlot/Ruby/shadow/Makefile b/Examples/GIFPlot/Ruby/shadow/Makefile deleted file mode 100644 index ea382ea88..000000000 --- a/Examples/GIFPlot/Ruby/shadow/Makefile +++ /dev/null @@ -1,24 +0,0 @@ -TOP = ../../.. -SWIG = $(TOP)/../swig -SWIGOPT = -I../../Interface -SRCS = -TARGET = gifplot -INTERFACE = gifplot.i -LIBS = -L../.. -lgifplot -INCLUDES = -I../../Include - -all:: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ - INCLUDES='$(INCLUDES)' LIBS='$(LIBS)' SWIGOPT='$(SWIGOPT)' \ - TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' ruby - -static:: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ - INCLUDES='$(INCLUDES)' LIBS='$(LIBS)' SWIGOPT='$(SWIGOPT)' \ - TARGET='myruby' INTERFACE='$(INTERFACE)' ruby_static - -clean:: - $(MAKE) -f $(TOP)/Makefile ruby_clean - rm -f *.gif - -check: all diff --git a/Examples/GIFPlot/Ruby/shadow/README b/Examples/GIFPlot/Ruby/shadow/README deleted file mode 100644 index 7a33e137f..000000000 --- a/Examples/GIFPlot/Ruby/shadow/README +++ /dev/null @@ -1,5 +0,0 @@ -This example illustrates Ruby shadow classes. Take a look at -the file GIFPlot/Interface/gifplot.i - -Actually Ruby module of SWIG needs no shadow class. But this example -is named "shadow" in order to be consistent with other languages. diff --git a/Examples/GIFPlot/Ruby/shadow/cmap b/Examples/GIFPlot/Ruby/shadow/cmap deleted file mode 100644 index a20c331a9573dd8443380680bfe2cc428780d8a9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 768 zcmZQzpd(=A5)hSEP}Mdtvvzdz4h)M)OwTDSuW4%Uoiu&!q7`d5@7R0z#JS5i?>&C` z?#s{r^Z@9-XXO?YlTlLFHMX#G@$?UkN=VBFxv-;m^2~WlR;}N<`@pd?7q8!a^y1xT znmh34m-nxpKDd4D;+bOy_iW#^cE#d(Gbi_Tw$xXZ7G$R-M27|XxI5We80l&#%Snpx zbFrd(h8Vt}lCeu@T6xFJRlCpJeMef510DGC$^DyG&YwK8f9IC 239 - P3.solidquad(x,y,z1,x+dx,y,z2,x+dx,y+dy,z3,x,y+dy,z4,c+16) - y = y + dy - end - x = x + dx - end -end - -puts "Making a nice 3D plot..." -drawsolid() - -frame.writeGIF(cmap,"image.gif") -puts "Wrote image.gif" - diff --git a/Examples/GIFPlot/Ruby/simple/Makefile b/Examples/GIFPlot/Ruby/simple/Makefile deleted file mode 100644 index f7ca1a7d8..000000000 --- a/Examples/GIFPlot/Ruby/simple/Makefile +++ /dev/null @@ -1,24 +0,0 @@ -TOP = ../../.. -SWIG = $(TOP)/../swig -SWIGOPT = -SRCS = -TARGET = simple -INTERFACE = simple.i -LIBS = -L../.. -lgifplot -INCLUDES = -I../../Include - -all:: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ - INCLUDES='$(INCLUDES)' LIBS='$(LIBS)' SWIGOPT='$(SWIGOPT)' \ - TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' ruby - -static:: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ - INCLUDES='$(INCLUDES)' LIBS='$(LIBS)' SWIGOPT='$(SWIGOPT)' \ - TARGET='myruby' INTERFACE='$(INTERFACE)' ruby_static - -clean:: - $(MAKE) -f $(TOP)/Makefile ruby_clean - rm -f *.gif - -check: all diff --git a/Examples/GIFPlot/Ruby/simple/README b/Examples/GIFPlot/Ruby/simple/README deleted file mode 100644 index 9b51038bf..000000000 --- a/Examples/GIFPlot/Ruby/simple/README +++ /dev/null @@ -1,5 +0,0 @@ -This is a very minimalistic example in which just a few functions -and constants from library are wrapped and used to draw some simple -shapes. The script 'runme.rb' runs the example. - - diff --git a/Examples/GIFPlot/Ruby/simple/runme.rb b/Examples/GIFPlot/Ruby/simple/runme.rb deleted file mode 100644 index e8bf5a40f..000000000 --- a/Examples/GIFPlot/Ruby/simple/runme.rb +++ /dev/null @@ -1,27 +0,0 @@ -# Draw some simple shapes -puts "Drawing some basic shapes" -require 'simple' - -cmap = Simple.new_ColorMap() -f = Simple.new_FrameBuffer(400,400) - -# Clear the picture -Simple.FrameBuffer_clear(f,Simple::BLACK) - -# Make a red box -Simple.FrameBuffer_box(f,40,40,200,200,Simple::RED) - -# Make a blue circle -Simple.FrameBuffer_circle(f,200,200,40,Simple::BLUE) - -# Make green line -Simple.FrameBuffer_line(f,10,390,390,200, Simple::GREEN) - -# Write an image out to disk - -Simple.FrameBuffer_writeGIF(f,cmap,"image.gif") -puts "Wrote image.gif" - -Simple.delete_FrameBuffer(f) -Simple.delete_ColorMap(cmap) - diff --git a/Examples/GIFPlot/Ruby/simple/simple.i b/Examples/GIFPlot/Ruby/simple/simple.i deleted file mode 100644 index 457bc4c09..000000000 --- a/Examples/GIFPlot/Ruby/simple/simple.i +++ /dev/null @@ -1,38 +0,0 @@ -/* This example shows a very simple interface wrapping a few - primitive declarations */ - -%module simple -%{ -#include "gifplot.h" -%} - -typedef unsigned char Pixel; - -/* Here are a few useful functions */ - -ColorMap *new_ColorMap(char *filename = 0); -void delete_ColorMap(ColorMap *cmap); - -FrameBuffer *new_FrameBuffer(unsigned int width, unsigned int height); -void delete_FrameBuffer(FrameBuffer *frame); -void FrameBuffer_clear(FrameBuffer *frame, Pixel color); -void FrameBuffer_line(FrameBuffer *frame, int x1, int y1, int x2, int y2, Pixel color); -void FrameBuffer_box(FrameBuffer *frame, int x1, int y1, int x2, int y2, Pixel color); -void FrameBuffer_circle(FrameBuffer *frame, int x1, int y1, int radius, Pixel color); -int FrameBuffer_writeGIF(FrameBuffer *f, ColorMap *c, char *filename); - -/* And some useful constants */ - -#define BLACK 0 -#define WHITE 1 -#define RED 2 -#define GREEN 3 -#define BLUE 4 -#define YELLOW 5 -#define CYAN 6 -#define MAGENTA 7 - - - - - diff --git a/Examples/GIFPlot/Tcl/check.list b/Examples/GIFPlot/Tcl/check.list deleted file mode 100644 index 2b6e3d28a..000000000 --- a/Examples/GIFPlot/Tcl/check.list +++ /dev/null @@ -1,4 +0,0 @@ -# see top-level Makefile.in -full -mandel -simple diff --git a/Examples/GIFPlot/Tcl/full/Makefile b/Examples/GIFPlot/Tcl/full/Makefile deleted file mode 100644 index 0c016e364..000000000 --- a/Examples/GIFPlot/Tcl/full/Makefile +++ /dev/null @@ -1,24 +0,0 @@ -TOP = ../../.. -SWIG = $(TOP)/../swig -SWIGOPT = -I../../Include -SRCS = -TARGET = gifplot -INTERFACE = gifplot.i -LIBS = -L../.. -lgifplot -INCLUDES = -I../../Include - -all:: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ - INCLUDES='$(INCLUDES)' LIBS='$(LIBS)' SWIGOPT='$(SWIGOPT)' \ - TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' tcl - -static:: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ - INCLUDES='$(INCLUDES)' LIBS='$(LIBS)' SWIGOPT='$(SWIGOPT)' \ - TARGET='mytclsh' INTERFACE='$(INTERFACE)' tclsh - -clean:: - $(MAKE) -f $(TOP)/Makefile tcl_clean - rm -f *.gif - -check: all diff --git a/Examples/GIFPlot/Tcl/full/README b/Examples/GIFPlot/Tcl/full/README deleted file mode 100644 index bdba4e8b0..000000000 --- a/Examples/GIFPlot/Tcl/full/README +++ /dev/null @@ -1,8 +0,0 @@ -This example runs the entire gifplot.h header file through SWIG without -any changes. The script 'runme.tcl' does something a little more -interesting. You'll have to go look at the header file to get a complete -listing of the functions. - - - - diff --git a/Examples/GIFPlot/Tcl/full/cmap b/Examples/GIFPlot/Tcl/full/cmap deleted file mode 100644 index a20c331a9573dd8443380680bfe2cc428780d8a9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 768 zcmZQzpd(=A5)hSEP}Mdtvvzdz4h)M)OwTDSuW4%Uoiu&!q7`d5@7R0z#JS5i?>&C` z?#s{r^Z@9-XXO?YlTlLFHMX#G@$?UkN=VBFxv-;m^2~WlR;}N<`@pd?7q8!a^y1xT znmh34m-nxpKDd4D;+bOy_iW#^cE#d(Gbi_Tw$xXZ7G$R-M27|XxI5We80l&#%Snpx zbFrd(h8Vt}lCeu@T6xFJRlCpJeMef510DGC$^DyG&YwK8f9IC 239} { set c 239 } - Plot3D_solidquad $p3 $x $y $z1 [expr {$x+$dx}] $y $z2 [expr {$x+$dx}] [expr {$y+$dy}] $z3 $x [expr {$y+$dy}] $z4 [expr {$c+16}] - set y [expr {$y + $dy}] - } - set x [expr {$x + $dx}] - } -} - -puts "Making a nice 3D plot..." -drawsolid - -FrameBuffer_writeGIF $frame $cmap "image.gif" -puts "Wrote image.gif" - diff --git a/Examples/GIFPlot/Tcl/mandel/Makefile b/Examples/GIFPlot/Tcl/mandel/Makefile deleted file mode 100644 index 9280d7bb2..000000000 --- a/Examples/GIFPlot/Tcl/mandel/Makefile +++ /dev/null @@ -1,24 +0,0 @@ -TOP = ../../.. -SWIG = $(TOP)/../swig -SWIGOPT = -I../../Interface -SRCS = -TARGET = gifplot -INTERFACE = mandel.i -LIBS = -L../.. -lgifplot -INCLUDES = -I../../Include - -all:: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ - INCLUDES='$(INCLUDES)' LIBS='$(LIBS)' SWIGOPT='$(SWIGOPT)' \ - TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' tcl - -static:: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ - INCLUDES='$(INCLUDES)' LIBS='$(LIBS)' SWIGOPT='$(SWIGOPT)' \ - TARGET='mywish' INTERFACE='$(INTERFACE)' wish - -clean:: - $(MAKE) -f $(TOP)/Makefile tcl_clean - rm -f *.gif - -check: all diff --git a/Examples/GIFPlot/Tcl/mandel/README b/Examples/GIFPlot/Tcl/mandel/README deleted file mode 100644 index a533d09b8..000000000 --- a/Examples/GIFPlot/Tcl/mandel/README +++ /dev/null @@ -1,6 +0,0 @@ -Kill lots of time exploring the Mandelbrot set. This example uses -the full SWIG interface file located in ../../Interface. To run -the program, type 'wish mandel.tcl'. - - - diff --git a/Examples/GIFPlot/Tcl/mandel/cmap b/Examples/GIFPlot/Tcl/mandel/cmap deleted file mode 100644 index a20c331a9573dd8443380680bfe2cc428780d8a9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 768 zcmZQzpd(=A5)hSEP}Mdtvvzdz4h)M)OwTDSuW4%Uoiu&!q7`d5@7R0z#JS5i?>&C` z?#s{r^Z@9-XXO?YlTlLFHMX#G@$?UkN=VBFxv-;m^2~WlR;}N<`@pd?7q8!a^y1xT znmh34m-nxpKDd4D;+bOy_iW#^cE#d(Gbi_Tw$xXZ7G$R-M27|XxI5We80l&#%Snpx zbFrd(h8Vt}lCeu@T6xFJRlCpJeMef510DGC$^DyG&YwK8f9IC {BoxBegin %W %x %y} - bind $c {BoxDrag %W %x %y} - bind $c "BoxFinish %W %x %y $p2 $mxmin $mymin $mxmax $mymax $func" -} - -proc BoxBegin {w x y} { - global box - set box(anchor) [list $x $y] - catch {unset box(last)} -} - -proc BoxDrag { w x y} { - global box - catch {$w delete $box(last)} - set box(last) [eval {$w create rect} $box(anchor) {$x $y -tag box -outline white}] -} - -proc BoxFinish {w x y p2 mxmin mymin mxmax mymax func } { - global box - set start $box(anchor) - set x1 [lrange $start 0 0] - set y1 [lrange $start 1 1] - catch {$w delete $box(last)} -# Call the handler function - $func $p2 $mxmin $mymin $mxmax $mymax $x1 $y1 $x $y -} - -proc display_image {filename p2 handler} { - global __imageno __images - set i [image create photo -file $filename] - set tl .image$__imageno - toplevel $tl - frame $tl.img - frame $tl.button - - set width [image width $i] - set height [image height $i] - canvas $tl.img.c -width [expr {$width+0}] -height [expr {$height+0}] - pack $tl.img.c - $tl.img.c create image 0 0 -image $i -anchor nw - label $tl.button.label -text $filename - pack $tl.button.label -side left - button $tl.button.dismiss -text "Dismiss" -command "dismiss $tl $i" -width 10 - pack $tl.button.dismiss -side right - pack $tl.img $tl.button -side top -fill x - BoxInit $tl.img.c $p2 [$p2 cget -xmin] [$p2 cget -ymin] [$p2 cget -xmax] [$p2 cget -ymax] $handler - bind $tl "dismiss $tl $i" - bind $tl "dismiss $tl $i" - - # Bind some actions to the canvas - - incr __imageno 1 -} - -proc test {} { - puts "hello" -} - diff --git a/Examples/GIFPlot/Tcl/mandel/mandel.i b/Examples/GIFPlot/Tcl/mandel/mandel.i deleted file mode 100644 index 0b19f4727..000000000 --- a/Examples/GIFPlot/Tcl/mandel/mandel.i +++ /dev/null @@ -1,47 +0,0 @@ -// Special module to run the mandlebrot set -%module gifplot -%include gifplot.i - -%inline %{ - -void mandel(Plot2D *p2, int tol) { - double scalingx; - double scalingy; - double zr,zi,ztr,zti,cr,ci; - double cscale; - int i,j,n; - FrameBuffer *f; - - f = p2->frame; - scalingx = (p2->xmax-p2->xmin)/f->width; - scalingy = (p2->ymax-p2->ymin)/f->height; - - cscale = 239.0/tol; - printf("working...\n"); - for (i = 0; i < f->width; i++) { - for (j = 0; j < f->height; j++) { - zr = scalingx*i + p2->xmin; - zi = scalingy*j + p2->ymin; - cr = zr; - ci = zi; - n = 0; - while (n < tol) { - ztr = zr*zr-zi*zi + cr; - zti = 2*zr*zi + ci; - zr = ztr; - zi = zti; - if (ztr*ztr + zti*zti > 20) break; - n = n + 1; - } - - if (n >= tol) FrameBuffer_plot(f,i,j,BLACK); - else FrameBuffer_plot(f,i,j,16+(int) (n*cscale)); - } - if ((i % 10) == 0) printf("%d\n",i); - } - -} - -%} - - diff --git a/Examples/GIFPlot/Tcl/mandel/mandel.tcl b/Examples/GIFPlot/Tcl/mandel/mandel.tcl deleted file mode 100644 index 3e1600bc1..000000000 --- a/Examples/GIFPlot/Tcl/mandel/mandel.tcl +++ /dev/null @@ -1,170 +0,0 @@ -catch { load ./gifplot[info sharedlibextension] } -source display.tcl -set tcl_precision 17 -set f [FrameBuffer -args 400 400] -set cmap [ColorMap -args cmap] -set p2 [Plot2D -args $f -3 -2 1 2] - -set xmin -3 -set xmax 1 -set ymin -2.0 -set ymax 2.0 -set tolerance 240 -set filename mandel.gif - -# Make a plot from the above parms - -proc make_plot {} { - global p2 cmap tolerance - global xmin ymin xmax ymax filename - $p2 setrange $xmin $ymin $xmax $ymax - $p2 start - . config -cursor watch - update - mandel $p2 $tolerance - . config -cursor arrow - [$p2 cget -frame] writeGIF $cmap $filename - display_image $filename $p2 set_zoom -} - - -# Take some screen coordinates and set global min and max values - -proc set_zoom {p2 mxmin mymin mxmax mymax x1 y1 x2 y2} { - global xmin ymin xmax ymax - - set frame [$p2 cget -frame] - set width [$frame cget -width] - set height [$frame cget -height] - - if {$x1 < 0} {set x1 0} - if {$x1 > ($width)} {set x1 $width} - if {$x2 < 0} {set x2 0} - if {$x2 > ($width)} {set x2 $width} - if {$x1 < $x2} {set ixmin $x1; set ixmax $x2} {set ixmin $x2; set ixmax $x1} - - if {$y1 < 0} {set y1 0} - if {$y1 > ($height)} {set y1 $height} - if {$y2 < 0} {set y2 0} - if {$y2 > ($height)} {set y2 $height} - if {$y1 < $y2} {set iymin $y1; set iymax $y2} {set iymin $y2; set iymax $y1} - - # Now determine new min and max values based on screen location - - set xmin [expr {$mxmin + ($mxmax-$mxmin)*($ixmin)/($width)}] - set xmax [expr {$mxmin + ($mxmax-$mxmin)*($ixmax)/($width)}] - set ymin [expr {$mymin + ($mymax-$mymin)*(($height)-($iymax))/($height)}] - set ymax [expr {$mymin + ($mymax-$mymin)*(($height)-($iymin))/($height)}] - - catch {make_plot} -} - -# Box drag constrained to a square -proc BoxDrag { w x y} { - global box - catch {$w delete $box(last)} - set x1 [lrange $box(anchor) 0 0] - set y1 [lrange $box(anchor) 1 1] - set dx [expr {$x - $x1}] - set dy [expr {$y - $y1}] - if {abs($dy) > abs($dx)} {set dx $dy} - set newx [expr {$x1 + $dx}] - set newy [expr {$y1 + $dx}] - set box(last) [eval {$w create rect} $box(anchor) {$newx $newy -tag box -outline white}] -} - - -proc BoxFinish {w x y p2 mxmin mymin mxmax mymax func } { - global box - set start $box(anchor) - set x1 [lrange $box(anchor) 0 0] - set y1 [lrange $box(anchor) 1 1] - set dx [expr {$x - $x1}] - set dy [expr {$y - $y1}] - if {($dx == 0) || ($dy == 0)} { - catch {$w delete $box(last)} - return - } - if {abs($dy) > abs($dx)} {set dx $dy} - set newx [expr {$x1 + $dx}] - set newy [expr {$y1 + $dx}] - $w config -cursor watch - update -# Call the handler function - $func $p2 $mxmin $mymin $mxmax $mymax $x1 $y1 $newx $newy - catch {$w delete $box(last)} - $w config -cursor arrow -} - - -# Create a few frames - -wm title . Mandelbrot -frame .title -relief groove -borderwidth 1 -label .title.name -text "Mandelbrot Set" -button .title.quit -text "Quit" -command "exit" -button .title.about -text "About" -command "about" -pack .title.name -side left -pack .title.quit .title.about -side right - -frame .func -relief groove -borderwidth 1 - -frame .func.xrange -label .func.xrange.xrlabel -text "X range" -width 12 -entry .func.xrange.xmin -textvar xmin -width 8 -label .func.xrange.xtolabel -text "to" -entry .func.xrange.xmax -textvar xmax -width 8 -pack .func.xrange.xrlabel .func.xrange.xmin .func.xrange.xtolabel .func.xrange.xmax -side left - -frame .func.yrange -label .func.yrange.yrlabel -text "Y range" -width 12 -entry .func.yrange.ymin -textvar ymin -width 8 -label .func.yrange.ytolabel -text "to" -entry .func.yrange.ymax -textvar ymax -width 8 -pack .func.yrange.yrlabel .func.yrange.ymin .func.yrange.ytolabel .func.yrange.ymax -side left - -frame .func.npoints -label .func.npoints.label -text "Tolerance " -width 12 -entry .func.npoints.npoints -textvar tolerance -width 8 -scale .func.npoints.scale -from 0 -to 2500 -variable tolerance -orient horizontal -showvalue false \ - -sliderlength 13 -bigincrement 10 -resolution 10 -pack .func.npoints.label .func.npoints.npoints .func.npoints.scale -side left - -pack .func.xrange .func.yrange .func.npoints -side top -fill x - -# Filename dialog - -frame .save -relief groove -borderwidth 1 - -frame .save.file -label .save.file.label -text "Save as" -width 12 -entry .save.file.filename -textvar filename -width 20 -pack .save.file.label .save.file.filename -side left -pack .save.file -side left -fill x -button .save.go -text "Plot" -command "make_plot" -pack .save.go -side right - -bind .save.file.filename {make_plot} - -pack .title .func .save -side top -fill both - -proc about { } { - toplevel .about -width 350 - - message .about.m -text "\ -Mandelbrot Set\n\n\ -Copyright (c) 1997\n\ -Dave Beazley\n\ -University of Utah\n\n\ -Creates a plot of the Mandelbrot set. Any displayed image can be zoomed by clicking and \ -dragging. Although the main calculation is written in C, it may take awhile for each \ -image to be calculated (be patient). Image quality can be improved at the expense of speed \ -by increasing the tolerance value.\n" - -button .about.okay -text "Ok" -command {destroy .about} - -pack .about.m .about.okay -side top -focus .about.okay -} - -make_plot diff --git a/Examples/GIFPlot/Tcl/simple/Makefile b/Examples/GIFPlot/Tcl/simple/Makefile deleted file mode 100644 index 752d79c10..000000000 --- a/Examples/GIFPlot/Tcl/simple/Makefile +++ /dev/null @@ -1,24 +0,0 @@ -TOP = ../../.. -SWIG = $(TOP)/../swig -SWIGOPT = -SRCS = -TARGET = simple -INTERFACE = simple.i -LIBS = -L../.. -lgifplot -INCLUDES = -I../../Include - -all:: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ - INCLUDES='$(INCLUDES)' LIBS='$(LIBS)' SWIGOPT='$(SWIGOPT)' \ - TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' tcl - -static:: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ - INCLUDES='$(INCLUDES)' LIBS='$(LIBS)' SWIGOPT='$(SWIGOPT)' \ - TARGET='mytclsh' INTERFACE='$(INTERFACE)' tclsh - -clean:: - $(MAKE) -f $(TOP)/Makefile tcl_clean - rm -f *.gif - -check: all diff --git a/Examples/GIFPlot/Tcl/simple/README b/Examples/GIFPlot/Tcl/simple/README deleted file mode 100644 index d6b291c92..000000000 --- a/Examples/GIFPlot/Tcl/simple/README +++ /dev/null @@ -1,5 +0,0 @@ -This is a very minimalistic example in which just a few functions -and constants from library are wrapped and used to draw some simple -shapes. The script 'runme.tcl' runs the example. - - diff --git a/Examples/GIFPlot/Tcl/simple/runme.tcl b/Examples/GIFPlot/Tcl/simple/runme.tcl deleted file mode 100644 index e3f41266c..000000000 --- a/Examples/GIFPlot/Tcl/simple/runme.tcl +++ /dev/null @@ -1,27 +0,0 @@ -# Draw some simple shapes -puts "Drawing some basic shapes" - -catch { load ./simple[info sharedlibextension] simple} - -set cmap [new_ColorMap] -set f [new_FrameBuffer 400 400] - -# Clear the picture -FrameBuffer_clear $f $BLACK - -# Make a red box -FrameBuffer_box $f 40 40 200 200 $RED - -# Make a blue circle -FrameBuffer_circle $f 200 200 40 $BLUE - -# Make green line -FrameBuffer_line $f 10 390 390 200 $GREEN - -# Write an image out to disk -FrameBuffer_writeGIF $f $cmap image.gif -puts "Wrote image.gif" - -delete_FrameBuffer $f -delete_ColorMap $cmap - diff --git a/Examples/GIFPlot/Tcl/simple/simple.i b/Examples/GIFPlot/Tcl/simple/simple.i deleted file mode 100644 index 457bc4c09..000000000 --- a/Examples/GIFPlot/Tcl/simple/simple.i +++ /dev/null @@ -1,38 +0,0 @@ -/* This example shows a very simple interface wrapping a few - primitive declarations */ - -%module simple -%{ -#include "gifplot.h" -%} - -typedef unsigned char Pixel; - -/* Here are a few useful functions */ - -ColorMap *new_ColorMap(char *filename = 0); -void delete_ColorMap(ColorMap *cmap); - -FrameBuffer *new_FrameBuffer(unsigned int width, unsigned int height); -void delete_FrameBuffer(FrameBuffer *frame); -void FrameBuffer_clear(FrameBuffer *frame, Pixel color); -void FrameBuffer_line(FrameBuffer *frame, int x1, int y1, int x2, int y2, Pixel color); -void FrameBuffer_box(FrameBuffer *frame, int x1, int y1, int x2, int y2, Pixel color); -void FrameBuffer_circle(FrameBuffer *frame, int x1, int y1, int radius, Pixel color); -int FrameBuffer_writeGIF(FrameBuffer *f, ColorMap *c, char *filename); - -/* And some useful constants */ - -#define BLACK 0 -#define WHITE 1 -#define RED 2 -#define GREEN 3 -#define BLUE 4 -#define YELLOW 5 -#define CYAN 6 -#define MAGENTA 7 - - - - - diff --git a/Examples/chicken/zlib/Makefile b/Examples/chicken/zlib/Makefile deleted file mode 100644 index 720701444..000000000 --- a/Examples/chicken/zlib/Makefile +++ /dev/null @@ -1,28 +0,0 @@ -TOP = ../.. -SWIG = $(TOP)/../preinst-swig -INTERFACE = example.i -SRCS = -CXXSRCS = -TARGET = zlib -INCLUDE = -SWIGOPT = -I/usr/include -CFLAGS = -VARIANT = -LIBS = -lz -VARIANT = _direct - -all:: $(TARGET) - -$(TARGET): $(INTERFACE) $(SRCS) - $(MAKE) -f $(TOP)/Makefile \ - SRCS='$(SRCS)' CXXSRCS='$(CXXSRCS)' \ - INCLUDE='$(INCLUDE)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' TARGET='$(TARGET)' \ - SWIG='$(SWIG)' INTERFACE='$(INTERFACE)' CHICKENOPTS='$(CHICKENOPTS)' chicken$(VARIANT) - -clean:: - $(MAKE) -f $(TOP)/Makefile chicken_clean - rm -f example.scm - rm -f $(TARGET) - -check:: - csi test-zlib.scm diff --git a/Examples/chicken/zlib/README.html b/Examples/chicken/zlib/README.html deleted file mode 100644 index b082a310c..000000000 --- a/Examples/chicken/zlib/README.html +++ /dev/null @@ -1,1666 +0,0 @@ - - - - zlib - Chicken - SWIG example - - -

    zlib - Chicken - SWIG

    - -

    Table of Contents

    - Building the example
    - zlib.h
    - How the zlib wrapper was developed
    - -

    Building the example

    - - zlib must be installed for this example to work.
    - - Just type make to build this example.
    - - If zlib is not installed in /usr/lib and /usr/include, then do - something similar to the following: - -
    -
    make SWIGOPT="-I/usr/local/include" LIBS="-L/usr/local/lib -lz"
    -
    - -

    zlib.h

    -
    -
    -001: /* zlib.h -- interface of the 'zlib' general purpose compression library
    -002:   version 1.1.4, March 11th, 2002
    -003: 
    -004:   Copyright (C) 1995-2002 Jean-loup Gailly and Mark Adler
    -005: 
    -006:   This software is provided 'as-is', without any express or implied
    -007:   warranty.  In no event will the authors be held liable for any damages
    -008:   arising from the use of this software.
    -009: 
    -010:   Permission is granted to anyone to use this software for any purpose,
    -011:   including commercial applications, and to alter it and redistribute it
    -012:   freely, subject to the following restrictions:
    -013: 
    -014:   1. The origin of this software must not be misrepresented; you must not
    -015:      claim that you wrote the original software. If you use this software
    -016:      in a product, an acknowledgment in the product documentation would be
    -017:      appreciated but is not required.
    -018:   2. Altered source versions must be plainly marked as such, and must not be
    -019:      misrepresented as being the original software.
    -020:   3. This notice may not be removed or altered from any source distribution.
    -021: 
    -022:   Jean-loup Gailly        Mark Adler
    -023:   jloup@gzip.org          madler@alumni.caltech.edu
    -024: 
    -025: 
    -026:   The data format used by the zlib library is described by RFCs (Request for
    -027:   Comments) 1950 to 1952 in the files ftp://ds.internic.net/rfc/rfc1950.txt
    -028:   (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format).
    -029: */
    -030: 
    -031: #ifndef _ZLIB_H
    -032: #define _ZLIB_H
    -033: 
    -034: #include "zconf.h"
    -035: 
    -036: #ifdef __cplusplus
    -037: extern "C" {
    -038: #endif
    -039: 
    -040: #define ZLIB_VERSION "1.1.4"
    -041: 
    -042: /* 
    -043:      The 'zlib' compression library provides in-memory compression and
    -044:   decompression functions, including integrity checks of the uncompressed
    -045:   data.  This version of the library supports only one compression method
    -046:   (deflation) but other algorithms will be added later and will have the same
    -047:   stream interface.
    -048: 
    -049:      Compression can be done in a single step if the buffers are large
    -050:   enough (for example if an input file is mmap'ed), or can be done by
    -051:   repeated calls of the compression function.  In the latter case, the
    -052:   application must provide more input and/or consume the output
    -053:   (providing more output space) before each call.
    -054: 
    -055:      The library also supports reading and writing files in gzip (.gz) format
    -056:   with an interface similar to that of stdio.
    -057: 
    -058:      The library does not install any signal handler. The decoder checks
    -059:   the consistency of the compressed data, so the library should never
    -060:   crash even in case of corrupted input.
    -061: */
    -062: 
    -063: typedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size));
    -064: typedef void   (*free_func)  OF((voidpf opaque, voidpf address));
    -065: 
    -066: struct internal_state;
    -067: 
    -068: typedef struct z_stream_s {
    -069:     Bytef    *next_in;  /* next input byte */
    -070:     uInt     avail_in;  /* number of bytes available at next_in */
    -071:     uLong    total_in;  /* total nb of input bytes read so far */
    -072: 
    -073:     Bytef    *next_out; /* next output byte should be put there */
    -074:     uInt     avail_out; /* remaining free space at next_out */
    -075:     uLong    total_out; /* total nb of bytes output so far */
    -076: 
    -077:     char     *msg;      /* last error message, NULL if no error */
    -078:     struct internal_state FAR *state; /* not visible by applications */
    -079: 
    -080:     alloc_func zalloc;  /* used to allocate the internal state */
    -081:     free_func  zfree;   /* used to free the internal state */
    -082:     voidpf     opaque;  /* private data object passed to zalloc and zfree */
    -083: 
    -084:     int     data_type;  /* best guess about the data type: ascii or binary */
    -085:     uLong   adler;      /* adler32 value of the uncompressed data */
    -086:     uLong   reserved;   /* reserved for future use */
    -087: } z_stream;
    -088: 
    -089: typedef z_stream FAR *z_streamp;
    -090: 
    -091: /*
    -092:    The application must update next_in and avail_in when avail_in has
    -093:    dropped to zero. It must update next_out and avail_out when avail_out
    -094:    has dropped to zero. The application must initialize zalloc, zfree and
    -095:    opaque before calling the init function. All other fields are set by the
    -096:    compression library and must not be updated by the application.
    -097: 
    -098:    The opaque value provided by the application will be passed as the first
    -099:    parameter for calls of zalloc and zfree. This can be useful for custom
    -100:    memory management. The compression library attaches no meaning to the
    -101:    opaque value.
    -102: 
    -103:    zalloc must return Z_NULL if there is not enough memory for the object.
    -104:    If zlib is used in a multi-threaded application, zalloc and zfree must be
    -105:    thread safe.
    -106: 
    -107:    On 16-bit systems, the functions zalloc and zfree must be able to allocate
    -108:    exactly 65536 bytes, but will not be required to allocate more than this
    -109:    if the symbol MAXSEG_64K is defined (see zconf.h). WARNING: On MSDOS,
    -110:    pointers returned by zalloc for objects of exactly 65536 bytes *must*
    -111:    have their offset normalized to zero. The default allocation function
    -112:    provided by this library ensures this (see zutil.c). To reduce memory
    -113:    requirements and avoid any allocation of 64K objects, at the expense of
    -114:    compression ratio, compile the library with -DMAX_WBITS=14 (see zconf.h).
    -115: 
    -116:    The fields total_in and total_out can be used for statistics or
    -117:    progress reports. After compression, total_in holds the total size of
    -118:    the uncompressed data and may be saved for use in the decompressor
    -119:    (particularly if the decompressor wants to decompress everything in
    -120:    a single step).
    -121: */
    -122: 
    -123:                         /* constants */
    -124: 
    -125: #define Z_NO_FLUSH      0
    -126: #define Z_PARTIAL_FLUSH 1 /* will be removed, use Z_SYNC_FLUSH instead */
    -127: #define Z_SYNC_FLUSH    2
    -128: #define Z_FULL_FLUSH    3
    -129: #define Z_FINISH        4
    -130: /* Allowed flush values; see deflate() below for details */
    -131: 
    -132: #define Z_OK            0
    -133: #define Z_STREAM_END    1
    -134: #define Z_NEED_DICT     2
    -135: #define Z_ERRNO        (-1)
    -136: #define Z_STREAM_ERROR (-2)
    -137: #define Z_DATA_ERROR   (-3)
    -138: #define Z_MEM_ERROR    (-4)
    -139: #define Z_BUF_ERROR    (-5)
    -140: #define Z_VERSION_ERROR (-6)
    -141: /* Return codes for the compression/decompression functions. Negative
    -142:  * values are errors, positive values are used for special but normal events.
    -143:  */
    -144: 
    -145: #define Z_NO_COMPRESSION         0
    -146: #define Z_BEST_SPEED             1
    -147: #define Z_BEST_COMPRESSION       9
    -148: #define Z_DEFAULT_COMPRESSION  (-1)
    -149: /* compression levels */
    -150: 
    -151: #define Z_FILTERED            1
    -152: #define Z_HUFFMAN_ONLY        2
    -153: #define Z_DEFAULT_STRATEGY    0
    -154: /* compression strategy; see deflateInit2() below for details */
    -155: 
    -156: #define Z_BINARY   0
    -157: #define Z_ASCII    1
    -158: #define Z_UNKNOWN  2
    -159: /* Possible values of the data_type field */
    -160: 
    -161: #define Z_DEFLATED   8
    -162: /* The deflate compression method (the only one supported in this version) */
    -163: 
    -164: #define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
    -165: 
    -166: #define zlib_version zlibVersion()
    -167: /* for compatibility with versions < 1.0.2 */
    -168: 
    -169:                         /* basic functions */
    -170: 
    -171: ZEXTERN const char * ZEXPORT zlibVersion OF((void));
    -172: /* The application can compare zlibVersion and ZLIB_VERSION for consistency.
    -173:    If the first character differs, the library code actually used is
    -174:    not compatible with the zlib.h header file used by the application.
    -175:    This check is automatically made by deflateInit and inflateInit.
    -176:  */
    -177: 
    -178: /* 
    -179: ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level));
    -180: 
    -181:      Initializes the internal stream state for compression. The fields
    -182:    zalloc, zfree and opaque must be initialized before by the caller.
    -183:    If zalloc and zfree are set to Z_NULL, deflateInit updates them to
    -184:    use default allocation functions.
    -185: 
    -186:      The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9:
    -187:    1 gives best speed, 9 gives best compression, 0 gives no compression at
    -188:    all (the input data is simply copied a block at a time).
    -189:    Z_DEFAULT_COMPRESSION requests a default compromise between speed and
    -190:    compression (currently equivalent to level 6).
    -191: 
    -192:      deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not
    -193:    enough memory, Z_STREAM_ERROR if level is not a valid compression level,
    -194:    Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible
    -195:    with the version assumed by the caller (ZLIB_VERSION).
    -196:    msg is set to null if there is no error message.  deflateInit does not
    -197:    perform any compression: this will be done by deflate().
    -198: */
    -199: 
    -200: 
    -201: ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush));
    -202: /*
    -203:     deflate compresses as much data as possible, and stops when the input
    -204:   buffer becomes empty or the output buffer becomes full. It may introduce some
    -205:   output latency (reading input without producing any output) except when
    -206:   forced to flush.
    -207: 
    -208:     The detailed semantics are as follows. deflate performs one or both of the
    -209:   following actions:
    -210: 
    -211:   - Compress more input starting at next_in and update next_in and avail_in
    -212:     accordingly. If not all input can be processed (because there is not
    -213:     enough room in the output buffer), next_in and avail_in are updated and
    -214:     processing will resume at this point for the next call of deflate().
    -215: 
    -216:   - Provide more output starting at next_out and update next_out and avail_out
    -217:     accordingly. This action is forced if the parameter flush is non zero.
    -218:     Forcing flush frequently degrades the compression ratio, so this parameter
    -219:     should be set only when necessary (in interactive applications).
    -220:     Some output may be provided even if flush is not set.
    -221: 
    -222:   Before the call of deflate(), the application should ensure that at least
    -223:   one of the actions is possible, by providing more input and/or consuming
    -224:   more output, and updating avail_in or avail_out accordingly; avail_out
    -225:   should never be zero before the call. The application can consume the
    -226:   compressed output when it wants, for example when the output buffer is full
    -227:   (avail_out == 0), or after each call of deflate(). If deflate returns Z_OK
    -228:   and with zero avail_out, it must be called again after making room in the
    -229:   output buffer because there might be more output pending.
    -230: 
    -231:     If the parameter flush is set to Z_SYNC_FLUSH, all pending output is
    -232:   flushed to the output buffer and the output is aligned on a byte boundary, so
    -233:   that the decompressor can get all input data available so far. (In particular
    -234:   avail_in is zero after the call if enough output space has been provided
    -235:   before the call.)  Flushing may degrade compression for some compression
    -236:   algorithms and so it should be used only when necessary.
    -237: 
    -238:     If flush is set to Z_FULL_FLUSH, all output is flushed as with
    -239:   Z_SYNC_FLUSH, and the compression state is reset so that decompression can
    -240:   restart from this point if previous compressed data has been damaged or if
    -241:   random access is desired. Using Z_FULL_FLUSH too often can seriously degrade
    -242:   the compression.
    -243: 
    -244:     If deflate returns with avail_out == 0, this function must be called again
    -245:   with the same value of the flush parameter and more output space (updated
    -246:   avail_out), until the flush is complete (deflate returns with non-zero
    -247:   avail_out).
    -248: 
    -249:     If the parameter flush is set to Z_FINISH, pending input is processed,
    -250:   pending output is flushed and deflate returns with Z_STREAM_END if there
    -251:   was enough output space; if deflate returns with Z_OK, this function must be
    -252:   called again with Z_FINISH and more output space (updated avail_out) but no
    -253:   more input data, until it returns with Z_STREAM_END or an error. After
    -254:   deflate has returned Z_STREAM_END, the only possible operations on the
    -255:   stream are deflateReset or deflateEnd.
    -256:   
    -257:     Z_FINISH can be used immediately after deflateInit if all the compression
    -258:   is to be done in a single step. In this case, avail_out must be at least
    -259:   0.1% larger than avail_in plus 12 bytes.  If deflate does not return
    -260:   Z_STREAM_END, then it must be called again as described above.
    -261: 
    -262:     deflate() sets strm->adler to the adler32 checksum of all input read
    -263:   so far (that is, total_in bytes).
    -264: 
    -265:     deflate() may update data_type if it can make a good guess about
    -266:   the input data type (Z_ASCII or Z_BINARY). In doubt, the data is considered
    -267:   binary. This field is only for information purposes and does not affect
    -268:   the compression algorithm in any manner.
    -269: 
    -270:     deflate() returns Z_OK if some progress has been made (more input
    -271:   processed or more output produced), Z_STREAM_END if all input has been
    -272:   consumed and all output has been produced (only when flush is set to
    -273:   Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example
    -274:   if next_in or next_out was NULL), Z_BUF_ERROR if no progress is possible
    -275:   (for example avail_in or avail_out was zero).
    -276: */
    -277: 
    -278: 
    -279: ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm));
    -280: /*
    -281:      All dynamically allocated data structures for this stream are freed.
    -282:    This function discards any unprocessed input and does not flush any
    -283:    pending output.
    -284: 
    -285:      deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the
    -286:    stream state was inconsistent, Z_DATA_ERROR if the stream was freed
    -287:    prematurely (some input or output was discarded). In the error case,
    -288:    msg may be set but then points to a static string (which must not be
    -289:    deallocated).
    -290: */
    -291: 
    -292: 
    -293: /* 
    -294: ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm));
    -295: 
    -296:      Initializes the internal stream state for decompression. The fields
    -297:    next_in, avail_in, zalloc, zfree and opaque must be initialized before by
    -298:    the caller. If next_in is not Z_NULL and avail_in is large enough (the exact
    -299:    value depends on the compression method), inflateInit determines the
    -300:    compression method from the zlib header and allocates all data structures
    -301:    accordingly; otherwise the allocation will be deferred to the first call of
    -302:    inflate.  If zalloc and zfree are set to Z_NULL, inflateInit updates them to
    -303:    use default allocation functions.
    -304: 
    -305:      inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough
    -306:    memory, Z_VERSION_ERROR if the zlib library version is incompatible with the
    -307:    version assumed by the caller.  msg is set to null if there is no error
    -308:    message. inflateInit does not perform any decompression apart from reading
    -309:    the zlib header if present: this will be done by inflate().  (So next_in and
    -310:    avail_in may be modified, but next_out and avail_out are unchanged.)
    -311: */
    -312: 
    -313: 
    -314: ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush));
    -315: /*
    -316:     inflate decompresses as much data as possible, and stops when the input
    -317:   buffer becomes empty or the output buffer becomes full. It may some
    -318:   introduce some output latency (reading input without producing any output)
    -319:   except when forced to flush.
    -320: 
    -321:   The detailed semantics are as follows. inflate performs one or both of the
    -322:   following actions:
    -323: 
    -324:   - Decompress more input starting at next_in and update next_in and avail_in
    -325:     accordingly. If not all input can be processed (because there is not
    -326:     enough room in the output buffer), next_in is updated and processing
    -327:     will resume at this point for the next call of inflate().
    -328: 
    -329:   - Provide more output starting at next_out and update next_out and avail_out
    -330:     accordingly.  inflate() provides as much output as possible, until there
    -331:     is no more input data or no more space in the output buffer (see below
    -332:     about the flush parameter).
    -333: 
    -334:   Before the call of inflate(), the application should ensure that at least
    -335:   one of the actions is possible, by providing more input and/or consuming
    -336:   more output, and updating the next_* and avail_* values accordingly.
    -337:   The application can consume the uncompressed output when it wants, for
    -338:   example when the output buffer is full (avail_out == 0), or after each
    -339:   call of inflate(). If inflate returns Z_OK and with zero avail_out, it
    -340:   must be called again after making room in the output buffer because there
    -341:   might be more output pending.
    -342: 
    -343:     If the parameter flush is set to Z_SYNC_FLUSH, inflate flushes as much
    -344:   output as possible to the output buffer. The flushing behavior of inflate is
    -345:   not specified for values of the flush parameter other than Z_SYNC_FLUSH
    -346:   and Z_FINISH, but the current implementation actually flushes as much output
    -347:   as possible anyway.
    -348: 
    -349:     inflate() should normally be called until it returns Z_STREAM_END or an
    -350:   error. However if all decompression is to be performed in a single step
    -351:   (a single call of inflate), the parameter flush should be set to
    -352:   Z_FINISH. In this case all pending input is processed and all pending
    -353:   output is flushed; avail_out must be large enough to hold all the
    -354:   uncompressed data. (The size of the uncompressed data may have been saved
    -355:   by the compressor for this purpose.) The next operation on this stream must
    -356:   be inflateEnd to deallocate the decompression state. The use of Z_FINISH
    -357:   is never required, but can be used to inform inflate that a faster routine
    -358:   may be used for the single inflate() call.
    -359: 
    -360:      If a preset dictionary is needed at this point (see inflateSetDictionary
    -361:   below), inflate sets strm-adler to the adler32 checksum of the
    -362:   dictionary chosen by the compressor and returns Z_NEED_DICT; otherwise 
    -363:   it sets strm->adler to the adler32 checksum of all output produced
    -364:   so far (that is, total_out bytes) and returns Z_OK, Z_STREAM_END or
    -365:   an error code as described below. At the end of the stream, inflate()
    -366:   checks that its computed adler32 checksum is equal to that saved by the
    -367:   compressor and returns Z_STREAM_END only if the checksum is correct.
    -368: 
    -369:     inflate() returns Z_OK if some progress has been made (more input processed
    -370:   or more output produced), Z_STREAM_END if the end of the compressed data has
    -371:   been reached and all uncompressed output has been produced, Z_NEED_DICT if a
    -372:   preset dictionary is needed at this point, Z_DATA_ERROR if the input data was
    -373:   corrupted (input stream not conforming to the zlib format or incorrect
    -374:   adler32 checksum), Z_STREAM_ERROR if the stream structure was inconsistent
    -375:   (for example if next_in or next_out was NULL), Z_MEM_ERROR if there was not
    -376:   enough memory, Z_BUF_ERROR if no progress is possible or if there was not
    -377:   enough room in the output buffer when Z_FINISH is used. In the Z_DATA_ERROR
    -378:   case, the application may then call inflateSync to look for a good
    -379:   compression block.
    -380: */
    -381: 
    -382: 
    -383: ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm));
    -384: /*
    -385:      All dynamically allocated data structures for this stream are freed.
    -386:    This function discards any unprocessed input and does not flush any
    -387:    pending output.
    -388: 
    -389:      inflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state
    -390:    was inconsistent. In the error case, msg may be set but then points to a
    -391:    static string (which must not be deallocated).
    -392: */
    -393: 
    -394:                         /* Advanced functions */
    -395: 
    -396: /*
    -397:     The following functions are needed only in some special applications.
    -398: */
    -399: 
    -400: /*   
    -401: ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm,
    -402:                                      int  level,
    -403:                                      int  method,
    -404:                                      int  windowBits,
    -405:                                      int  memLevel,
    -406:                                      int  strategy));
    -407: 
    -408:      This is another version of deflateInit with more compression options. The
    -409:    fields next_in, zalloc, zfree and opaque must be initialized before by
    -410:    the caller.
    -411: 
    -412:      The method parameter is the compression method. It must be Z_DEFLATED in
    -413:    this version of the library.
    -414: 
    -415:      The windowBits parameter is the base two logarithm of the window size
    -416:    (the size of the history buffer).  It should be in the range 8..15 for this
    -417:    version of the library. Larger values of this parameter result in better
    -418:    compression at the expense of memory usage. The default value is 15 if
    -419:    deflateInit is used instead.
    -420: 
    -421:      The memLevel parameter specifies how much memory should be allocated
    -422:    for the internal compression state. memLevel=1 uses minimum memory but
    -423:    is slow and reduces compression ratio; memLevel=9 uses maximum memory
    -424:    for optimal speed. The default value is 8. See zconf.h for total memory
    -425:    usage as a function of windowBits and memLevel.
    -426: 
    -427:      The strategy parameter is used to tune the compression algorithm. Use the
    -428:    value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a
    -429:    filter (or predictor), or Z_HUFFMAN_ONLY to force Huffman encoding only (no
    -430:    string match).  Filtered data consists mostly of small values with a
    -431:    somewhat random distribution. In this case, the compression algorithm is
    -432:    tuned to compress them better. The effect of Z_FILTERED is to force more
    -433:    Huffman coding and less string matching; it is somewhat intermediate
    -434:    between Z_DEFAULT and Z_HUFFMAN_ONLY. The strategy parameter only affects
    -435:    the compression ratio but not the correctness of the compressed output even
    -436:    if it is not set appropriately.
    -437: 
    -438:       deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
    -439:    memory, Z_STREAM_ERROR if a parameter is invalid (such as an invalid
    -440:    method). msg is set to null if there is no error message.  deflateInit2 does
    -441:    not perform any compression: this will be done by deflate().
    -442: */
    -443:                             
    -444: ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm,
    -445:                                              const Bytef *dictionary,
    -446:                                              uInt  dictLength));
    -447: /*
    -448:      Initializes the compression dictionary from the given byte sequence
    -449:    without producing any compressed output. This function must be called
    -450:    immediately after deflateInit, deflateInit2 or deflateReset, before any
    -451:    call of deflate. The compressor and decompressor must use exactly the same
    -452:    dictionary (see inflateSetDictionary).
    -453: 
    -454:      The dictionary should consist of strings (byte sequences) that are likely
    -455:    to be encountered later in the data to be compressed, with the most commonly
    -456:    used strings preferably put towards the end of the dictionary. Using a
    -457:    dictionary is most useful when the data to be compressed is short and can be
    -458:    predicted with good accuracy; the data can then be compressed better than
    -459:    with the default empty dictionary.
    -460: 
    -461:      Depending on the size of the compression data structures selected by
    -462:    deflateInit or deflateInit2, a part of the dictionary may in effect be
    -463:    discarded, for example if the dictionary is larger than the window size in
    -464:    deflate or deflate2. Thus the strings most likely to be useful should be
    -465:    put at the end of the dictionary, not at the front.
    -466: 
    -467:      Upon return of this function, strm->adler is set to the Adler32 value
    -468:    of the dictionary; the decompressor may later use this value to determine
    -469:    which dictionary has been used by the compressor. (The Adler32 value
    -470:    applies to the whole dictionary even if only a subset of the dictionary is
    -471:    actually used by the compressor.)
    -472: 
    -473:      deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a
    -474:    parameter is invalid (such as NULL dictionary) or the stream state is
    -475:    inconsistent (for example if deflate has already been called for this stream
    -476:    or if the compression method is bsort). deflateSetDictionary does not
    -477:    perform any compression: this will be done by deflate().
    -478: */
    -479: 
    -480: ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest,
    -481:                                     z_streamp source));
    -482: /*
    -483:      Sets the destination stream as a complete copy of the source stream.
    -484: 
    -485:      This function can be useful when several compression strategies will be
    -486:    tried, for example when there are several ways of pre-processing the input
    -487:    data with a filter. The streams that will be discarded should then be freed
    -488:    by calling deflateEnd.  Note that deflateCopy duplicates the internal
    -489:    compression state which can be quite large, so this strategy is slow and
    -490:    can consume lots of memory.
    -491: 
    -492:      deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not
    -493:    enough memory, Z_STREAM_ERROR if the source stream state was inconsistent
    -494:    (such as zalloc being NULL). msg is left unchanged in both source and
    -495:    destination.
    -496: */
    -497: 
    -498: ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm));
    -499: /*
    -500:      This function is equivalent to deflateEnd followed by deflateInit,
    -501:    but does not free and reallocate all the internal compression state.
    -502:    The stream will keep the same compression level and any other attributes
    -503:    that may have been set by deflateInit2.
    -504: 
    -505:       deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
    -506:    stream state was inconsistent (such as zalloc or state being NULL).
    -507: */
    -508: 
    -509: ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm,
    -510: 				      int level,
    -511: 				      int strategy));
    -512: /*
    -513:      Dynamically update the compression level and compression strategy.  The
    -514:    interpretation of level and strategy is as in deflateInit2.  This can be
    -515:    used to switch between compression and straight copy of the input data, or
    -516:    to switch to a different kind of input data requiring a different
    -517:    strategy. If the compression level is changed, the input available so far
    -518:    is compressed with the old level (and may be flushed); the new level will
    -519:    take effect only at the next call of deflate().
    -520: 
    -521:      Before the call of deflateParams, the stream state must be set as for
    -522:    a call of deflate(), since the currently available input may have to
    -523:    be compressed and flushed. In particular, strm->avail_out must be non-zero.
    -524: 
    -525:      deflateParams returns Z_OK if success, Z_STREAM_ERROR if the source
    -526:    stream state was inconsistent or if a parameter was invalid, Z_BUF_ERROR
    -527:    if strm->avail_out was zero.
    -528: */
    -529: 
    -530: /*   
    -531: ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm,
    -532:                                      int  windowBits));
    -533: 
    -534:      This is another version of inflateInit with an extra parameter. The
    -535:    fields next_in, avail_in, zalloc, zfree and opaque must be initialized
    -536:    before by the caller.
    -537: 
    -538:      The windowBits parameter is the base two logarithm of the maximum window
    -539:    size (the size of the history buffer).  It should be in the range 8..15 for
    -540:    this version of the library. The default value is 15 if inflateInit is used
    -541:    instead. If a compressed stream with a larger window size is given as
    -542:    input, inflate() will return with the error code Z_DATA_ERROR instead of
    -543:    trying to allocate a larger window.
    -544: 
    -545:       inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
    -546:    memory, Z_STREAM_ERROR if a parameter is invalid (such as a negative
    -547:    memLevel). msg is set to null if there is no error message.  inflateInit2
    -548:    does not perform any decompression apart from reading the zlib header if
    -549:    present: this will be done by inflate(). (So next_in and avail_in may be
    -550:    modified, but next_out and avail_out are unchanged.)
    -551: */
    -552: 
    -553: ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm,
    -554:                                              const Bytef *dictionary,
    -555:                                              uInt  dictLength));
    -556: /*
    -557:      Initializes the decompression dictionary from the given uncompressed byte
    -558:    sequence. This function must be called immediately after a call of inflate
    -559:    if this call returned Z_NEED_DICT. The dictionary chosen by the compressor
    -560:    can be determined from the Adler32 value returned by this call of
    -561:    inflate. The compressor and decompressor must use exactly the same
    -562:    dictionary (see deflateSetDictionary).
    -563: 
    -564:      inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a
    -565:    parameter is invalid (such as NULL dictionary) or the stream state is
    -566:    inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the
    -567:    expected one (incorrect Adler32 value). inflateSetDictionary does not
    -568:    perform any decompression: this will be done by subsequent calls of
    -569:    inflate().
    -570: */
    -571: 
    -572: ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm));
    -573: /* 
    -574:     Skips invalid compressed data until a full flush point (see above the
    -575:   description of deflate with Z_FULL_FLUSH) can be found, or until all
    -576:   available input is skipped. No output is provided.
    -577: 
    -578:     inflateSync returns Z_OK if a full flush point has been found, Z_BUF_ERROR
    -579:   if no more input was provided, Z_DATA_ERROR if no flush point has been found,
    -580:   or Z_STREAM_ERROR if the stream structure was inconsistent. In the success
    -581:   case, the application may save the current current value of total_in which
    -582:   indicates where valid compressed data was found. In the error case, the
    -583:   application may repeatedly call inflateSync, providing more input each time,
    -584:   until success or end of the input data.
    -585: */
    -586: 
    -587: ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm));
    -588: /*
    -589:      This function is equivalent to inflateEnd followed by inflateInit,
    -590:    but does not free and reallocate all the internal decompression state.
    -591:    The stream will keep attributes that may have been set by inflateInit2.
    -592: 
    -593:       inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
    -594:    stream state was inconsistent (such as zalloc or state being NULL).
    -595: */
    -596: 
    -597: 
    -598:                         /* utility functions */
    -599: 
    -600: /*
    -601:      The following utility functions are implemented on top of the
    -602:    basic stream-oriented functions. To simplify the interface, some
    -603:    default options are assumed (compression level and memory usage,
    -604:    standard memory allocation functions). The source code of these
    -605:    utility functions can easily be modified if you need special options.
    -606: */
    -607: 
    -608: ZEXTERN int ZEXPORT compress OF((Bytef *dest,   uLongf *destLen,
    -609:                                  const Bytef *source, uLong sourceLen));
    -610: /*
    -611:      Compresses the source buffer into the destination buffer.  sourceLen is
    -612:    the byte length of the source buffer. Upon entry, destLen is the total
    -613:    size of the destination buffer, which must be at least 0.1% larger than
    -614:    sourceLen plus 12 bytes. Upon exit, destLen is the actual size of the
    -615:    compressed buffer.
    -616:      This function can be used to compress a whole file at once if the
    -617:    input file is mmap'ed.
    -618:      compress returns Z_OK if success, Z_MEM_ERROR if there was not
    -619:    enough memory, Z_BUF_ERROR if there was not enough room in the output
    -620:    buffer.
    -621: */
    -622: 
    -623: ZEXTERN int ZEXPORT compress2 OF((Bytef *dest,   uLongf *destLen,
    -624:                                   const Bytef *source, uLong sourceLen,
    -625:                                   int level));
    -626: /*
    -627:      Compresses the source buffer into the destination buffer. The level
    -628:    parameter has the same meaning as in deflateInit.  sourceLen is the byte
    -629:    length of the source buffer. Upon entry, destLen is the total size of the
    -630:    destination buffer, which must be at least 0.1% larger than sourceLen plus
    -631:    12 bytes. Upon exit, destLen is the actual size of the compressed buffer.
    -632: 
    -633:      compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
    -634:    memory, Z_BUF_ERROR if there was not enough room in the output buffer,
    -635:    Z_STREAM_ERROR if the level parameter is invalid.
    -636: */
    -637: 
    -638: ZEXTERN int ZEXPORT uncompress OF((Bytef *dest,   uLongf *destLen,
    -639:                                    const Bytef *source, uLong sourceLen));
    -640: /*
    -641:      Decompresses the source buffer into the destination buffer.  sourceLen is
    -642:    the byte length of the source buffer. Upon entry, destLen is the total
    -643:    size of the destination buffer, which must be large enough to hold the
    -644:    entire uncompressed data. (The size of the uncompressed data must have
    -645:    been saved previously by the compressor and transmitted to the decompressor
    -646:    by some mechanism outside the scope of this compression library.)
    -647:    Upon exit, destLen is the actual size of the compressed buffer.
    -648:      This function can be used to decompress a whole file at once if the
    -649:    input file is mmap'ed.
    -650: 
    -651:      uncompress returns Z_OK if success, Z_MEM_ERROR if there was not
    -652:    enough memory, Z_BUF_ERROR if there was not enough room in the output
    -653:    buffer, or Z_DATA_ERROR if the input data was corrupted.
    -654: */
    -655: 
    -656: 
    -657: typedef voidp gzFile;
    -658: 
    -659: ZEXTERN gzFile ZEXPORT gzopen  OF((const char *path, const char *mode));
    -660: /*
    -661:      Opens a gzip (.gz) file for reading or writing. The mode parameter
    -662:    is as in fopen ("rb" or "wb") but can also include a compression level
    -663:    ("wb9") or a strategy: 'f' for filtered data as in "wb6f", 'h' for
    -664:    Huffman only compression as in "wb1h". (See the description
    -665:    of deflateInit2 for more information about the strategy parameter.)
    -666: 
    -667:      gzopen can be used to read a file which is not in gzip format; in this
    -668:    case gzread will directly read from the file without decompression.
    -669: 
    -670:      gzopen returns NULL if the file could not be opened or if there was
    -671:    insufficient memory to allocate the (de)compression state; errno
    -672:    can be checked to distinguish the two cases (if errno is zero, the
    -673:    zlib error is Z_MEM_ERROR).  */
    -674: 
    -675: ZEXTERN gzFile ZEXPORT gzdopen  OF((int fd, const char *mode));
    -676: /*
    -677:      gzdopen() associates a gzFile with the file descriptor fd.  File
    -678:    descriptors are obtained from calls like open, dup, creat, pipe or
    -679:    fileno (in the file has been previously opened with fopen).
    -680:    The mode parameter is as in gzopen.
    -681:      The next call of gzclose on the returned gzFile will also close the
    -682:    file descriptor fd, just like fclose(fdopen(fd), mode) closes the file
    -683:    descriptor fd. If you want to keep fd open, use gzdopen(dup(fd), mode).
    -684:      gzdopen returns NULL if there was insufficient memory to allocate
    -685:    the (de)compression state.
    -686: */
    -687: 
    -688: ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy));
    -689: /*
    -690:      Dynamically update the compression level or strategy. See the description
    -691:    of deflateInit2 for the meaning of these parameters.
    -692:      gzsetparams returns Z_OK if success, or Z_STREAM_ERROR if the file was not
    -693:    opened for writing.
    -694: */
    -695: 
    -696: ZEXTERN int ZEXPORT    gzread  OF((gzFile file, voidp buf, unsigned len));
    -697: /*
    -698:      Reads the given number of uncompressed bytes from the compressed file.
    -699:    If the input file was not in gzip format, gzread copies the given number
    -700:    of bytes into the buffer.
    -701:      gzread returns the number of uncompressed bytes actually read (0 for
    -702:    end of file, -1 for error). */
    -703: 
    -704: ZEXTERN int ZEXPORT    gzwrite OF((gzFile file, 
    -705: 				   const voidp buf, unsigned len));
    -706: /*
    -707:      Writes the given number of uncompressed bytes into the compressed file.
    -708:    gzwrite returns the number of uncompressed bytes actually written
    -709:    (0 in case of error).
    -710: */
    -711: 
    -712: ZEXTERN int ZEXPORTVA   gzprintf OF((gzFile file, const char *format, ...));
    -713: /*
    -714:      Converts, formats, and writes the args to the compressed file under
    -715:    control of the format string, as in fprintf. gzprintf returns the number of
    -716:    uncompressed bytes actually written (0 in case of error).
    -717: */
    -718: 
    -719: ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s));
    -720: /*
    -721:       Writes the given null-terminated string to the compressed file, excluding
    -722:    the terminating null character.
    -723:       gzputs returns the number of characters written, or -1 in case of error.
    -724: */
    -725: 
    -726: ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len));
    -727: /*
    -728:       Reads bytes from the compressed file until len-1 characters are read, or
    -729:    a newline character is read and transferred to buf, or an end-of-file
    -730:    condition is encountered.  The string is then terminated with a null
    -731:    character.
    -732:       gzgets returns buf, or Z_NULL in case of error.
    -733: */
    -734: 
    -735: ZEXTERN int ZEXPORT    gzputc OF((gzFile file, int c));
    -736: /*
    -737:       Writes c, converted to an unsigned char, into the compressed file.
    -738:    gzputc returns the value that was written, or -1 in case of error.
    -739: */
    -740: 
    -741: ZEXTERN int ZEXPORT    gzgetc OF((gzFile file));
    -742: /*
    -743:       Reads one byte from the compressed file. gzgetc returns this byte
    -744:    or -1 in case of end of file or error.
    -745: */
    -746: 
    -747: ZEXTERN int ZEXPORT    gzflush OF((gzFile file, int flush));
    -748: /*
    -749:      Flushes all pending output into the compressed file. The parameter
    -750:    flush is as in the deflate() function. The return value is the zlib
    -751:    error number (see function gzerror below). gzflush returns Z_OK if
    -752:    the flush parameter is Z_FINISH and all output could be flushed.
    -753:      gzflush should be called only when strictly necessary because it can
    -754:    degrade compression.
    -755: */
    -756: 
    -757: ZEXTERN z_off_t ZEXPORT    gzseek OF((gzFile file,
    -758: 				      z_off_t offset, int whence));
    -759: /* 
    -760:       Sets the starting position for the next gzread or gzwrite on the
    -761:    given compressed file. The offset represents a number of bytes in the
    -762:    uncompressed data stream. The whence parameter is defined as in lseek(2);
    -763:    the value SEEK_END is not supported.
    -764:      If the file is opened for reading, this function is emulated but can be
    -765:    extremely slow. If the file is opened for writing, only forward seeks are
    -766:    supported; gzseek then compresses a sequence of zeroes up to the new
    -767:    starting position.
    -768: 
    -769:       gzseek returns the resulting offset location as measured in bytes from
    -770:    the beginning of the uncompressed stream, or -1 in case of error, in
    -771:    particular if the file is opened for writing and the new starting position
    -772:    would be before the current position.
    -773: */
    -774: 
    -775: ZEXTERN int ZEXPORT    gzrewind OF((gzFile file));
    -776: /*
    -777:      Rewinds the given file. This function is supported only for reading.
    -778: 
    -779:    gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET)
    -780: */
    -781: 
    -782: ZEXTERN z_off_t ZEXPORT    gztell OF((gzFile file));
    -783: /*
    -784:      Returns the starting position for the next gzread or gzwrite on the
    -785:    given compressed file. This position represents a number of bytes in the
    -786:    uncompressed data stream.
    -787: 
    -788:    gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR)
    -789: */
    -790: 
    -791: ZEXTERN int ZEXPORT gzeof OF((gzFile file));
    -792: /*
    -793:      Returns 1 when EOF has previously been detected reading the given
    -794:    input stream, otherwise zero.
    -795: */
    -796: 
    -797: ZEXTERN int ZEXPORT    gzclose OF((gzFile file));
    -798: /*
    -799:      Flushes all pending output if necessary, closes the compressed file
    -800:    and deallocates all the (de)compression state. The return value is the zlib
    -801:    error number (see function gzerror below).
    -802: */
    -803: 
    -804: ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum));
    -805: /*
    -806:      Returns the error message for the last error which occurred on the
    -807:    given compressed file. errnum is set to zlib error number. If an
    -808:    error occurred in the file system and not in the compression library,
    -809:    errnum is set to Z_ERRNO and the application may consult errno
    -810:    to get the exact error code.
    -811: */
    -812: 
    -813:                         /* checksum functions */
    -814: 
    -815: /*
    -816:      These functions are not related to compression but are exported
    -817:    anyway because they might be useful in applications using the
    -818:    compression library.
    -819: */
    -820: 
    -821: ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len));
    -822: 
    -823: /*
    -824:      Update a running Adler-32 checksum with the bytes buf[0..len-1] and
    -825:    return the updated checksum. If buf is NULL, this function returns
    -826:    the required initial value for the checksum.
    -827:    An Adler-32 checksum is almost as reliable as a CRC32 but can be computed
    -828:    much faster. Usage example:
    -829: 
    -830:      uLong adler = adler32(0L, Z_NULL, 0);
    -831: 
    -832:      while (read_buffer(buffer, length) != EOF) {
    -833:        adler = adler32(adler, buffer, length);
    -834:      }
    -835:      if (adler != original_adler) error();
    -836: */
    -837: 
    -838: ZEXTERN uLong ZEXPORT crc32   OF((uLong crc, const Bytef *buf, uInt len));
    -839: /*
    -840:      Update a running crc with the bytes buf[0..len-1] and return the updated
    -841:    crc. If buf is NULL, this function returns the required initial value
    -842:    for the crc. Pre- and post-conditioning (one's complement) is performed
    -843:    within this function so it shouldn't be done by the application.
    -844:    Usage example:
    -845: 
    -846:      uLong crc = crc32(0L, Z_NULL, 0);
    -847: 
    -848:      while (read_buffer(buffer, length) != EOF) {
    -849:        crc = crc32(crc, buffer, length);
    -850:      }
    -851:      if (crc != original_crc) error();
    -852: */
    -853: 
    -854: 
    -855:                         /* various hacks, don't look :) */
    -856: 
    -857: /* deflateInit and inflateInit are macros to allow checking the zlib version
    -858:  * and the compiler's view of z_stream:
    -859:  */
    -860: ZEXTERN int ZEXPORT deflateInit_ OF((z_streamp strm, int level,
    -861:                                      const char *version, int stream_size));
    -862: ZEXTERN int ZEXPORT inflateInit_ OF((z_streamp strm,
    -863:                                      const char *version, int stream_size));
    -864: ZEXTERN int ZEXPORT deflateInit2_ OF((z_streamp strm, int  level, int  method,
    -865:                                       int windowBits, int memLevel,
    -866:                                       int strategy, const char *version,
    -867:                                       int stream_size));
    -868: ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int  windowBits,
    -869:                                       const char *version, int stream_size));
    -870: #define deflateInit(strm, level) \
    -871:         deflateInit_((strm), (level),       ZLIB_VERSION, sizeof(z_stream))
    -872: #define inflateInit(strm) \
    -873:         inflateInit_((strm),                ZLIB_VERSION, sizeof(z_stream))
    -874: #define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \
    -875:         deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\
    -876:                       (strategy),           ZLIB_VERSION, sizeof(z_stream))
    -877: #define inflateInit2(strm, windowBits) \
    -878:         inflateInit2_((strm), (windowBits), ZLIB_VERSION, sizeof(z_stream))
    -879: 
    -880: 
    -881: #if !defined(_Z_UTIL_H) && !defined(NO_DUMMY_DECL)
    -882:     struct internal_state {int dummy;}; /* hack for buggy compilers */
    -883: #endif
    -884: 
    -885: ZEXTERN const char   * ZEXPORT zError           OF((int err));
    -886: ZEXTERN int            ZEXPORT inflateSyncPoint OF((z_streamp z));
    -887: ZEXTERN const uLongf * ZEXPORT get_crc_table    OF((void));
    -888: 
    -889: #ifdef __cplusplus
    -890: }
    -891: #endif
    -892: 
    -893: #endif /* _ZLIB_H */
    -      
    -
    - -

    How the zlib wrapper was developed

    - -

    Attempt #1

    -
    -
    -/* File : example.i */
    -%module example
    -%{
    -/* Put headers and other declarations here */
    -#include "zlib.h"
    -%}
    -
    -%include typemaps.i
    -
    -%include "zlib.h"
    -      
    -
    - - The result is: - -
    -
    -% swig -chicken -I/usr/include example.i
    -/usr/include/zlib.h:63: Syntax error in input.
    -/usr/include/zlib.h:78: Syntax error in input.
    -/usr/include/zlib.h:80: Syntax error in input.
    -      
    -
    - - The first problem we see is that the macro OF(...) is - not defined. - -

    Attempt #2

    - - We make sure to include zconf.h so that SWIG can see the - definition of OF(...). We try again. - -
    -
    -/* File : example.i */
    -%module example
    -%{
    -/* Put headers and other declarations here */
    -#include "zlib.h"
    -%}
    -
    -%include typemaps.i
    -
    -%include "zconf.h"
    -%include "zlib.h"
    -      
    -
    - - The result is: - -
    -
    -% swig -chicken -I/usr/include example.i
    -      
    -
    - - This seems to work! But we should take a peek inside the generated - example_wrap.c to see what the names of the Scheme - procedures will be. - -
    -
    -% grep C_intern example_wrap.c
    -  C_word err = C_intern2 (&a, errorhook);
    -    sym = C_intern (&a, 21, "example:max-mem-level");
    -    sym = C_intern (&a, 17, "example:max-wbits");
    -    sym = C_intern (&a, 16, "example:seek-set");
    -    sym = C_intern (&a, 16, "example:seek-cur");
    -    sym = C_intern (&a, 16, "example:seek-end");
    -    sym = C_intern (&a, 20, "example:zlib-version");
    -    sym = C_intern (&a, 28, "example:z-stream-next-in-set");
    -    sym = C_intern (&a, 28, "example:z-stream-next-in-get");
    -    sym = C_intern (&a, 29, "example:z-stream-avail-in-set");
    -    sym = C_intern (&a, 29, "example:z-stream-avail-in-get");
    -    sym = C_intern (&a, 29, "example:z-stream-total-in-set");
    -    sym = C_intern (&a, 29, "example:z-stream-total-in-get");
    -    sym = C_intern (&a, 29, "example:z-stream-next-out-set");
    -    sym = C_intern (&a, 29, "example:z-stream-next-out-get");
    -    sym = C_intern (&a, 30, "example:z-stream-avail-out-set");
    -    sym = C_intern (&a, 30, "example:z-stream-avail-out-get");
    -    sym = C_intern (&a, 30, "example:z-stream-total-out-set");
    -    sym = C_intern (&a, 30, "example:z-stream-total-out-get");
    -    sym = C_intern (&a, 24, "example:z-stream-msg-set");
    -    sym = C_intern (&a, 24, "example:z-stream-msg-get");
    -    sym = C_intern (&a, 26, "example:z-stream-state-set");
    -    sym = C_intern (&a, 26, "example:z-stream-state-get");
    -    sym = C_intern (&a, 27, "example:z-stream-zalloc-set");
    -    sym = C_intern (&a, 27, "example:z-stream-zalloc-get");
    -    sym = C_intern (&a, 26, "example:z-stream-zfree-set");
    -    sym = C_intern (&a, 26, "example:z-stream-zfree-get");
    -    sym = C_intern (&a, 27, "example:z-stream-opaque-set");
    -    sym = C_intern (&a, 27, "example:z-stream-opaque-get");
    -    sym = C_intern (&a, 30, "example:z-stream-data-type-set");
    -    sym = C_intern (&a, 30, "example:z-stream-data-type-get");
    -    sym = C_intern (&a, 26, "example:z-stream-adler-set");
    -    sym = C_intern (&a, 26, "example:z-stream-adler-get");
    -    sym = C_intern (&a, 29, "example:z-stream-reserved-set");
    -    sym = C_intern (&a, 29, "example:z-stream-reserved-get");
    -    sym = C_intern (&a, 20, "example:new-z-stream");
    -    sym = C_intern (&a, 23, "example:delete-z-stream");
    -    sym = C_intern (&a, 18, "example:z-no-flush");
    -    sym = C_intern (&a, 23, "example:z-partial-flush");
    -    sym = C_intern (&a, 20, "example:z-sync-flush");
    -    sym = C_intern (&a, 20, "example:z-full-flush");
    -    sym = C_intern (&a, 16, "example:z-finish");
    -    sym = C_intern (&a, 12, "example:z-ok");
    -    sym = C_intern (&a, 20, "example:z-stream-end");
    -    sym = C_intern (&a, 19, "example:z-need-dict");
    -    sym = C_intern (&a, 15, "example:z-errno");
    -    sym = C_intern (&a, 22, "example:z-stream-error");
    -    sym = C_intern (&a, 20, "example:z-data-error");
    -    sym = C_intern (&a, 19, "example:z-mem-error");
    -    sym = C_intern (&a, 19, "example:z-buf-error");
    -    sym = C_intern (&a, 23, "example:z-version-error");
    -    sym = C_intern (&a, 24, "example:z-no-compression");
    -    sym = C_intern (&a, 20, "example:z-best-speed");
    -    sym = C_intern (&a, 26, "example:z-best-compression");
    -    sym = C_intern (&a, 29, "example:z-default-compression");
    -    sym = C_intern (&a, 18, "example:z-filtered");
    -    sym = C_intern (&a, 22, "example:z-huffman-only");
    -    sym = C_intern (&a, 26, "example:z-default-strategy");
    -    sym = C_intern (&a, 16, "example:z-binary");
    -    sym = C_intern (&a, 15, "example:z-ascii");
    -    sym = C_intern (&a, 17, "example:z-unknown");
    -    sym = C_intern (&a, 18, "example:z-deflated");
    -    sym = C_intern (&a, 14, "example:z-null");
    -    sym = C_intern (&a, 19, "example:zlibversion");
    -    sym = C_intern (&a, 15, "example:deflate");
    -    sym = C_intern (&a, 18, "example:deflateend");
    -    sym = C_intern (&a, 15, "example:inflate");
    -    sym = C_intern (&a, 18, "example:inflateend");
    -    sym = C_intern (&a, 28, "example:deflatesetdictionary");
    -    sym = C_intern (&a, 19, "example:deflatecopy");
    -    sym = C_intern (&a, 20, "example:deflatereset");
    -    sym = C_intern (&a, 21, "example:deflateparams");
    -    sym = C_intern (&a, 28, "example:inflatesetdictionary");
    -    sym = C_intern (&a, 19, "example:inflatesync");
    -    sym = C_intern (&a, 20, "example:inflatereset");
    -    sym = C_intern (&a, 16, "example:compress");
    -    sym = C_intern (&a, 17, "example:compress2");
    -    sym = C_intern (&a, 18, "example:uncompress");
    -    sym = C_intern (&a, 14, "example:gzopen");
    -    sym = C_intern (&a, 15, "example:gzdopen");
    -    sym = C_intern (&a, 19, "example:gzsetparams");
    -    sym = C_intern (&a, 14, "example:gzread");
    -    sym = C_intern (&a, 15, "example:gzwrite");
    -    sym = C_intern (&a, 16, "example:gzprintf");
    -    sym = C_intern (&a, 14, "example:gzputs");
    -    sym = C_intern (&a, 14, "example:gzgets");
    -    sym = C_intern (&a, 14, "example:gzputc");
    -    sym = C_intern (&a, 14, "example:gzgetc");
    -    sym = C_intern (&a, 15, "example:gzflush");
    -    sym = C_intern (&a, 14, "example:gzseek");
    -    sym = C_intern (&a, 16, "example:gzrewind");
    -    sym = C_intern (&a, 14, "example:gztell");
    -    sym = C_intern (&a, 13, "example:gzeof");
    -    sym = C_intern (&a, 15, "example:gzclose");
    -    sym = C_intern (&a, 15, "example:gzerror");
    -    sym = C_intern (&a, 15, "example:adler32");
    -    sym = C_intern (&a, 13, "example:crc32");
    -    sym = C_intern (&a, 20, "example:deflateinit-");
    -    sym = C_intern (&a, 20, "example:inflateinit-");
    -    sym = C_intern (&a, 21, "example:deflateinit2-");
    -    sym = C_intern (&a, 21, "example:inflateinit2-");
    -    sym = C_intern (&a, 32, "example:internal-state-dummy-set");
    -    sym = C_intern (&a, 32, "example:internal-state-dummy-get");
    -    sym = C_intern (&a, 26, "example:new-internal-state");
    -    sym = C_intern (&a, 29, "example:delete-internal-state");
    -    sym = C_intern (&a, 14, "example:zerror");
    -    sym = C_intern (&a, 24, "example:inflatesyncpoint");
    -    sym = C_intern (&a, 21, "example:get-crc-table");
    -      
    -
    - - In fact, we want the Scheme procedure names to begin with - zlib instead of example. For - example:zlib-version, we want - zlib-version. And we want dashes when the case - switches to/from upper/lowercase; ex. the function - deflateEnd() should be the Scheme procedure - zlib-deflate-end. - -

    Attempt #3

    - - We make sure to add -prefix zlib -mixed to the - swig command line, and we rename - ZLIB_VERSION to VERSION. We try again. - -
    -
    -/* File : example.i */
    -%module example
    -%{
    -/* Put headers and other declarations here */
    -#include "zlib.h"
    -%}
    -
    -%include typemaps.i
    -
    -%rename(VERSION) ZLIB_VERSION;
    -
    -%include "zconf.h"
    -%include "zlib.h"
    -      
    -
    - - The result is: - -
    -
    -% swig -chicken -prefix zlib -mixed -I/usr/include example.i
    -% grep C_intern example_wrap.c
    -  C_word err = C_intern2 (&a, errorhook);
    -    sym = C_intern (&a, 18, "zlib:max-mem-level");
    -    sym = C_intern (&a, 14, "zlib:max-wbits");
    -    sym = C_intern (&a, 13, "zlib:seek-set");
    -    sym = C_intern (&a, 13, "zlib:seek-cur");
    -    sym = C_intern (&a, 13, "zlib:seek-end");
    -    sym = C_intern (&a, 12, "zlib:version");
    -    sym = C_intern (&a, 25, "zlib:z-stream-next-in-set");
    -    sym = C_intern (&a, 25, "zlib:z-stream-next-in-get");
    -    sym = C_intern (&a, 26, "zlib:z-stream-avail-in-set");
    -    sym = C_intern (&a, 26, "zlib:z-stream-avail-in-get");
    -    sym = C_intern (&a, 26, "zlib:z-stream-total-in-set");
    -    sym = C_intern (&a, 26, "zlib:z-stream-total-in-get");
    -    sym = C_intern (&a, 26, "zlib:z-stream-next-out-set");
    -    sym = C_intern (&a, 26, "zlib:z-stream-next-out-get");
    -    sym = C_intern (&a, 27, "zlib:z-stream-avail-out-set");
    -    sym = C_intern (&a, 27, "zlib:z-stream-avail-out-get");
    -    sym = C_intern (&a, 27, "zlib:z-stream-total-out-set");
    -    sym = C_intern (&a, 27, "zlib:z-stream-total-out-get");
    -    sym = C_intern (&a, 21, "zlib:z-stream-msg-set");
    -    sym = C_intern (&a, 21, "zlib:z-stream-msg-get");
    -    sym = C_intern (&a, 23, "zlib:z-stream-state-set");
    -    sym = C_intern (&a, 23, "zlib:z-stream-state-get");
    -    sym = C_intern (&a, 24, "zlib:z-stream-zalloc-set");
    -    sym = C_intern (&a, 24, "zlib:z-stream-zalloc-get");
    -    sym = C_intern (&a, 23, "zlib:z-stream-zfree-set");
    -    sym = C_intern (&a, 23, "zlib:z-stream-zfree-get");
    -    sym = C_intern (&a, 24, "zlib:z-stream-opaque-set");
    -    sym = C_intern (&a, 24, "zlib:z-stream-opaque-get");
    -    sym = C_intern (&a, 27, "zlib:z-stream-data-type-set");
    -    sym = C_intern (&a, 27, "zlib:z-stream-data-type-get");
    -    sym = C_intern (&a, 23, "zlib:z-stream-adler-set");
    -    sym = C_intern (&a, 23, "zlib:z-stream-adler-get");
    -    sym = C_intern (&a, 26, "zlib:z-stream-reserved-set");
    -    sym = C_intern (&a, 26, "zlib:z-stream-reserved-get");
    -    sym = C_intern (&a, 17, "zlib:new-z-stream");
    -    sym = C_intern (&a, 20, "zlib:delete-z-stream");
    -    sym = C_intern (&a, 15, "zlib:z-no-flush");
    -    sym = C_intern (&a, 20, "zlib:z-partial-flush");
    -    sym = C_intern (&a, 17, "zlib:z-sync-flush");
    -    sym = C_intern (&a, 17, "zlib:z-full-flush");
    -    sym = C_intern (&a, 13, "zlib:z-finish");
    -    sym = C_intern (&a, 9, "zlib:z-ok");
    -    sym = C_intern (&a, 17, "zlib:z-stream-end");
    -    sym = C_intern (&a, 16, "zlib:z-need-dict");
    -    sym = C_intern (&a, 12, "zlib:z-errno");
    -    sym = C_intern (&a, 19, "zlib:z-stream-error");
    -    sym = C_intern (&a, 17, "zlib:z-data-error");
    -    sym = C_intern (&a, 16, "zlib:z-mem-error");
    -    sym = C_intern (&a, 16, "zlib:z-buf-error");
    -    sym = C_intern (&a, 20, "zlib:z-version-error");
    -    sym = C_intern (&a, 21, "zlib:z-no-compression");
    -    sym = C_intern (&a, 17, "zlib:z-best-speed");
    -    sym = C_intern (&a, 23, "zlib:z-best-compression");
    -    sym = C_intern (&a, 26, "zlib:z-default-compression");
    -    sym = C_intern (&a, 15, "zlib:z-filtered");
    -    sym = C_intern (&a, 19, "zlib:z-huffman-only");
    -    sym = C_intern (&a, 23, "zlib:z-default-strategy");
    -    sym = C_intern (&a, 13, "zlib:z-binary");
    -    sym = C_intern (&a, 12, "zlib:z-ascii");
    -    sym = C_intern (&a, 14, "zlib:z-unknown");
    -    sym = C_intern (&a, 15, "zlib:z-deflated");
    -    sym = C_intern (&a, 11, "zlib:z-null");
    -    sym = C_intern (&a, 17, "zlib:zlib-version");
    -    sym = C_intern (&a, 12, "zlib:deflate");
    -    sym = C_intern (&a, 16, "zlib:deflate-end");
    -    sym = C_intern (&a, 12, "zlib:inflate");
    -    sym = C_intern (&a, 16, "zlib:inflate-end");
    -    sym = C_intern (&a, 27, "zlib:deflate-set-dictionary");
    -    sym = C_intern (&a, 17, "zlib:deflate-copy");
    -    sym = C_intern (&a, 18, "zlib:deflate-reset");
    -    sym = C_intern (&a, 19, "zlib:deflate-params");
    -    sym = C_intern (&a, 27, "zlib:inflate-set-dictionary");
    -    sym = C_intern (&a, 17, "zlib:inflate-sync");
    -    sym = C_intern (&a, 18, "zlib:inflate-reset");
    -    sym = C_intern (&a, 13, "zlib:compress");
    -    sym = C_intern (&a, 14, "zlib:compress2");
    -    sym = C_intern (&a, 15, "zlib:uncompress");
    -    sym = C_intern (&a, 11, "zlib:gzopen");
    -    sym = C_intern (&a, 12, "zlib:gzdopen");
    -    sym = C_intern (&a, 16, "zlib:gzsetparams");
    -    sym = C_intern (&a, 11, "zlib:gzread");
    -    sym = C_intern (&a, 12, "zlib:gzwrite");
    -    sym = C_intern (&a, 13, "zlib:gzprintf");
    -    sym = C_intern (&a, 11, "zlib:gzputs");
    -    sym = C_intern (&a, 11, "zlib:gzgets");
    -    sym = C_intern (&a, 11, "zlib:gzputc");
    -    sym = C_intern (&a, 11, "zlib:gzgetc");
    -    sym = C_intern (&a, 12, "zlib:gzflush");
    -    sym = C_intern (&a, 11, "zlib:gzseek");
    -    sym = C_intern (&a, 13, "zlib:gzrewind");
    -    sym = C_intern (&a, 11, "zlib:gztell");
    -    sym = C_intern (&a, 10, "zlib:gzeof");
    -    sym = C_intern (&a, 12, "zlib:gzclose");
    -    sym = C_intern (&a, 12, "zlib:gzerror");
    -    sym = C_intern (&a, 12, "zlib:adler32");
    -    sym = C_intern (&a, 10, "zlib:crc32");
    -    sym = C_intern (&a, 18, "zlib:deflate-init-");
    -    sym = C_intern (&a, 18, "zlib:inflate-init-");
    -    sym = C_intern (&a, 19, "zlib:deflate-init2-");
    -    sym = C_intern (&a, 19, "zlib:inflate-init2-");
    -    sym = C_intern (&a, 29, "zlib:internal-state-dummy-set");
    -    sym = C_intern (&a, 29, "zlib:internal-state-dummy-get");
    -    sym = C_intern (&a, 23, "zlib:new-internal-state");
    -    sym = C_intern (&a, 26, "zlib:delete-internal-state");
    -    sym = C_intern (&a, 12, "zlib:ze-rror");
    -    sym = C_intern (&a, 23, "zlib:inflate-sync-point");
    -    sym = C_intern (&a, 18, "zlib:get-crc-table");
    -      
    -
    - - Much better. The only problem is the identifier - zlib:ze-rror, and we are missing - zlib:deflate-init and zlib:inflate-init - because they are defined as macros (see macro definitions). - -

    Attempt #4

    - - We make sure to rename zError to - z_error, and we inline some helper functions for the - zlib:...-init macros. We try again. - -
    -
    -/* File : example.i */
    -%module example
    -%{
    -/* Put headers and other declarations here */
    -#include "zlib.h"
    -%}
    -
    -%include typemaps.i
    -
    -%rename(VERSION) ZLIB_VERSION;
    -%rename(z_error) zError;
    -
    -%include "zconf.h"
    -%include "zlib.h"
    -
    -%inline %{
    -/* %inline blocks are seen by SWIG and are inserted into the header
    -   portion of example_wrap.c, so that they are also seen by the C
    -   compiler. */
    -int deflate_init(z_streamp strm, int level) {
    -  return deflateInit(strm,level); /* call macro */
    -}
    -int inflate_init(z_streamp strm) {
    -  return inflateInit(strm); /* call macro */
    -}
    -%}
    -
    -
    -      
    -
    - - The result is: - -
    -
    -% swig -chicken -prefix zlib -mixed -I/usr/include example.i
    -% grep C_intern example_wrap.c
    -  C_word err = C_intern2 (&a, errorhook);
    -    sym = C_intern (&a, 18, "zlib:max-mem-level");
    -    sym = C_intern (&a, 14, "zlib:max-wbits");
    -    sym = C_intern (&a, 13, "zlib:seek-set");
    -    sym = C_intern (&a, 13, "zlib:seek-cur");
    -    sym = C_intern (&a, 13, "zlib:seek-end");
    -    sym = C_intern (&a, 12, "zlib:version");
    -    sym = C_intern (&a, 25, "zlib:z-stream-next-in-set");
    -    sym = C_intern (&a, 25, "zlib:z-stream-next-in-get");
    -    sym = C_intern (&a, 26, "zlib:z-stream-avail-in-set");
    -    sym = C_intern (&a, 26, "zlib:z-stream-avail-in-get");
    -    sym = C_intern (&a, 26, "zlib:z-stream-total-in-set");
    -    sym = C_intern (&a, 26, "zlib:z-stream-total-in-get");
    -    sym = C_intern (&a, 26, "zlib:z-stream-next-out-set");
    -    sym = C_intern (&a, 26, "zlib:z-stream-next-out-get");
    -    sym = C_intern (&a, 27, "zlib:z-stream-avail-out-set");
    -    sym = C_intern (&a, 27, "zlib:z-stream-avail-out-get");
    -    sym = C_intern (&a, 27, "zlib:z-stream-total-out-set");
    -    sym = C_intern (&a, 27, "zlib:z-stream-total-out-get");
    -    sym = C_intern (&a, 21, "zlib:z-stream-msg-set");
    -    sym = C_intern (&a, 21, "zlib:z-stream-msg-get");
    -    sym = C_intern (&a, 23, "zlib:z-stream-state-set");
    -    sym = C_intern (&a, 23, "zlib:z-stream-state-get");
    -    sym = C_intern (&a, 24, "zlib:z-stream-zalloc-set");
    -    sym = C_intern (&a, 24, "zlib:z-stream-zalloc-get");
    -    sym = C_intern (&a, 23, "zlib:z-stream-zfree-set");
    -    sym = C_intern (&a, 23, "zlib:z-stream-zfree-get");
    -    sym = C_intern (&a, 24, "zlib:z-stream-opaque-set");
    -    sym = C_intern (&a, 24, "zlib:z-stream-opaque-get");
    -    sym = C_intern (&a, 27, "zlib:z-stream-data-type-set");
    -    sym = C_intern (&a, 27, "zlib:z-stream-data-type-get");
    -    sym = C_intern (&a, 23, "zlib:z-stream-adler-set");
    -    sym = C_intern (&a, 23, "zlib:z-stream-adler-get");
    -    sym = C_intern (&a, 26, "zlib:z-stream-reserved-set");
    -    sym = C_intern (&a, 26, "zlib:z-stream-reserved-get");
    -    sym = C_intern (&a, 17, "zlib:new-z-stream");
    -    sym = C_intern (&a, 20, "zlib:delete-z-stream");
    -    sym = C_intern (&a, 15, "zlib:z-no-flush");
    -    sym = C_intern (&a, 20, "zlib:z-partial-flush");
    -    sym = C_intern (&a, 17, "zlib:z-sync-flush");
    -    sym = C_intern (&a, 17, "zlib:z-full-flush");
    -    sym = C_intern (&a, 13, "zlib:z-finish");
    -    sym = C_intern (&a, 9, "zlib:z-ok");
    -    sym = C_intern (&a, 17, "zlib:z-stream-end");
    -    sym = C_intern (&a, 16, "zlib:z-need-dict");
    -    sym = C_intern (&a, 12, "zlib:z-errno");
    -    sym = C_intern (&a, 19, "zlib:z-stream-error");
    -    sym = C_intern (&a, 17, "zlib:z-data-error");
    -    sym = C_intern (&a, 16, "zlib:z-mem-error");
    -    sym = C_intern (&a, 16, "zlib:z-buf-error");
    -    sym = C_intern (&a, 20, "zlib:z-version-error");
    -    sym = C_intern (&a, 21, "zlib:z-no-compression");
    -    sym = C_intern (&a, 17, "zlib:z-best-speed");
    -    sym = C_intern (&a, 23, "zlib:z-best-compression");
    -    sym = C_intern (&a, 26, "zlib:z-default-compression");
    -    sym = C_intern (&a, 15, "zlib:z-filtered");
    -    sym = C_intern (&a, 19, "zlib:z-huffman-only");
    -    sym = C_intern (&a, 23, "zlib:z-default-strategy");
    -    sym = C_intern (&a, 13, "zlib:z-binary");
    -    sym = C_intern (&a, 12, "zlib:z-ascii");
    -    sym = C_intern (&a, 14, "zlib:z-unknown");
    -    sym = C_intern (&a, 15, "zlib:z-deflated");
    -    sym = C_intern (&a, 11, "zlib:z-null");
    -    sym = C_intern (&a, 17, "zlib:zlib-version");
    -    sym = C_intern (&a, 12, "zlib:deflate");
    -    sym = C_intern (&a, 16, "zlib:deflate-end");
    -    sym = C_intern (&a, 12, "zlib:inflate");
    -    sym = C_intern (&a, 16, "zlib:inflate-end");
    -    sym = C_intern (&a, 27, "zlib:deflate-set-dictionary");
    -    sym = C_intern (&a, 17, "zlib:deflate-copy");
    -    sym = C_intern (&a, 18, "zlib:deflate-reset");
    -    sym = C_intern (&a, 19, "zlib:deflate-params");
    -    sym = C_intern (&a, 27, "zlib:inflate-set-dictionary");
    -    sym = C_intern (&a, 17, "zlib:inflate-sync");
    -    sym = C_intern (&a, 18, "zlib:inflate-reset");
    -    sym = C_intern (&a, 13, "zlib:compress");
    -    sym = C_intern (&a, 14, "zlib:compress2");
    -    sym = C_intern (&a, 15, "zlib:uncompress");
    -    sym = C_intern (&a, 11, "zlib:gzopen");
    -    sym = C_intern (&a, 12, "zlib:gzdopen");
    -    sym = C_intern (&a, 16, "zlib:gzsetparams");
    -    sym = C_intern (&a, 11, "zlib:gzread");
    -    sym = C_intern (&a, 12, "zlib:gzwrite");
    -    sym = C_intern (&a, 13, "zlib:gzprintf");
    -    sym = C_intern (&a, 11, "zlib:gzputs");
    -    sym = C_intern (&a, 11, "zlib:gzgets");
    -    sym = C_intern (&a, 11, "zlib:gzputc");
    -    sym = C_intern (&a, 11, "zlib:gzgetc");
    -    sym = C_intern (&a, 12, "zlib:gzflush");
    -    sym = C_intern (&a, 11, "zlib:gzseek");
    -    sym = C_intern (&a, 13, "zlib:gzrewind");
    -    sym = C_intern (&a, 11, "zlib:gztell");
    -    sym = C_intern (&a, 10, "zlib:gzeof");
    -    sym = C_intern (&a, 12, "zlib:gzclose");
    -    sym = C_intern (&a, 12, "zlib:gzerror");
    -    sym = C_intern (&a, 12, "zlib:adler32");
    -    sym = C_intern (&a, 10, "zlib:crc32");
    -    sym = C_intern (&a, 18, "zlib:deflate-init-");
    -    sym = C_intern (&a, 18, "zlib:inflate-init-");
    -    sym = C_intern (&a, 19, "zlib:deflate-init2-");
    -    sym = C_intern (&a, 19, "zlib:inflate-init2-");
    -    sym = C_intern (&a, 29, "zlib:internal-state-dummy-set");
    -    sym = C_intern (&a, 29, "zlib:internal-state-dummy-get");
    -    sym = C_intern (&a, 23, "zlib:new-internal-state");
    -    sym = C_intern (&a, 26, "zlib:delete-internal-state");
    -    sym = C_intern (&a, 12, "zlib:z-error");
    -    sym = C_intern (&a, 23, "zlib:inflate-sync-point");
    -    sym = C_intern (&a, 18, "zlib:get-crc-table");
    -    sym = C_intern (&a, 17, "zlib:deflate-init");
    -    sym = C_intern (&a, 17, "zlib:inflate-init");
    -      
    -
    - - Perfect! Now let's integrate this zlib extension into a - CHICKEN interpreter. To save some time, in this - Examples/chicken/zlib directory: -
      -
    1. Backup the original example.i.
    2. -
    3. Copy and paste the example.i text from above and - put it into the file called example.i
    4. -
    5. Run 'make' as per Building the - example.
    6. -
    7. Run the resultant executable zlib.
    8. -
    - - The interpreter interaction is as follows: - -
    -
    -% ./zlib
    -zlib
    -
    -  A SWIG example for the CHICKEN compiler
    -  Author: Jonah Beckford, February 2003
    -
    -Scheme Procedures:
    -
    -zlib:max-mem-level
    -zlib:max-wbits
    -zlib:seek-set
    -zlib:seek-cur
    -zlib:seek-end
    -zlib:version
    -zlib:z-stream-next-in-set
    -zlib:z-stream-next-in-get
    -zlib:z-stream-avail-in-set
    -...
    -zlib:get-crc-table
    -zlib:deflate-init
    -zlib:inflate-init
    -; This is the CHICKEN interpreter - Version 0, Build 1095 - windows-cygwin-x86
    -; (c)2000-2003 Felix L. Winkelmann
    ->>> (define s (zlib:new-z-stream))
    ->>> s
    -#<tagged pointer #<c++ "z_stream *">(#<pointer 6d9290>)>
    ->>> (zlib:z-stream-next-in-get s)
    -#f
    ->>> (zlib:z-stream-next-in-set s "some dummy stream data")
    -Error: Type error. Expected _p_Bytef: "bad argument type"
    ->>> (exit)
    -      
    -
    - - Apparently we cannot use Scheme strings as Bytef *. The SWIG - manual shows many ways how to handle strings and byte arrays, but - to be simplistic, let's just make the Bytef * look - like a char *, which is automatically handled as a - string by SWIG CHICKEN. - -

    Attempt #5

    - - We make sure to add an %apply construct so that Bytef - * is handled the same as char * to SWIG. We - try again. - -
    -
    -/* File : example.i */
    -%module example
    -%{
    -/* Put headers and other declarations here */
    -#include "zlib.h"
    -%}
    -
    -%include typemaps.i
    -
    -%rename(VERSION) ZLIB_VERSION;
    -%rename(z_error) zError;
    -%apply char * { Bytef * };
    -
    -%include "zconf.h"
    -%include "zlib.h"
    -
    -%inline %{
    -/* %inline blocks are seen by SWIG and are inserted into the header
    -   portion of example_wrap.c, so that they are also seen by the C
    -   compiler. */
    -int deflate_init(z_streamp strm, int level) {
    -  return deflateInit(strm,level); /* call macro */
    -}
    -int inflate_init(z_streamp strm) {
    -  return inflateInit(strm); /* call macro */
    -}
    -%}
    -      
    -
    - - Build the example once more.
    - - The interpreter interaction is as follows: - -
    -
    -% ./zlib
    -zlib
    -
    -  A SWIG example for the CHICKEN compiler
    -  Author: Jonah Beckford, February 2003
    -
    -Scheme Procedures:
    -
    -zlib:max-mem-level
    -zlib:max-wbits
    -zlib:seek-set
    -zlib:seek-cur
    -zlib:seek-end
    -zlib:version
    -zlib:z-stream-next-in-set
    -zlib:z-stream-next-in-get
    -zlib:z-stream-avail-in-set
    -...
    -zlib:get-crc-table
    -zlib:deflate-init
    -zlib:inflate-init
    -; This is the CHICKEN interpreter - Version 0, Build 1095 - windows-cygwin-x86
    -; (c)2000-2003 Felix L. Winkelmann
    ->>> (define s (zlib:new-z-stream))
    -Init zstream
    ->>> (zlib:z-stream-zalloc-set s #f) 
    ->>> (zlib:z-stream-zfree-set s #f)
    ->>> (zlib:z-stream-opaque-set s #f)
    ->>> (zlib:deflate-init s (zlib:z-default-compression))
    -0
    -Deflate something small so we don't need to loop/stream data
    ->>> (define in "some dummy data")
    ->>> (define out (make-string 1000))
    ->>> (zlib:z-stream-next-in-set s in)
    ->>> (zlib:z-stream-avail-in-set s (string-length in))
    ->>> (zlib:z-stream-next-out-set s out)
    ->>> (zlib:z-stream-avail-out-set s (string-length out))
    ->>> (zlib:deflate s (zlib:z-finish))
    -1 ;; (zlib:z-stream-end) == 1, which is good
    ->>> (zlib:z-stream-total-out-get s)
    -23.
    ->>> out
    -"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        "
    -      
    -
    - - We see the problem ... the compression is occurring as it should, - but we cannot see any of the compressed output. This is because - when SWIG CHICKEN passes a Scheme string to a C function, it - duplicates the string before calling the C function. We want to - save the memory address that - zlib:z-stream-next-out-set is using, so we can - display this later. While we are at it, we can foresee that - compress, compress2 and - uncompress will all need some finessing to work with - mutating strings. - -

    Attempt #6

    - - When we have to finesse strings, we must use typemaps. As well, - we define some functions to save and restore the - next_out element. We try again. - -
    -
    -/* File : example.i */
    -%module example
    -%{
    -/* Put headers and other declarations here */
    -#include "zlib.h"
    -%}
    -
    -%include typemaps.i
    -
    -%rename(VERSION) ZLIB_VERSION;
    -%rename(z_error) zError;
    -%apply char * { Bytef * };
    -	
    -/* Allow the sourceLen to be automatically filled in from the length
    -   of the 'source' string */
    -%typemap(in) (const Bytef *source, uLong sourceLen)
    -%{  if (!C_swig_is_string ($input)) {
    -    swig_barf (SWIG_BARF1_BAD_ARGUMENT_TYPE, "Argument $input is not a string");
    -  }
    -  $2 = (uLong) C_header_size ($input);
    -  $1 = C_c_string ($input);
    -%}
    -
    -/* Allocate space the size of which is determined by the Scheme
    -   integer argument, and make a temporary integer so we can set
    -   destLen. */
    -%typemap(in) (Bytef *dest, uLongf *destLen) (uLong len)
    -%{  if (!C_swig_is_fixnum ($input)) {
    -    swig_barf (SWIG_BARF1_BAD_ARGUMENT_TYPE, "Argument $input is not a integer");
    -  }
    -  len = (uLong) C_unfix ($input);
    -  $2 = &len;
    -  $1 = (char *) malloc (*$2);
    -%}
    -
    -/* Return the mutated string as a new object. */
    -%typemap(argout) (Bytef *dest, uLongf *destLen) 
    -(C_word *scmstr) 
    -%{  scmstr = C_alloc (C_SIZEOF_STRING (*$2));
    -  SWIG_APPEND_VALUE(C_string (&scmstr, *$2, $1));
    -  free ($1);
    -%}
    -	
    -%include "zconf.h"
    -%include "zlib.h"
    -	
    -/* Ignore destLen as an input argument, and make a temporary integer so
    -   we can set destLen. */
    -%typemap(in, numinputs=0) uLongf *destLen (uLong len)
    -"$1 = &len;";
    -
    -/* Return a sized string as a new object. */
    -%typemap(argout)
    -(void *outstr, uLongf *destLen) (C_word *scmstr) 
    -%{  scmstr = C_alloc (C_SIZEOF_STRING (*$2));
    -  SWIG_APPEND_VALUE(C_string (&scmstr, *$2, $1));
    -%}
    -	
    -%inline %{
    -/* %inline blocks are seen by SWIG and are inserted into the header
    -   portion of example_wrap.c, so that they are also seen by the C
    -   compiler. */
    -int deflate_init(z_streamp strm, int level) {
    -  return deflateInit(strm,level); /* call macro */
    -}
    -int inflate_init(z_streamp strm) {
    -  return inflateInit(strm); /* call macro */
    -}
    -void* z_stream_save_next_out(z_streamp strm) {
    -  return (void*) strm->next_out;
    -}
    -void z_stream_get_next_chunk(z_streamp strm, void *outstr, uLongf *destLen) {
    -  *destLen = strm->next_out - (Bytef*)outstr;
    -}
    -%}
    -      
    -
    - - And that's it. Try building the entire example from the - Makefile. Run ./zlib test-zlib.scm to test it out. - - - diff --git a/Examples/chicken/zlib/example.i b/Examples/chicken/zlib/example.i deleted file mode 100644 index dd962ad56..000000000 --- a/Examples/chicken/zlib/example.i +++ /dev/null @@ -1,76 +0,0 @@ -/* File : example.i */ -%module example -%{ -/* Put headers and other declarations here */ -#include "zlib.h" -%} - -%include typemaps.i - -%rename(VERSION) ZLIB_VERSION; -%rename(z_error) zError; -%apply char * { Bytef * }; - -/* Allow the sourceLen to be automatically filled in from the length - of the 'source' string */ -%typemap(in) (const Bytef *source, uLong sourceLen) -%{ if (!C_swig_is_string ($input)) { - swig_barf (SWIG_BARF1_BAD_ARGUMENT_TYPE, "Argument $input is not a string"); - } - $2 = (uLong) C_header_size ($input); - $1 = C_c_string ($input); -%} - -/* Allocate space the size of which is determined by the Scheme - integer argument, and make a temporary integer so we can set - destLen. */ -%typemap(in) (Bytef *dest, uLongf *destLen) (uLong len) -%{ if (!C_swig_is_fixnum ($input)) { - swig_barf (SWIG_BARF1_BAD_ARGUMENT_TYPE, "Argument $input is not a integer"); - } - len = (uLong) C_unfix ($input); - $2 = &len; - $1 = (char *) malloc (*$2); -%} - -/* Return the mutated string as a new object. */ -%typemap(argout) (Bytef *dest, uLongf *destLen) -(C_word *scmstr) -%{ scmstr = C_alloc (C_SIZEOF_STRING (*$2)); - SWIG_APPEND_VALUE(C_string (&scmstr, *$2, $1)); - free ($1); -%} - -%include "zconf.h" -%include "zlib.h" - -/* Ignore destLen as an input argument, and make a temporary integer so - we can set destLen. */ -%typemap(numinputs=0) uLongf *destLen (uLong len) -"$1 = &len;"; - -/* Return a sized string as a new object. */ -%typemap(argout) -(void *outstr, uLongf *destLen) (C_word *scmstr) -%{ scmstr = C_alloc (C_SIZEOF_STRING (*$2)); - SWIG_APPEND_VALUE(C_string (&scmstr, *$2, $1)); -%} - -%inline %{ -/* %inline blocks are seen by SWIG and are inserted into the header - portion of example_wrap.c, so that they are also seen by the C - compiler. */ -int deflate_init(z_streamp strm, int level) { - return deflateInit(strm,level); /* call macro */ -} -int inflate_init(z_streamp strm) { - return inflateInit(strm); /* call macro */ -} -void* z_stream_save_next_out(z_streamp strm) { - return (void*) strm->next_out; -} -void z_stream_get_next_chunk(z_streamp strm, void *outstr, uLongf *destLen) { - *destLen = strm->next_out - (Bytef*)outstr; -} -%} - diff --git a/Examples/chicken/zlib/test-zlib.scm b/Examples/chicken/zlib/test-zlib.scm deleted file mode 100644 index a13d801b8..000000000 --- a/Examples/chicken/zlib/test-zlib.scm +++ /dev/null @@ -1,41 +0,0 @@ -(load-library 'example "./zlib.so") - -;; Init zstream -(define s (new-z-stream)) -(z-stream-zalloc-set s #f) -(z-stream-zfree-set s #f) -(z-stream-opaque-set s #f) -(deflate-init s (Z-DEFAULT-COMPRESSION)) - -;; Deflate something small so we don't need to loop/stream data -(define in "some pony et jumping et jack et flash et had a jack pony") -(define out (make-string 1000)) -(printf "to be compressed: ~A~%to be compressed bytes: ~A~%~%" in (string-length in)) -(z-stream-next-in-set s in) -(z-stream-avail-in-set s (string-length in)) -(z-stream-next-out-set s out) -(z-stream-avail-out-set s (string-length out)) -(let* - ((saved-out (z-stream-save-next-out s)) - (ret (deflate s (Z-FINISH)))) - (cond - ((= ret (Z-STREAM-END)) - (printf "deflated properly!~%compressed bytes: ~A~%compressed stream: ~A~%" - (z-stream-total-out-get s) (z-stream-get-next-chunk s saved-out))) - ((= ret (Z-OK)) - (display "only partial deflation ... not enough output space\n")) - (else - (printf "deflate error(~D): ~A ~%" ret (z-stream-msg-get s))))) - -;; Use simple compress routine, and set max output size to 100 -(newline) -(call-with-values (lambda () (compress 100 in)) - (lambda (ret compressed) - (cond - ((= ret (Z-OK)) - (printf "compressed properly!~%compressed bytes: ~A~%compressed stream: ~A~%" - (string-length compressed) compressed)) - (else - (printf "compress error(~D): ~A ~%" ret (z-error ret)))))) - -(exit 0) diff --git a/Examples/guile/check.list b/Examples/guile/check.list index d35b2d693..7ccd0730a 100644 --- a/Examples/guile/check.list +++ b/Examples/guile/check.list @@ -1,6 +1,5 @@ # see top-level Makefile.in constants -matrix simple port multimap diff --git a/Examples/lua/lua.c b/Examples/lua/lua.c index e06e2c5fc..8cffaa503 100644 --- a/Examples/lua/lua.c +++ b/Examples/lua/lua.c @@ -1,5 +1,4 @@ /* -** $Id$ ** Lua stand-alone interpreter ** See Copyright Notice in lua.h */ diff --git a/Examples/test-suite/li_std_set.i b/Examples/test-suite/li_std_set.i index c2cdc2ebe..3c06ddc9a 100644 --- a/Examples/test-suite/li_std_set.i +++ b/Examples/test-suite/li_std_set.i @@ -1,18 +1,12 @@ -/** - * @file li_std_set.i - * @author gga - * @date Tue May 1 02:52:47 2007 - * - * @brief a test of set containers. - * Languages should define swig::LANGUAGE_OBJ to be - * an entity of their native pointer type which can be - * included in a STL container. +/* + * a test of set containers. + * Languages should define swig::LANGUAGE_OBJ to be + * an entity of their native pointer type which can be + * included in a STL container. * - * For example: - * swig::LANGUAGE_OBJ is GC_VALUE in Ruby - * swig::LANGUAGE_OBJ is PyObject_ptr in python - * - * + * For example: + * swig::LANGUAGE_OBJ is GC_VALUE in Ruby + * swig::LANGUAGE_OBJ is SwigPtr_PyObject in python */ %module li_std_set diff --git a/Examples/xml/example_gif.i b/Examples/xml/example_gif.i deleted file mode 100644 index f0fb3b183..000000000 --- a/Examples/xml/example_gif.i +++ /dev/null @@ -1,329 +0,0 @@ -/* ----------------------------------------------------------------------------- - * gifplot.h - * - * Main header file for the GIFPlot library. - * - * Author(s) : David Beazley (beazley@cs.uchicago.edu) - * Copyright (C) 1995-1996 - * - * See the file LICENSE for information on usage and redistribution. - * ----------------------------------------------------------------------------- */ - -#include -#include -#include -#include -#include -#include - -#ifndef GIFPLOT_H - -/* Pixel is 8-bits */ - -typedef unsigned char Pixel; -typedef float Zvalue; - -/* ------------------------------------------------------------------------ - ColorMap - - Definition and methods for colormaps - ------------------------------------------------------------------------ */ - -typedef struct ColorMap { - unsigned char *cmap; - char *name; -} ColorMap; - -extern ColorMap *new_ColorMap(char *filename); -extern void delete_ColorMap(ColorMap *c); -extern void ColorMap_default(ColorMap *c); -extern void ColorMap_assign(ColorMap *c, int index, int r, int g, int b); -extern int ColorMap_getitem(ColorMap *c, int index); -extern void ColorMap_setitem(ColorMap *c, int index, int value); -extern int ColorMap_write(ColorMap *c, char *filename); - -/* Some default colors */ - -#define BLACK 0 -#define WHITE 1 -#define RED 2 -#define GREEN 3 -#define BLUE 4 -#define YELLOW 5 -#define CYAN 6 -#define MAGENTA 7 - -/*------------------------------------------------------------------------- - FrameBuffer - - This structure defines a simple 8 bit framebuffer. - ------------------------------------------------------------------------- */ - -typedef struct FrameBuffer { - Pixel **pixels; - Zvalue **zbuffer; - unsigned int height; - unsigned int width; - int xmin; /* These are used for clipping */ - int ymin; - int xmax; - int ymax; -} FrameBuffer; - -#define ZMIN 1e+36 - -/* FrameBuffer Methods */ - -extern FrameBuffer *new_FrameBuffer(unsigned int width, unsigned int height); -extern void delete_FrameBuffer(FrameBuffer *frame); -extern int FrameBuffer_resize(FrameBuffer *frame, int width, int height); -extern void FrameBuffer_clear(FrameBuffer *frame, Pixel color); -extern void FrameBuffer_plot(FrameBuffer *frame, int x, int y, Pixel color); -extern void FrameBuffer_horizontal(FrameBuffer *frame, int xmin, int xmax, int y, Pixel color); -extern void FrameBuffer_horizontalinterp(FrameBuffer *f, int xmin, int xmax, int y, Pixel c1, Pixel c2); -extern void FrameBuffer_vertical(FrameBuffer *frame, int ymin, int ymax, int x, Pixel color); -extern void FrameBuffer_box(FrameBuffer *frame, int x1, int y1, int x2, int y2, Pixel color); -extern void FrameBuffer_solidbox(FrameBuffer *frame, int x1, int y1, int x2, int y2, Pixel color); -extern void FrameBuffer_interpbox(FrameBuffer *f, int x1, int y1, int x2, int y2, Pixel c1, Pixel c2, Pixel c3, Pixel c4); -extern void FrameBuffer_circle(FrameBuffer *frame, int x1, int y1, int radius, Pixel color); -extern void FrameBuffer_solidcircle(FrameBuffer *frame, int x1, int y1, int radius, Pixel color); -extern void FrameBuffer_line(FrameBuffer *frame, int x1, int y1, int x2, int y2, Pixel color); -extern void FrameBuffer_setclip(FrameBuffer *frame, int xmin, int ymin, int xmax, int ymax); -extern void FrameBuffer_noclip(FrameBuffer *frame); -extern int FrameBuffer_makeGIF(FrameBuffer *frame, ColorMap *cmap, void *buffer, unsigned int maxsize); -extern int FrameBuffer_writeGIF(FrameBuffer *f, ColorMap *c, char *filename); -extern void FrameBuffer_zresize(FrameBuffer *f, int width, int height); -extern void FrameBuffer_zclear(FrameBuffer *f); -extern void FrameBuffer_solidtriangle(FrameBuffer *f, int x1, int y1, int x2, int y2, int x3, int y3, Pixel c); -extern void FrameBuffer_interptriangle(FrameBuffer *f, int tx1, int ty1, Pixel c1, - int tx2, int ty2, Pixel c2, int tx3, int ty3, Pixel c3); - -#define HORIZONTAL 1 -#define VERTICAL 2 - -extern void FrameBuffer_drawchar(FrameBuffer *frame, int x, int y, int fgcolor, int bgcolor, char chr, int orientation); -extern void FrameBuffer_drawstring(FrameBuffer *f, int x, int y, int fgcolor, int bgcolor, char *text, int orientation); - -/* ------------------------------------------------------------------------ - PixMap - - The equivalent of "bit-maps". - ------------------------------------------------------------------------ */ - -typedef struct PixMap { - int width; - int height; - int centerx; - int centery; - int *map; -} PixMap; - -/* PIXMAP methods */ - -extern PixMap *new_PixMap(int width, int height, int centerx, int centery); -extern void delete_PixMap(PixMap *pm); -extern void PixMap_set(PixMap *pm, int x, int y, int pix); -extern void FrameBuffer_drawpixmap(FrameBuffer *f, PixMap *pm, int x, int y, int fgcolor, int bgcolor); - -#define TRANSPARENT 0 -#define FOREGROUND 1 -#define BACKGROUND 2 - -/* ------------------------------------------------------------------------ - Plot2D - - Definition and methods for 2D plots. - ------------------------------------------------------------------------ */ - -typedef struct Plot2D { - FrameBuffer *frame; /* what frame buffer are we using */ - int view_xmin; /* Minimum coordinates of view region */ - int view_ymin; - int view_xmax; /* Maximum coordinates of view region */ - int view_ymax; - double xmin; /* Minimum coordinates of plot region */ - double ymin; - double xmax; /* Maximum coordinates of plot region */ - double ymax; - int xscale; /* Type of scaling (LINEAR, LOG, etc..) */ - int yscale; - double dx; /* Private scaling parameters */ - double dy; -} Plot2D; - -/* 2D Plot methods */ - -extern Plot2D *new_Plot2D(FrameBuffer *frame,double xmin,double ymin, double xmax, double ymax); -extern void delete_Plot2D(Plot2D *p2); -extern Plot2D *Plot2D_copy(Plot2D *p2); -extern void Plot2D_clear(Plot2D *p2, Pixel c); -extern void Plot2D_setview(Plot2D *p2, int vxmin, int vymin, int vxmax, int vymax); -extern void Plot2D_setrange(Plot2D *p2, double xmin, double ymin, double xmax, double ymax); -extern void Plot2D_setscale(Plot2D *p2, int xscale, int yscale); -extern void Plot2D_plot(Plot2D *p2, double x, double y, Pixel color); -extern void Plot2D_box(Plot2D *p2, double x1, double y1, double x2, double y2, Pixel color); -extern void Plot2D_solidbox(Plot2D *p2, double x1, double y1,double x2, double y2, Pixel color); -extern void Plot2D_interpbox(Plot2D *p2, double x1, double y1, double x2, double y2, Pixel c1, Pixel c2, Pixel c3, Pixel c4); -extern void Plot2D_circle(Plot2D *p2, double x, double y, double radius, Pixel color); -extern void Plot2D_solidcircle(Plot2D *p2, double x, double y, double radius, Pixel color); -extern void Plot2D_line(Plot2D *p2, double x1, double y1, double x2, double y2, Pixel color); -extern void Plot2D_start(Plot2D *p2); -extern void Plot2D_drawpixmap(Plot2D *p2, PixMap *pm, double x, double y, Pixel color, Pixel bgcolor); -extern void Plot2D_xaxis(Plot2D *p2, double x, double y, double xtick, int ticklength, Pixel c); -extern void Plot2D_yaxis(Plot2D *p2, double x, double y, double ytick, int ticklength, Pixel c); -extern void Plot2D_triangle(Plot2D *p2, double x1, double y1, double x2, double y2, double x3, double y3, Pixel c); -extern void Plot2D_solidtriangle(Plot2D *p2, double x1, double y1, double x2, double y2, double x3, double y3, Pixel c); -extern void Plot2D_interptriangle(Plot2D *p2, double x1, double y1, Pixel c1, - double x2, double y2, Pixel c2, - double x3, double y3, Pixel c3); - -#define LINEAR 10 -#define LOG 11 - -/* ----------------------------------------------------------------------- - Matrix - - Operations on 4x4 transformation matrices and vectors. - Matrices are represented as a double array of 16 elements - ----------------------------------------------------------------------- */ - -typedef double *Matrix; -typedef struct GL_Vector { - double x; - double y; - double z; - double w; -} GL_Vector; - -extern Matrix new_Matrix(); -extern void delete_Matrix(Matrix a); -extern Matrix Matrix_copy(Matrix a); -extern void Matrix_multiply(Matrix a, Matrix b, Matrix c); -extern void Matrix_identity(Matrix a); -extern void Matrix_zero(Matrix a); -extern void Matrix_transpose(Matrix a, Matrix result); -extern void Matrix_invert(Matrix a, Matrix inva); -extern void Matrix_transform(Matrix a, GL_Vector *r, GL_Vector *t); -extern void Matrix_transform4(Matrix a, double rx, double ry, double rz, - double rw, GL_Vector *t); - -extern void Matrix_print(Matrix a); -extern void Matrix_translate(Matrix a, double tx, double ty, double tz); -extern void Matrix_rotatex(Matrix a, double deg); -extern void Matrix_rotatey(Matrix a, double deg); -extern void Matrix_rotatez(Matrix a, double deg); - -/* ----------------------------------------------------------------------- - Plot3D - - Data Structure for 3-D plots - ------------------------------------------------------------------------ */ - -typedef struct Plot3D { - FrameBuffer *frame; /* Frame buffer being used */ - int view_xmin; /* Viewing region */ - int view_ymin; - int view_xmax; - int view_ymax; - double xmin; /* Bounding box */ - double ymin; - double zmin; - double xmax; - double ymax; - double zmax; - double xcenter; /* Center point */ - double ycenter; - double zcenter; - double fovy; /* Field of view */ - double aspect; /* Aspect ratio */ - double znear; /* near "clipping" plane */ - double zfar; /* far "clipping" plane */ - Matrix center_mat; /* Matrix used for centering the model */ - Matrix model_mat; /* Model rotation matrix */ - Matrix view_mat; /* Viewing matrix */ - Matrix fullmodel_mat; /* Full model matrix. Used by sphere plot */ - Matrix trans_mat; /* Total transformation matrix */ - double lookatz; /* Where is the z-lookat point */ - double xshift; /* Used for translation and stuff */ - double yshift; - double zoom; - int width; - int height; - int pers_mode; /* Perspective mode (private) */ - double ortho_left,ortho_right,ortho_bottom,ortho_top; -} Plot3D; - -extern Plot3D *new_Plot3D(FrameBuffer *frame, double xmin, double ymin, double zmin, - double xmax, double ymax, double zmax); -extern void delete_Plot3D(Plot3D *p3); -extern Plot3D *Plot3D_copy(Plot3D *p3); -extern void Plot3D_clear(Plot3D *p3, Pixel Color); -extern void Plot3D_perspective(Plot3D *p3, double fovy, double znear, double zfar); -extern void Plot3D_ortho(Plot3D *p3, double left, double right, double top, double bottom); -extern void Plot3D_lookat(Plot3D *p3, double z); -extern void Plot3D_autoperspective(Plot3D *p3, double fovy); -extern void Plot3D_autoortho(Plot3D *p3); -extern void Plot3D_rotx(Plot3D *p3, double deg); -extern void Plot3D_roty(Plot3D *p3, double deg); -extern void Plot3D_rotz(Plot3D *p3, double deg); -extern void Plot3D_rotl(Plot3D *p3, double deg); -extern void Plot3D_rotr(Plot3D *p3, double deg); -extern void Plot3D_rotd(Plot3D *p3, double deg); -extern void Plot3D_rotu(Plot3D *p3, double deg); -extern void Plot3D_rotc(Plot3D *p3, double deg); -extern void Plot3D_zoom(Plot3D *p3, double percent); -extern void Plot3D_left(Plot3D *p3, double percent); -extern void Plot3D_right(Plot3D *p3, double percent); -extern void Plot3D_down(Plot3D *p3, double percent); -extern void Plot3D_up(Plot3D *p3, double percent); -extern void Plot3D_center(Plot3D *p3, double cx, double cy); - -extern void Plot3D_plot(Plot3D *p3, double x, double y, double z, Pixel Color); - -extern void Plot3D_setview(Plot3D *p3, int vxmin, int vymin, int vxmax, int vymax); -extern void Plot3D_start(Plot3D *p3); -extern void Plot3D_line(Plot3D *p3, double x1, double y1, double z1, - double x2, double y2, double z2, Pixel color); -extern void Plot3D_triangle(Plot3D *p3, double x1, double y1, double z1, - double x2, double y2, double z2, - double x3, double y3, double z3, Pixel color); -extern void Plot3D_solidtriangle(Plot3D *p3, double x1, double y1, double z1, - double x2, double y2, double z2, - double x3, double y3, double z3, Pixel color); - -extern void Plot3D_interptriangle(Plot3D *p3, - double x1, double y1, double z1, Pixel c1, - double x2, double y2, double z2, Pixel c2, - double x3, double y3, double z3, Pixel c3); - -extern void Plot3D_quad(Plot3D *p3, double x1, double y1, double z1, - double x2, double y2, double z2, - double x3, double y3, double z3, - double x4, double y4, double z4, - Pixel color); - -extern void Plot3D_solidquad(Plot3D *p3, double x1, double y1, double z1, - double x2, double y2, double z2, - double x3, double y3, double z3, - double x4, double y4, double z4, - Pixel color); - -extern void Plot3D_interpquad(Plot3D *p3, double x1, double y1, double z1, Pixel c1, - double x2, double y2, double z2, Pixel c2, - double x3, double y3, double z3, Pixel c3, - double x4, double y4, double z4, Pixel c4); - - -extern void Plot3D_solidsphere(Plot3D *p3, double x, double y, double z, double radius,Pixel c); - -extern void Plot3D_outlinesphere(Plot3D *p3, double x, double y, double z, double radius,Pixel c, Pixel bc); - -extern PixMap PixMap_SQUARE; -extern PixMap PixMap_TRIANGLE; -extern PixMap PixMap_CROSS; - -#endif -#define GIFPLOT_H - - - diff --git a/LICENSE b/LICENSE index fdb73d916..d7a422fda 100644 --- a/LICENSE +++ b/LICENSE @@ -1,95 +1,22 @@ -SWIG is distributed under the following terms: +SWIG is free software: you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. See the LICENSE-GPL file for +the full terms of the GNU General Public license version 3. -I. +Portions of SWIG are also licensed under the terms of the licenses +in the file LICENSE-UNIVERSITIES. You must observe the terms of +these licenses, as well as the terms of the GNU General Public License, +when you distribute SWIG. -Copyright (c) 1995-1998 -The University of Utah and the Regents of the University of California -All Rights Reserved +The SWIG library and examples, under the Lib and Examples top level +directories, are distributed under the following terms: -Permission is hereby granted, without written agreement and without -license or royalty fees, to use, copy, modify, and distribute this -software and its documentation for any purpose, provided that -(1) The above copyright notice and the following two paragraphs -appear in all copies of the source code and (2) redistributions -including binaries reproduces these notices in the supporting -documentation. Substantial modifications to this software may be -copyrighted by their authors and need not follow the licensing terms -described here, provided that the new terms are clearly indicated in -all files where they apply. - -IN NO EVENT SHALL THE AUTHOR, THE UNIVERSITY OF CALIFORNIA, THE -UNIVERSITY OF UTAH OR DISTRIBUTORS OF THIS SOFTWARE BE LIABLE TO ANY -PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL -DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, -EVEN IF THE AUTHORS OR ANY OF THE ABOVE PARTIES HAVE BEEN ADVISED OF -THE POSSIBILITY OF SUCH DAMAGE. - -THE AUTHOR, THE UNIVERSITY OF CALIFORNIA, AND THE UNIVERSITY OF UTAH -SPECIFICALLY DISCLAIM ANY WARRANTIES,INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND -THE AUTHORS AND DISTRIBUTORS HAVE NO OBLIGATION TO PROVIDE MAINTENANCE, -SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. - - -II. - -This software includes contributions that are Copyright (c) 1998-2005 -University of Chicago. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - -Redistributions of source code must retain the above copyright notice, -this list of conditions and the following disclaimer. Redistributions -in binary form must reproduce the above copyright notice, this list of -conditions and the following disclaimer in the documentation and/or -other materials provided with the distribution. Neither the name of -the University of Chicago nor the names of its contributors may be -used to endorse or promote products derived from this software without -specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF CHICAGO AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A -PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OF -CHICAGO OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -III. - -This software includes contributions that are Copyright (c) 2005-2006 -Arizona Board of Regents (University of Arizona). -All Rights Reserved - -Permission is hereby granted, without written agreement and without -license or royalty fees, to use, copy, modify, and distribute this -software and its documentation for any purpose, provided that -(1) The above copyright notice and the following two paragraphs -appear in all copies of the source code and (2) redistributions -including binaries reproduces these notices in the supporting -documentation. Substantial modifications to this software may be -copyrighted by their authors and need not follow the licensing terms -described here, provided that the new terms are clearly indicated in -all files where they apply. - -THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF ARIZONA AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A -PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OF -ARIZONA OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + You may copy, modify, distribute, and make derivative works based on + this software, in source code or object code form, without + restriction. If you distribute the software to others, you may do + so according to the terms of your choice. This software is offered as + is, without warranty of any kind. +See the COPYRIGHT file for a list of contributors to SWIG and their +copyright notices. diff --git a/LICENSE-GPL b/LICENSE-GPL new file mode 100644 index 000000000..94a9ed024 --- /dev/null +++ b/LICENSE-GPL @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/LICENSE-UNIVERSITIES b/LICENSE-UNIVERSITIES new file mode 100644 index 000000000..fdb73d916 --- /dev/null +++ b/LICENSE-UNIVERSITIES @@ -0,0 +1,95 @@ +SWIG is distributed under the following terms: + +I. + +Copyright (c) 1995-1998 +The University of Utah and the Regents of the University of California +All Rights Reserved + +Permission is hereby granted, without written agreement and without +license or royalty fees, to use, copy, modify, and distribute this +software and its documentation for any purpose, provided that +(1) The above copyright notice and the following two paragraphs +appear in all copies of the source code and (2) redistributions +including binaries reproduces these notices in the supporting +documentation. Substantial modifications to this software may be +copyrighted by their authors and need not follow the licensing terms +described here, provided that the new terms are clearly indicated in +all files where they apply. + +IN NO EVENT SHALL THE AUTHOR, THE UNIVERSITY OF CALIFORNIA, THE +UNIVERSITY OF UTAH OR DISTRIBUTORS OF THIS SOFTWARE BE LIABLE TO ANY +PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, +EVEN IF THE AUTHORS OR ANY OF THE ABOVE PARTIES HAVE BEEN ADVISED OF +THE POSSIBILITY OF SUCH DAMAGE. + +THE AUTHOR, THE UNIVERSITY OF CALIFORNIA, AND THE UNIVERSITY OF UTAH +SPECIFICALLY DISCLAIM ANY WARRANTIES,INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND +THE AUTHORS AND DISTRIBUTORS HAVE NO OBLIGATION TO PROVIDE MAINTENANCE, +SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + + +II. + +This software includes contributions that are Copyright (c) 1998-2005 +University of Chicago. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + +Redistributions of source code must retain the above copyright notice, +this list of conditions and the following disclaimer. Redistributions +in binary form must reproduce the above copyright notice, this list of +conditions and the following disclaimer in the documentation and/or +other materials provided with the distribution. Neither the name of +the University of Chicago nor the names of its contributors may be +used to endorse or promote products derived from this software without +specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF CHICAGO AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A +PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OF +CHICAGO OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED +TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +III. + +This software includes contributions that are Copyright (c) 2005-2006 +Arizona Board of Regents (University of Arizona). +All Rights Reserved + +Permission is hereby granted, without written agreement and without +license or royalty fees, to use, copy, modify, and distribute this +software and its documentation for any purpose, provided that +(1) The above copyright notice and the following two paragraphs +appear in all copies of the source code and (2) redistributions +including binaries reproduces these notices in the supporting +documentation. Substantial modifications to this software may be +copyrighted by their authors and need not follow the licensing terms +described here, provided that the new terms are clearly indicated in +all files where they apply. + +THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF ARIZONA AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A +PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OF +ARIZONA OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED +TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + diff --git a/Lib/allegrocl/allegrocl.swg b/Lib/allegrocl/allegrocl.swg index 8132e4628..eb4e87973 100644 --- a/Lib/allegrocl/allegrocl.swg +++ b/Lib/allegrocl/allegrocl.swg @@ -246,8 +246,6 @@ $body)" #endif %insert("lisphead") %{ -;; $Id$ - (eval-when (compile load eval) ;; avoid compiling ef-templates at runtime diff --git a/Lib/allegrocl/longlongs.i b/Lib/allegrocl/longlongs.i index b887a8a0a..4aa54660b 100755 --- a/Lib/allegrocl/longlongs.i +++ b/Lib/allegrocl/longlongs.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * longlongs.i * * Typemap addition for support of 'long long' type and 'unsigned long long diff --git a/Lib/allegrocl/std_list.i b/Lib/allegrocl/std_list.i index c8ab45649..4e260897f 100755 --- a/Lib/allegrocl/std_list.i +++ b/Lib/allegrocl/std_list.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * std_list.i * * SWIG typemaps for std::list types diff --git a/Lib/allegrocl/std_string.i b/Lib/allegrocl/std_string.i index 4da0148fe..becc322e9 100755 --- a/Lib/allegrocl/std_string.i +++ b/Lib/allegrocl/std_string.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * std_string.i * * SWIG typemaps for std::string diff --git a/Lib/attribute.i b/Lib/attribute.i index 45c3c5b64..0cc3ff1a3 100644 --- a/Lib/attribute.i +++ b/Lib/attribute.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * attribute.i * * SWIG library file for implementing attributes. diff --git a/Lib/carrays.i b/Lib/carrays.i index 738b4577a..5fc78877c 100644 --- a/Lib/carrays.i +++ b/Lib/carrays.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * carrays.i * * SWIG library file containing macros that can be used to manipulate simple diff --git a/Lib/cdata.i b/Lib/cdata.i index 67601f737..41e8f86ce 100644 --- a/Lib/cdata.i +++ b/Lib/cdata.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * cdata.i * * SWIG library file containing macros for manipulating raw C data as strings. diff --git a/Lib/chicken/chicken.swg b/Lib/chicken/chicken.swg index a8d1b5a57..68f022570 100644 --- a/Lib/chicken/chicken.swg +++ b/Lib/chicken/chicken.swg @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * chicken.swg * * CHICKEN configuration module. diff --git a/Lib/chicken/chickenrun.swg b/Lib/chicken/chickenrun.swg index 8703ea65a..f4e94d6f6 100644 --- a/Lib/chicken/chickenrun.swg +++ b/Lib/chicken/chickenrun.swg @@ -1,9 +1,5 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * chickenrun.swg - * * ----------------------------------------------------------------------------- */ #include diff --git a/Lib/chicken/multi-generic.scm b/Lib/chicken/multi-generic.scm index ae822f37b..9d2e31d34 100644 --- a/Lib/chicken/multi-generic.scm +++ b/Lib/chicken/multi-generic.scm @@ -21,7 +21,7 @@ ;; which functions are used when. ;; Comments, bugs, suggestions: send either to chicken-users@nongnu.org or to -;; Author: John Lenz , most code copied from TinyCLOS +;; Most code copied from TinyCLOS (define (make 'name "multi-generic" diff --git a/Lib/chicken/std_string.i b/Lib/chicken/std_string.i index 2955d0e2f..ce24cba32 100644 --- a/Lib/chicken/std_string.i +++ b/Lib/chicken/std_string.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * std_string.i * * SWIG typemaps for std::string diff --git a/Lib/chicken/typemaps.i b/Lib/chicken/typemaps.i index d79e20184..56cd18a5d 100644 --- a/Lib/chicken/typemaps.i +++ b/Lib/chicken/typemaps.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * typemaps.i * * Pointer handling diff --git a/Lib/clisp/clisp.swg b/Lib/clisp/clisp.swg index fb6cdbf2a..e1d330cb3 100644 --- a/Lib/clisp/clisp.swg +++ b/Lib/clisp/clisp.swg @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * clisp.swg * ----------------------------------------------------------------------------- */ diff --git a/Lib/cmalloc.i b/Lib/cmalloc.i index 03a61351c..9f58bc03c 100644 --- a/Lib/cmalloc.i +++ b/Lib/cmalloc.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * cmalloc.i * * SWIG library file containing macros that can be used to create objects using diff --git a/Lib/constraints.i b/Lib/constraints.i index 2deb1168a..8bc7f9159 100644 --- a/Lib/constraints.i +++ b/Lib/constraints.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * constraints.i * * SWIG constraints library. diff --git a/Lib/cpointer.i b/Lib/cpointer.i index 1a6e51741..6b15a8417 100644 --- a/Lib/cpointer.i +++ b/Lib/cpointer.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * cpointer.i * * SWIG library file containing macros that can be used to manipulate simple diff --git a/Lib/csharp/csharp.swg b/Lib/csharp/csharp.swg index e381ff9ae..0cdc2ba05 100644 --- a/Lib/csharp/csharp.swg +++ b/Lib/csharp/csharp.swg @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * csharp.swg * * C# typemaps diff --git a/Lib/csharp/csharphead.swg b/Lib/csharp/csharphead.swg index ffff70372..eec4a2f2c 100644 --- a/Lib/csharp/csharphead.swg +++ b/Lib/csharp/csharphead.swg @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * csharphead.swg * * Support code for exceptions if the SWIG_CSHARP_NO_EXCEPTION_HELPER is not defined diff --git a/Lib/csharp/director.swg b/Lib/csharp/director.swg index 8957ecf42..7768d8c02 100644 --- a/Lib/csharp/director.swg +++ b/Lib/csharp/director.swg @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * director.swg * * This file contains support for director classes so that C# proxy diff --git a/Lib/csharp/enums.swg b/Lib/csharp/enums.swg index be2a6063b..6605da8c8 100644 --- a/Lib/csharp/enums.swg +++ b/Lib/csharp/enums.swg @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * enums.swg * * Include this file in order for C/C++ enums to be wrapped by proper C# enums. diff --git a/Lib/csharp/enumsimple.swg b/Lib/csharp/enumsimple.swg index f50849892..2b1cb182b 100644 --- a/Lib/csharp/enumsimple.swg +++ b/Lib/csharp/enumsimple.swg @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * enumsimple.swg * * This file provides backwards compatible enum wrapping. SWIG versions 1.3.21 diff --git a/Lib/csharp/enumtypesafe.swg b/Lib/csharp/enumtypesafe.swg index 8ba7838ef..a6bf64b9a 100644 --- a/Lib/csharp/enumtypesafe.swg +++ b/Lib/csharp/enumtypesafe.swg @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * enumtypesafe.swg * * Include this file in order for C/C++ enums to be wrapped by the so called diff --git a/Lib/csharp/std_except.i b/Lib/csharp/std_except.i index c86e97a54..27eb84bc2 100644 --- a/Lib/csharp/std_except.i +++ b/Lib/csharp/std_except.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * std_except.i * * Typemaps used by the STL wrappers that throw exceptions. These typemaps are diff --git a/Lib/csharp/std_map.i b/Lib/csharp/std_map.i index c35f21dc7..b19414597 100644 --- a/Lib/csharp/std_map.i +++ b/Lib/csharp/std_map.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * std_map.i * * SWIG typemaps for std::map diff --git a/Lib/csharp/std_pair.i b/Lib/csharp/std_pair.i index 78142ffa6..0712ad762 100644 --- a/Lib/csharp/std_pair.i +++ b/Lib/csharp/std_pair.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * std_pair.i * * SWIG typemaps for std::pair diff --git a/Lib/csharp/std_string.i b/Lib/csharp/std_string.i index d29692717..0d804518b 100644 --- a/Lib/csharp/std_string.i +++ b/Lib/csharp/std_string.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * std_string.i * * Typemaps for std::string and const std::string& diff --git a/Lib/csharp/std_vector.i b/Lib/csharp/std_vector.i index 2e4d47c00..11d57e43d 100755 --- a/Lib/csharp/std_vector.i +++ b/Lib/csharp/std_vector.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * std_vector.i * * SWIG typemaps for std::vector diff --git a/Lib/csharp/std_wstring.i b/Lib/csharp/std_wstring.i index 938070e4b..9142d36a5 100755 --- a/Lib/csharp/std_wstring.i +++ b/Lib/csharp/std_wstring.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * std_wstring.i * * Typemaps for std::wstring and const std::wstring& diff --git a/Lib/csharp/stl.i b/Lib/csharp/stl.i index 66b72e073..9d2e91eee 100644 --- a/Lib/csharp/stl.i +++ b/Lib/csharp/stl.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * stl.i * * Initial STL definition. extended as needed in each language diff --git a/Lib/csharp/typemaps.i b/Lib/csharp/typemaps.i index ddfbd1b0c..ac8398021 100644 --- a/Lib/csharp/typemaps.i +++ b/Lib/csharp/typemaps.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * typemaps.i * * Pointer and reference handling typemap library diff --git a/Lib/csharp/wchar.i b/Lib/csharp/wchar.i index be87560c3..f02c09a53 100755 --- a/Lib/csharp/wchar.i +++ b/Lib/csharp/wchar.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * wchar.i * * Typemaps for the wchar_t type diff --git a/Lib/cstring.i b/Lib/cstring.i index 4ebdf6857..6829f7597 100644 --- a/Lib/cstring.i +++ b/Lib/cstring.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * cstring.i * ----------------------------------------------------------------------------- */ diff --git a/Lib/cwstring.i b/Lib/cwstring.i index a6b08ae40..f0631d328 100644 --- a/Lib/cwstring.i +++ b/Lib/cwstring.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * cwstring.i * ----------------------------------------------------------------------------- */ diff --git a/Lib/exception.i b/Lib/exception.i index e30ac1a5d..7297a77f5 100644 --- a/Lib/exception.i +++ b/Lib/exception.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * exception.i * * SWIG library file providing language independent exception handling diff --git a/Lib/gcj/cni.swg b/Lib/gcj/cni.swg index 247909a4a..4bd07df06 100644 --- a/Lib/gcj/cni.swg +++ b/Lib/gcj/cni.swg @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * cni.swg * ----------------------------------------------------------------------------- */ diff --git a/Lib/guile/common.scm b/Lib/guile/common.scm index a51d3a71d..17c9ab580 100644 --- a/Lib/guile/common.scm +++ b/Lib/guile/common.scm @@ -3,12 +3,6 @@ ;;;* ;;;* This file contains generic SWIG GOOPS classes for generated ;;;* GOOPS file support -;;;* -;;;* Copyright (C) 2003 John Lenz (jelenz@wisc.edu) -;;;* Copyright (C) 2004 Matthias Koeppe (mkoeppe@mail.math.uni-magdeburg.de) -;;;* -;;;* This file may be freely redistributed without license or fee provided -;;;* this copyright message remains intact. ;;;************************************************************************ (define-module (Swig swigrun)) diff --git a/Lib/guile/cplusplus.i b/Lib/guile/cplusplus.i index cb4cf7434..0dfe71754 100644 --- a/Lib/guile/cplusplus.i +++ b/Lib/guile/cplusplus.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * cplusplus.i * * SWIG typemaps for C++ diff --git a/Lib/guile/guile.i b/Lib/guile/guile.i index 1bf28d6f3..ef270d74b 100644 --- a/Lib/guile/guile.i +++ b/Lib/guile/guile.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * guile.i * * SWIG Configuration File for Guile. diff --git a/Lib/guile/guile_gh.swg b/Lib/guile/guile_gh.swg index 6412a4c61..3b65af897 100644 --- a/Lib/guile/guile_gh.swg +++ b/Lib/guile/guile_gh.swg @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * guile_gh.swg * * This SWIG interface file is processed if the Guile module is run diff --git a/Lib/guile/guile_gh_run.swg b/Lib/guile/guile_gh_run.swg index 5b1fca0aa..0eba1f97e 100644 --- a/Lib/guile/guile_gh_run.swg +++ b/Lib/guile/guile_gh_run.swg @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * guile_gh_run.swg * * Guile GH runtime file diff --git a/Lib/guile/guile_scm.swg b/Lib/guile/guile_scm.swg index caded728d..d12401451 100644 --- a/Lib/guile/guile_scm.swg +++ b/Lib/guile/guile_scm.swg @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * guile_scm.swg * * This SWIG interface file is processed if the Guile module is run diff --git a/Lib/guile/guile_scm_run.swg b/Lib/guile/guile_scm_run.swg index 5da8558fc..91b74095d 100644 --- a/Lib/guile/guile_scm_run.swg +++ b/Lib/guile/guile_scm_run.swg @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * guile_scm_run.swg * ----------------------------------------------------------------------------- */ diff --git a/Lib/guile/guilemain.i b/Lib/guile/guilemain.i index 6f4e4d94d..925b81fee 100644 --- a/Lib/guile/guilemain.i +++ b/Lib/guile/guilemain.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * guilemain.i * * The main functions for a user augmented guile diff --git a/Lib/guile/interpreter.i b/Lib/guile/interpreter.i index 7e8f0777a..524e0694a 100644 --- a/Lib/guile/interpreter.i +++ b/Lib/guile/interpreter.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * interpreter.i * * SWIG file for a simple Guile interpreter diff --git a/Lib/guile/list-vector.i b/Lib/guile/list-vector.i index d98cae59a..c2cd1aea2 100644 --- a/Lib/guile/list-vector.i +++ b/Lib/guile/list-vector.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * list_vector.i * * Guile typemaps for converting between arrays and Scheme lists or vectors diff --git a/Lib/guile/pointer-in-out.i b/Lib/guile/pointer-in-out.i index bc6438759..d8a631ca9 100644 --- a/Lib/guile/pointer-in-out.i +++ b/Lib/guile/pointer-in-out.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * pointer-in-out.i * * Guile typemaps for passing pointers indirectly diff --git a/Lib/guile/ports.i b/Lib/guile/ports.i index 0d0e142e1..5940b4d3b 100644 --- a/Lib/guile/ports.i +++ b/Lib/guile/ports.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * ports.i * * Guile typemaps for handling ports diff --git a/Lib/guile/std_common.i b/Lib/guile/std_common.i index ace5d65a8..a46c42c69 100644 --- a/Lib/guile/std_common.i +++ b/Lib/guile/std_common.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * std_common.i * * SWIG typemaps for STL - common utilities diff --git a/Lib/guile/std_map.i b/Lib/guile/std_map.i index cc53e1560..19c863096 100644 --- a/Lib/guile/std_map.i +++ b/Lib/guile/std_map.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * std_map.i * * SWIG typemaps for std::map diff --git a/Lib/guile/std_pair.i b/Lib/guile/std_pair.i index f8c2ea688..35f0cfad5 100644 --- a/Lib/guile/std_pair.i +++ b/Lib/guile/std_pair.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * std_pair.i * * SWIG typemaps for std::pair diff --git a/Lib/guile/std_string.i b/Lib/guile/std_string.i index f80a65ca5..c10806e98 100644 --- a/Lib/guile/std_string.i +++ b/Lib/guile/std_string.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * std_string.i * * SWIG typemaps for std::string diff --git a/Lib/guile/std_vector.i b/Lib/guile/std_vector.i index 145db945b..6801daee8 100644 --- a/Lib/guile/std_vector.i +++ b/Lib/guile/std_vector.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * std_vector.i * * SWIG typemaps for std::vector diff --git a/Lib/guile/stl.i b/Lib/guile/stl.i index 66b72e073..9d2e91eee 100644 --- a/Lib/guile/stl.i +++ b/Lib/guile/stl.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * stl.i * * Initial STL definition. extended as needed in each language diff --git a/Lib/guile/typemaps.i b/Lib/guile/typemaps.i index d9f972850..4f306f7f8 100644 --- a/Lib/guile/typemaps.i +++ b/Lib/guile/typemaps.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * typemaps.i * * Guile-specific typemaps diff --git a/Lib/inttypes.i b/Lib/inttypes.i index 0cc81948e..8450cb840 100644 --- a/Lib/inttypes.i +++ b/Lib/inttypes.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * inttypes.i * * SWIG library file for ISO C99 types: 7.8 Format conversion of integer types diff --git a/Lib/java/arrays_java.i b/Lib/java/arrays_java.i index 95510c3f9..ddaf7408c 100644 --- a/Lib/java/arrays_java.i +++ b/Lib/java/arrays_java.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * arrays_java.i * * These typemaps give more natural support for arrays. The typemaps are not efficient diff --git a/Lib/java/director.swg b/Lib/java/director.swg index fa588671d..07e5a1af1 100644 --- a/Lib/java/director.swg +++ b/Lib/java/director.swg @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * director.swg * * This file contains support for director classes that proxy diff --git a/Lib/java/enums.swg b/Lib/java/enums.swg index 1a8f89b3a..edb67c417 100644 --- a/Lib/java/enums.swg +++ b/Lib/java/enums.swg @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * enums.swg * * Include this file in order for C/C++ enums to be wrapped by proper Java enums. diff --git a/Lib/java/enumsimple.swg b/Lib/java/enumsimple.swg index f45774d0c..e08401869 100644 --- a/Lib/java/enumsimple.swg +++ b/Lib/java/enumsimple.swg @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * enumsimple.swg * * This file provides backwards compatible enum wrapping. SWIG versions 1.3.21 diff --git a/Lib/java/enumtypesafe.swg b/Lib/java/enumtypesafe.swg index a49a9d134..d6c6e5190 100644 --- a/Lib/java/enumtypesafe.swg +++ b/Lib/java/enumtypesafe.swg @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * enumtypesafe.swg * * Include this file in order for C/C++ enums to be wrapped by the so called diff --git a/Lib/java/enumtypeunsafe.swg b/Lib/java/enumtypeunsafe.swg index bda055113..d9a7c4d29 100644 --- a/Lib/java/enumtypeunsafe.swg +++ b/Lib/java/enumtypeunsafe.swg @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * enumtypeunsafe.swg * * Include this file in order for C/C++ enums to be wrapped by integers values. diff --git a/Lib/java/java.swg b/Lib/java/java.swg index 7d1808632..b5b1bc431 100644 --- a/Lib/java/java.swg +++ b/Lib/java/java.swg @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * java.swg * * Java typemaps diff --git a/Lib/java/javahead.swg b/Lib/java/javahead.swg index 4aa0c84b5..f348b9d54 100644 --- a/Lib/java/javahead.swg +++ b/Lib/java/javahead.swg @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * javahead.swg * * Java support code diff --git a/Lib/java/std_except.i b/Lib/java/std_except.i index 15be1deb8..9e23d50e6 100644 --- a/Lib/java/std_except.i +++ b/Lib/java/std_except.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * std_except.i * * Typemaps used by the STL wrappers that throw exceptions. diff --git a/Lib/java/std_map.i b/Lib/java/std_map.i index 00967d3f9..a7020532c 100644 --- a/Lib/java/std_map.i +++ b/Lib/java/std_map.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * std_map.i * * SWIG typemaps for std::map diff --git a/Lib/java/std_pair.i b/Lib/java/std_pair.i index dc0604dc5..fe45ee676 100644 --- a/Lib/java/std_pair.i +++ b/Lib/java/std_pair.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * std_pair.i * * SWIG typemaps for std::pair diff --git a/Lib/java/std_string.i b/Lib/java/std_string.i index 789e17a65..f0d837696 100644 --- a/Lib/java/std_string.i +++ b/Lib/java/std_string.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * std_string.i * * Typemaps for std::string and const std::string& diff --git a/Lib/java/std_vector.i b/Lib/java/std_vector.i index 92fa25ac2..e243eec1b 100644 --- a/Lib/java/std_vector.i +++ b/Lib/java/std_vector.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * std_vector.i * ----------------------------------------------------------------------------- */ diff --git a/Lib/java/std_wstring.i b/Lib/java/std_wstring.i index 989176500..12d8fc14f 100644 --- a/Lib/java/std_wstring.i +++ b/Lib/java/std_wstring.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * std_wstring.i * * Typemaps for std::wstring and const std::wstring& diff --git a/Lib/java/stl.i b/Lib/java/stl.i index b8d7a654c..04f86014f 100644 --- a/Lib/java/stl.i +++ b/Lib/java/stl.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * stl.i * ----------------------------------------------------------------------------- */ diff --git a/Lib/java/typemaps.i b/Lib/java/typemaps.i index 59f7af99a..74ed99374 100644 --- a/Lib/java/typemaps.i +++ b/Lib/java/typemaps.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * typemaps.i * * Pointer and reference handling typemap library diff --git a/Lib/java/various.i b/Lib/java/various.i index 733b8fa79..7c396de3e 100644 --- a/Lib/java/various.i +++ b/Lib/java/various.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * various.i * * SWIG Typemap library for Java. diff --git a/Lib/lua/_std_common.i b/Lib/lua/_std_common.i index 33cc513c3..e552d0c8f 100644 --- a/Lib/lua/_std_common.i +++ b/Lib/lua/_std_common.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * _std_common.i * * std::helpers for LUA diff --git a/Lib/lua/lua.swg b/Lib/lua/lua.swg index b6d888670..c3f5cecc5 100644 --- a/Lib/lua/lua.swg +++ b/Lib/lua/lua.swg @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * lua.swg * * SWIG Configuration File for Lua. diff --git a/Lib/lua/lua_fnptr.i b/Lib/lua/lua_fnptr.i index c7df6f5a3..7e9facdf3 100644 --- a/Lib/lua/lua_fnptr.i +++ b/Lib/lua/lua_fnptr.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * lua_fnptr.i * * SWIG Library file containing the main typemap code to support Lua modules. diff --git a/Lib/lua/luarun.swg b/Lib/lua/luarun.swg index 32e1b1617..4c9aa5144 100644 --- a/Lib/lua/luarun.swg +++ b/Lib/lua/luarun.swg @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * luarun.swg * * This file contains the runtime support for Lua modules diff --git a/Lib/lua/luaruntime.swg b/Lib/lua/luaruntime.swg index b82cd56d7..5823d4fcf 100644 --- a/Lib/lua/luaruntime.swg +++ b/Lib/lua/luaruntime.swg @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * luaruntime.swg * * all the runtime code for . diff --git a/Lib/lua/luatypemaps.swg b/Lib/lua/luatypemaps.swg index 0941c9da1..34db14a17 100644 --- a/Lib/lua/luatypemaps.swg +++ b/Lib/lua/luatypemaps.swg @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * luatypemaps.swg * * basic typemaps for Lua. diff --git a/Lib/lua/std_except.i b/Lib/lua/std_except.i index ce148ef63..9c736b9ef 100644 --- a/Lib/lua/std_except.i +++ b/Lib/lua/std_except.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * Typemaps used by the STL wrappers that throw exceptions. * These typemaps are used when methods are declared with an STL exception * specification, such as: diff --git a/Lib/lua/std_map.i b/Lib/lua/std_map.i index dd22443d5..84b0c74ff 100644 --- a/Lib/lua/std_map.i +++ b/Lib/lua/std_map.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * std_map.i * * SWIG typemaps for std::map diff --git a/Lib/lua/std_pair.i b/Lib/lua/std_pair.i index 1b20f74e0..c76361554 100644 --- a/Lib/lua/std_pair.i +++ b/Lib/lua/std_pair.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * std_pair.i * * std::pair typemaps for LUA diff --git a/Lib/lua/std_string.i b/Lib/lua/std_string.i index fa58f10bb..92f27d738 100644 --- a/Lib/lua/std_string.i +++ b/Lib/lua/std_string.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * std_string.i * * std::string typemaps for LUA diff --git a/Lib/lua/std_vector.i b/Lib/lua/std_vector.i index c6778087f..f248f0340 100644 --- a/Lib/lua/std_vector.i +++ b/Lib/lua/std_vector.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * std_vector.i * * std::vector typemaps for LUA diff --git a/Lib/lua/stl.i b/Lib/lua/stl.i index b8d7a654c..04f86014f 100644 --- a/Lib/lua/stl.i +++ b/Lib/lua/stl.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * stl.i * ----------------------------------------------------------------------------- */ diff --git a/Lib/lua/typemaps.i b/Lib/lua/typemaps.i index fa0c0d0e5..084726e58 100644 --- a/Lib/lua/typemaps.i +++ b/Lib/lua/typemaps.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * typemaps.swg * * SWIG Library file containing the main typemap code to support Lua modules. diff --git a/Lib/lua/wchar.i b/Lib/lua/wchar.i index 5b206eb71..5021c1604 100644 --- a/Lib/lua/wchar.i +++ b/Lib/lua/wchar.i @@ -1,12 +1,8 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * wchar.i * * Typemaps for the wchar_t type * These are mapped to a Lua string and are passed around by value. - * * ----------------------------------------------------------------------------- */ // note: only support for pointer right now, not fixed length strings @@ -43,4 +39,4 @@ if ($1==0) {lua_pushfstring(L,"Error in converting to wchar (arg %d)",$input);go free($1); %} -%typemap(typecheck) wchar_t * = char *; \ No newline at end of file +%typemap(typecheck) wchar_t * = char *; diff --git a/Lib/math.i b/Lib/math.i index be931d71b..a37c92d19 100644 --- a/Lib/math.i +++ b/Lib/math.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * math.i * * SWIG library file for floating point operations. diff --git a/Lib/modula3/modula3.swg b/Lib/modula3/modula3.swg index 6a1b4d94d..599a12e5a 100644 --- a/Lib/modula3/modula3.swg +++ b/Lib/modula3/modula3.swg @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * modula3.swg * * Modula3 typemaps diff --git a/Lib/modula3/modula3head.swg b/Lib/modula3/modula3head.swg index b2426be5f..af96a78d1 100644 --- a/Lib/modula3/modula3head.swg +++ b/Lib/modula3/modula3head.swg @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * modula3head.swg * * Modula3 support code diff --git a/Lib/modula3/typemaps.i b/Lib/modula3/typemaps.i index 79ddfda0f..1d76ab5e0 100644 --- a/Lib/modula3/typemaps.i +++ b/Lib/modula3/typemaps.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * typemaps.i * * Pointer and reference handling typemap library diff --git a/Lib/mzscheme/mzrun.swg b/Lib/mzscheme/mzrun.swg index 3b05d2406..a5128da56 100644 --- a/Lib/mzscheme/mzrun.swg +++ b/Lib/mzscheme/mzrun.swg @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * mzrun.swg * ----------------------------------------------------------------------------- */ diff --git a/Lib/mzscheme/mzscheme.swg b/Lib/mzscheme/mzscheme.swg index ed4b2ec9d..9ae242845 100644 --- a/Lib/mzscheme/mzscheme.swg +++ b/Lib/mzscheme/mzscheme.swg @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * mzscheme.swg * * SWIG Configuration File for MzScheme. diff --git a/Lib/mzscheme/std_common.i b/Lib/mzscheme/std_common.i index 8732f811c..1f1ae1ab7 100644 --- a/Lib/mzscheme/std_common.i +++ b/Lib/mzscheme/std_common.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * std_common.i * * SWIG typemaps for STL - common utilities diff --git a/Lib/mzscheme/std_map.i b/Lib/mzscheme/std_map.i index aff720db6..b2c894509 100644 --- a/Lib/mzscheme/std_map.i +++ b/Lib/mzscheme/std_map.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * std_map.i * * SWIG typemaps for std::map diff --git a/Lib/mzscheme/std_pair.i b/Lib/mzscheme/std_pair.i index 2ac331e71..d5a65470d 100644 --- a/Lib/mzscheme/std_pair.i +++ b/Lib/mzscheme/std_pair.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * std_pair.i * * SWIG typemaps for std::pair diff --git a/Lib/mzscheme/std_string.i b/Lib/mzscheme/std_string.i index c9a82efe4..b8b99d9ad 100644 --- a/Lib/mzscheme/std_string.i +++ b/Lib/mzscheme/std_string.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * std_string.i * * SWIG typemaps for std::string types diff --git a/Lib/mzscheme/std_vector.i b/Lib/mzscheme/std_vector.i index 90a52fc0a..22e1fa96b 100644 --- a/Lib/mzscheme/std_vector.i +++ b/Lib/mzscheme/std_vector.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * std_vector.i * * SWIG typemaps for std::vector diff --git a/Lib/mzscheme/stl.i b/Lib/mzscheme/stl.i index 946e4b7f0..b19eae58b 100644 --- a/Lib/mzscheme/stl.i +++ b/Lib/mzscheme/stl.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * stl.i * * Initial STL definition. extended as needed in each language diff --git a/Lib/mzscheme/typemaps.i b/Lib/mzscheme/typemaps.i index 334893242..b9f22440c 100644 --- a/Lib/mzscheme/typemaps.i +++ b/Lib/mzscheme/typemaps.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * typemaps.i * ----------------------------------------------------------------------------- */ diff --git a/Lib/ocaml/cstring.i b/Lib/ocaml/cstring.i index e56258264..0d6aa4b69 100644 --- a/Lib/ocaml/cstring.i +++ b/Lib/ocaml/cstring.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * cstring.i * * This file provides typemaps and macros for dealing with various forms diff --git a/Lib/ocaml/director.swg b/Lib/ocaml/director.swg index 87333168f..a21f62102 100644 --- a/Lib/ocaml/director.swg +++ b/Lib/ocaml/director.swg @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * director.swg * * This file contains support for director classes that proxy diff --git a/Lib/ocaml/ocaml.i b/Lib/ocaml/ocaml.i index a46e239d1..e099f7c10 100644 --- a/Lib/ocaml/ocaml.i +++ b/Lib/ocaml/ocaml.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * ocaml.i * * SWIG Configuration File for Ocaml diff --git a/Lib/ocaml/ocamldec.swg b/Lib/ocaml/ocamldec.swg index 3b5290fa1..8e452d3f9 100644 --- a/Lib/ocaml/ocamldec.swg +++ b/Lib/ocaml/ocamldec.swg @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * ocamldec.swg * * Ocaml runtime code -- declarations diff --git a/Lib/ocaml/std_common.i b/Lib/ocaml/std_common.i index b2dff61d2..1c397050c 100644 --- a/Lib/ocaml/std_common.i +++ b/Lib/ocaml/std_common.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * std_common.i * * SWIG typemaps for STL - common utilities diff --git a/Lib/ocaml/std_deque.i b/Lib/ocaml/std_deque.i index 44815ebda..a6c489597 100644 --- a/Lib/ocaml/std_deque.i +++ b/Lib/ocaml/std_deque.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * std_deque.i * * Default std_deque wrapper diff --git a/Lib/ocaml/std_list.i b/Lib/ocaml/std_list.i index 0aea90767..06181cca8 100644 --- a/Lib/ocaml/std_list.i +++ b/Lib/ocaml/std_list.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * std_list.i * * SWIG typemaps for std::list types diff --git a/Lib/ocaml/std_map.i b/Lib/ocaml/std_map.i index f174f2872..f202e74ed 100644 --- a/Lib/ocaml/std_map.i +++ b/Lib/ocaml/std_map.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * std_map.i * * SWIG typemaps for std::map diff --git a/Lib/ocaml/std_pair.i b/Lib/ocaml/std_pair.i index dc0604dc5..fe45ee676 100644 --- a/Lib/ocaml/std_pair.i +++ b/Lib/ocaml/std_pair.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * std_pair.i * * SWIG typemaps for std::pair diff --git a/Lib/ocaml/std_string.i b/Lib/ocaml/std_string.i index 7add3a070..e75e95304 100644 --- a/Lib/ocaml/std_string.i +++ b/Lib/ocaml/std_string.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * std_string.i * * SWIG typemaps for std::string diff --git a/Lib/ocaml/std_vector.i b/Lib/ocaml/std_vector.i index 91c335562..53d107447 100644 --- a/Lib/ocaml/std_vector.i +++ b/Lib/ocaml/std_vector.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * std_vector.i * * SWIG typemaps for std::vector types diff --git a/Lib/ocaml/stl.i b/Lib/ocaml/stl.i index 66b72e073..9d2e91eee 100644 --- a/Lib/ocaml/stl.i +++ b/Lib/ocaml/stl.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * stl.i * * Initial STL definition. extended as needed in each language diff --git a/Lib/ocaml/typecheck.i b/Lib/ocaml/typecheck.i index 51e66061b..4c3500690 100644 --- a/Lib/ocaml/typecheck.i +++ b/Lib/ocaml/typecheck.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * typecheck.i * * Typechecking rules diff --git a/Lib/ocaml/typemaps.i b/Lib/ocaml/typemaps.i index 7f978bf7f..39544de94 100644 --- a/Lib/ocaml/typemaps.i +++ b/Lib/ocaml/typemaps.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * typemaps.i * * The Ocaml module handles all types uniformly via typemaps. Here diff --git a/Lib/octave/octcontainer.swg b/Lib/octave/octcontainer.swg index bb1122a7b..d0e37112e 100644 --- a/Lib/octave/octcontainer.swg +++ b/Lib/octave/octcontainer.swg @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * octcontainer.swg * * Octave cell <-> C++ container wrapper diff --git a/Lib/octave/octiterators.swg b/Lib/octave/octiterators.swg index 926361e10..0e3fe7033 100644 --- a/Lib/octave/octiterators.swg +++ b/Lib/octave/octiterators.swg @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * octiterators.swg * * Users can derive form the OctSwigIterator to implemet their diff --git a/Lib/perl5/perlmain.i b/Lib/perl5/perlmain.i index f224b9c75..18ecb7eb5 100644 --- a/Lib/perl5/perlmain.i +++ b/Lib/perl5/perlmain.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * perlmain.i * * Code to statically rebuild perl5. diff --git a/Lib/perl5/reference.i b/Lib/perl5/reference.i index d3d745cfc..06712bbd5 100644 --- a/Lib/perl5/reference.i +++ b/Lib/perl5/reference.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * reference.i * * Accept Perl references as pointers diff --git a/Lib/perl5/std_common.i b/Lib/perl5/std_common.i index bc25b353f..c36513912 100644 --- a/Lib/perl5/std_common.i +++ b/Lib/perl5/std_common.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * std_common.i * * SWIG typemaps for STL - common utilities diff --git a/Lib/perl5/std_list.i b/Lib/perl5/std_list.i index 633e40d9a..c6bca18f6 100644 --- a/Lib/perl5/std_list.i +++ b/Lib/perl5/std_list.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * std_list.i * * SWIG typemaps for std::list types diff --git a/Lib/perl5/std_map.i b/Lib/perl5/std_map.i index c35f21dc7..b19414597 100644 --- a/Lib/perl5/std_map.i +++ b/Lib/perl5/std_map.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * std_map.i * * SWIG typemaps for std::map diff --git a/Lib/perl5/std_pair.i b/Lib/perl5/std_pair.i index 78142ffa6..0712ad762 100644 --- a/Lib/perl5/std_pair.i +++ b/Lib/perl5/std_pair.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * std_pair.i * * SWIG typemaps for std::pair diff --git a/Lib/perl5/std_vector.i b/Lib/perl5/std_vector.i index b1f722d4b..c6cacfe7e 100644 --- a/Lib/perl5/std_vector.i +++ b/Lib/perl5/std_vector.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * std_vector.i * * SWIG typemaps for std::vector types diff --git a/Lib/perl5/stl.i b/Lib/perl5/stl.i index 946e4b7f0..b19eae58b 100644 --- a/Lib/perl5/stl.i +++ b/Lib/perl5/stl.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * stl.i * * Initial STL definition. extended as needed in each language diff --git a/Lib/perl5/typemaps.i b/Lib/perl5/typemaps.i index fc6d8f874..7d96f2ace 100644 --- a/Lib/perl5/typemaps.i +++ b/Lib/perl5/typemaps.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * typemaps.i * * The SWIG typemap library provides a language independent mechanism for diff --git a/Lib/php/const.i b/Lib/php/const.i index 6ddd403d0..08096c98b 100644 --- a/Lib/php/const.i +++ b/Lib/php/const.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * const.i * * Typemaps for constants diff --git a/Lib/php/globalvar.i b/Lib/php/globalvar.i index a75b1a41e..3027ca84e 100644 --- a/Lib/php/globalvar.i +++ b/Lib/php/globalvar.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * globalvar.i * * Global variables - add the variable to PHP diff --git a/Lib/php/php.swg b/Lib/php/php.swg index d30e0b2a9..903af5612 100644 --- a/Lib/php/php.swg +++ b/Lib/php/php.swg @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * php.swg * * PHP configuration file diff --git a/Lib/php/phpkw.swg b/Lib/php/phpkw.swg index 3d1a62511..e7d4f2fda 100644 --- a/Lib/php/phpkw.swg +++ b/Lib/php/phpkw.swg @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * phpkw.swg * * The 'keywords' in PHP are global, ie, the following names are fine diff --git a/Lib/php/phprun.swg b/Lib/php/phprun.swg index b4e4276f5..c7976a3dc 100644 --- a/Lib/php/phprun.swg +++ b/Lib/php/phprun.swg @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * phprun.swg * * PHP runtime library diff --git a/Lib/php/std_common.i b/Lib/php/std_common.i index a779649dd..092bf012b 100644 --- a/Lib/php/std_common.i +++ b/Lib/php/std_common.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * std_common.i * * SWIG typemaps for STL - common utilities diff --git a/Lib/php/std_map.i b/Lib/php/std_map.i index c6721806b..ede5fbe30 100644 --- a/Lib/php/std_map.i +++ b/Lib/php/std_map.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * std_map.i * * SWIG typemaps for std::map diff --git a/Lib/php/std_pair.i b/Lib/php/std_pair.i index dc0604dc5..fe45ee676 100644 --- a/Lib/php/std_pair.i +++ b/Lib/php/std_pair.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * std_pair.i * * SWIG typemaps for std::pair diff --git a/Lib/php/std_string.i b/Lib/php/std_string.i index 08a7cdac9..22c953bf5 100644 --- a/Lib/php/std_string.i +++ b/Lib/php/std_string.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * std_string.i * * SWIG typemaps for std::string types diff --git a/Lib/php/std_vector.i b/Lib/php/std_vector.i index b54181618..4cfc94f74 100644 --- a/Lib/php/std_vector.i +++ b/Lib/php/std_vector.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * std_vector.i * * SWIG typemaps for std::vector types diff --git a/Lib/php/stl.i b/Lib/php/stl.i index 66b72e073..9d2e91eee 100644 --- a/Lib/php/stl.i +++ b/Lib/php/stl.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * stl.i * * Initial STL definition. extended as needed in each language diff --git a/Lib/php/typemaps.i b/Lib/php/typemaps.i index c5b749578..30235f278 100644 --- a/Lib/php/typemaps.i +++ b/Lib/php/typemaps.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * typemaps.i. * * SWIG Typemap library for PHP4. diff --git a/Lib/pike/pike.swg b/Lib/pike/pike.swg index e72da8fba..2ba27671e 100644 --- a/Lib/pike/pike.swg +++ b/Lib/pike/pike.swg @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * pike.swg * * Pike configuration module. diff --git a/Lib/pike/pikerun.swg b/Lib/pike/pikerun.swg index 875fcf4e2..451a4e092 100644 --- a/Lib/pike/pikerun.swg +++ b/Lib/pike/pikerun.swg @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * pikerun.swg * * This file contains the runtime support for Pike modules diff --git a/Lib/pike/std_string.i b/Lib/pike/std_string.i index ca1fad822..0694035bf 100644 --- a/Lib/pike/std_string.i +++ b/Lib/pike/std_string.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * std_string.i * * SWIG typemaps for std::string diff --git a/Lib/pointer.i b/Lib/pointer.i index 16e11b7d1..8015317d7 100644 --- a/Lib/pointer.i +++ b/Lib/pointer.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * pointer.i * ----------------------------------------------------------------------------- */ diff --git a/Lib/python/ccomplex.i b/Lib/python/ccomplex.i index 30f797d74..28872b985 100644 --- a/Lib/python/ccomplex.i +++ b/Lib/python/ccomplex.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * ccomplex.i * * C complex typemaps diff --git a/Lib/python/director.swg b/Lib/python/director.swg index 836d107ce..090da0205 100644 --- a/Lib/python/director.swg +++ b/Lib/python/director.swg @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * director.swg * * This file contains support for director classes that proxy diff --git a/Lib/python/embed15.i b/Lib/python/embed15.i index f677d166e..4abfbba75 100644 --- a/Lib/python/embed15.i +++ b/Lib/python/embed15.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * embed15.i * * SWIG file embedding the Python interpreter in something else. diff --git a/Lib/python/file.i b/Lib/python/file.i index 294ab9178..359c34d2c 100644 --- a/Lib/python/file.i +++ b/Lib/python/file.i @@ -1,11 +1,7 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * file.i * * Typemaps for FILE* - * From the ideas of Luigi Ballabio * ----------------------------------------------------------------------------- */ %types(FILE *); diff --git a/Lib/python/pycontainer.swg b/Lib/python/pycontainer.swg index 58442ef76..006ab016f 100644 --- a/Lib/python/pycontainer.swg +++ b/Lib/python/pycontainer.swg @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * pycontainer.swg * * Python sequence <-> C++ container wrapper diff --git a/Lib/python/pyiterators.swg b/Lib/python/pyiterators.swg index 62a7eaf70..9f85ffc4a 100644 --- a/Lib/python/pyiterators.swg +++ b/Lib/python/pyiterators.swg @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * pyiterators.swg * * Implement a python 'output' iterator for Python 2.2 or higher. diff --git a/Lib/python/pyrun.swg b/Lib/python/pyrun.swg index 4f51d3a95..1aae2d7aa 100644 --- a/Lib/python/pyrun.swg +++ b/Lib/python/pyrun.swg @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * pyrun.swg * * This file contains the runtime support for Python modules diff --git a/Lib/python/typemaps.i b/Lib/python/typemaps.i index 1c87de61d..5d438ecab 100644 --- a/Lib/python/typemaps.i +++ b/Lib/python/typemaps.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * typemaps.i * * Pointer handling diff --git a/Lib/ruby/director.swg b/Lib/ruby/director.swg index 9a6371ad9..60c086f5b 100644 --- a/Lib/ruby/director.swg +++ b/Lib/ruby/director.swg @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * director.swg * * This file contains support for director classes that proxy diff --git a/Lib/ruby/rubyautodoc.swg b/Lib/ruby/rubyautodoc.swg index ade4bde1d..1e6b0d9dc 100644 --- a/Lib/ruby/rubyautodoc.swg +++ b/Lib/ruby/rubyautodoc.swg @@ -1,13 +1,8 @@ -/** - * @file rubyautodoc.swg - * @author gga - * @date Wed May 2 16:41:59 2007 - * - * @brief This file implements autodoc typemaps for some common - * ruby methods. - * - * - */ +/* ----------------------------------------------------------------------------- + * rubyautodoc.swg + * + * This file implements autodoc typemaps for some common ruby methods. + * ----------------------------------------------------------------------------- */ %define AUTODOC(func, str) %feature("autodoc", str) func; diff --git a/Lib/ruby/rubycontainer.swg b/Lib/ruby/rubycontainer.swg index 919695ec2..c93094aeb 100644 --- a/Lib/ruby/rubycontainer.swg +++ b/Lib/ruby/rubycontainer.swg @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * rubycontainer.swg * * Ruby sequence <-> C++ container wrapper diff --git a/Lib/ruby/rubycontainer_extended.swg b/Lib/ruby/rubycontainer_extended.swg index 360e399ce..09be64aee 100644 --- a/Lib/ruby/rubycontainer_extended.swg +++ b/Lib/ruby/rubycontainer_extended.swg @@ -1,17 +1,13 @@ -/** - * @file rubycontainer_extended.swg - * @author gga - * @date Sat May 5 05:36:01 2007 - * - * @brief This file contains additional functions that make containers - * behave closer to ruby primitive types. - * However, some of these functions place some restrictions on - * the underlying object inside of the container and the iterator - * (that it has to have an == comparison function, that it has to have - * an = assignment operator, etc). - * - */ - +/* ----------------------------------------------------------------------------- + * rubycontainer_extended.swg + * + * This file contains additional functions that make containers + * behave closer to ruby primitive types. + * However, some of these functions place some restrictions on + * the underlying object inside of the container and the iterator + * (that it has to have an == comparison function, that it has to have + * an = assignment operator, etc). + * ----------------------------------------------------------------------------- */ /** * Macro used to add extend functions that require operator== in object. diff --git a/Lib/ruby/rubyiterators.swg b/Lib/ruby/rubyiterators.swg index 466ae221b..aba156a2b 100644 --- a/Lib/ruby/rubyiterators.swg +++ b/Lib/ruby/rubyiterators.swg @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * rubyiterators.swg * * Implement a C++ 'output' iterator for Ruby. diff --git a/Lib/ruby/rubyprimtypes.swg b/Lib/ruby/rubyprimtypes.swg index c2d577995..aff35dcf1 100644 --- a/Lib/ruby/rubyprimtypes.swg +++ b/Lib/ruby/rubyprimtypes.swg @@ -1,9 +1,5 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * rubyprimtypes.swg - * * ----------------------------------------------------------------------------- */ /* ------------------------------------------------------------ * Primitive Types diff --git a/Lib/ruby/rubyrun.swg b/Lib/ruby/rubyrun.swg index 24d861d5a..ccc997a71 100644 --- a/Lib/ruby/rubyrun.swg +++ b/Lib/ruby/rubyrun.swg @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * rubyrun.swg * * This file contains the runtime support for Ruby modules diff --git a/Lib/ruby/rubystdautodoc.swg b/Lib/ruby/rubystdautodoc.swg index ad70f7f8b..e14f65902 100644 --- a/Lib/ruby/rubystdautodoc.swg +++ b/Lib/ruby/rubystdautodoc.swg @@ -1,12 +1,8 @@ -/** - * @file rubystdautodoc.swg - * @author gga - * @date Wed May 2 17:20:39 2007 +/* ----------------------------------------------------------------------------- + * rubystdautodoc.swg * - * @brief This file contains autodocs for standard STL functions. - * - * - */ + * This file contains autodocs for standard STL functions. + * ----------------------------------------------------------------------------- */ // // For STL autodocumentation diff --git a/Lib/ruby/rubytracking.swg b/Lib/ruby/rubytracking.swg index 959d2087e..0a36f4a05 100644 --- a/Lib/ruby/rubytracking.swg +++ b/Lib/ruby/rubytracking.swg @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * rubytracking.swg * * This file contains support for tracking mappings from diff --git a/Lib/ruby/rubywstrings.swg b/Lib/ruby/rubywstrings.swg index 0cf9d7ed9..d1fe918ad 100644 --- a/Lib/ruby/rubywstrings.swg +++ b/Lib/ruby/rubywstrings.swg @@ -1,15 +1,11 @@ -/** - * @file rubywstrings.swg - * @author - * @date Fri May 4 17:49:40 2007 - * - * @brief Currently, Ruby does not support Unicode or WChar properly, so these - * are still treated as char arrays for now. - * There are other libraries available that add support to this in - * ruby including WString, FXString, etc. - * - * - */ +/* ----------------------------------------------------------------------------- + * rubywstrings.swg + * + * Currently, Ruby does not support Unicode or WChar properly, so these + * are still treated as char arrays for now. + * There are other libraries available that add support to this in + * ruby including WString, FXString, etc. + * ----------------------------------------------------------------------------- */ /* ------------------------------------------------------------ * utility methods for wchar_t strings diff --git a/Lib/ruby/stl.i b/Lib/ruby/stl.i index 66b72e073..9d2e91eee 100644 --- a/Lib/ruby/stl.i +++ b/Lib/ruby/stl.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * stl.i * * Initial STL definition. extended as needed in each language diff --git a/Lib/ruby/typemaps.i b/Lib/ruby/typemaps.i index 2492e2e03..c4db82161 100644 --- a/Lib/ruby/typemaps.i +++ b/Lib/ruby/typemaps.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * typemaps.i * * Pointer handling diff --git a/Lib/std/_std_deque.i b/Lib/std/_std_deque.i index 026f373d6..c30523c0d 100644 --- a/Lib/std/_std_deque.i +++ b/Lib/std/_std_deque.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * _std_deque.i * * This file contains a generic definition of std::deque along with diff --git a/Lib/std_except.i b/Lib/std_except.i index af9803a62..769a68995 100644 --- a/Lib/std_except.i +++ b/Lib/std_except.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * std_except.i * * SWIG library file with typemaps to handle and throw STD exceptions in a diff --git a/Lib/stdint.i b/Lib/stdint.i index 7b48ca388..14fe6195e 100644 --- a/Lib/stdint.i +++ b/Lib/stdint.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * stdint.i * * SWIG library file for ISO C99 types: 7.18 Integer types diff --git a/Lib/stl.i b/Lib/stl.i index c3ade01ea..0b236afda 100644 --- a/Lib/stl.i +++ b/Lib/stl.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * stl.i * ----------------------------------------------------------------------------- */ diff --git a/Lib/swigarch.i b/Lib/swigarch.i index 260b60880..f5aea4678 100644 --- a/Lib/swigarch.i +++ b/Lib/swigarch.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * swigarch.i * * SWIG library file for 32bit/64bit code specialization and checking. diff --git a/Lib/swigrun.i b/Lib/swigrun.i index 17a140968..6026a9151 100644 --- a/Lib/swigrun.i +++ b/Lib/swigrun.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * swigrun.i * * Empty module (for now). Placeholder for runtime libs diff --git a/Lib/tcl/mactclinit.c b/Lib/tcl/mactclinit.c deleted file mode 100644 index 5dcf8e7f3..000000000 --- a/Lib/tcl/mactclinit.c +++ /dev/null @@ -1,93 +0,0 @@ -/* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * - * mactclinit.c - * ----------------------------------------------------------------------------- */ - -/* - * tclMacAppInit.c -- - * - * Provides a version of the Tcl_AppInit procedure for the example shell. - * - * Copyright (c) 1993-1994 Lockheed Missle & Space Company, AI Center - * Copyright (c) 1995-1997 Sun Microsystems, Inc. - * - * See the file "license.terms" for information on usage and redistribution - * of this file, and for a DISCLAIMER OF ALL WARRANTIES. - * - * SCCS: @(#) tclMacAppInit.c 1.17 97/01/21 18:13:34 - */ - -#include "tcl.h" -#include "tclInt.h" -#include "tclMacInt.h" - -#if defined(THINK_C) -# include -#elif defined(__MWERKS__) -# include -short InstallConsole _ANSI_ARGS_((short fd)); -#endif - - - -/* - *---------------------------------------------------------------------- - * - * MacintoshInit -- - * - * This procedure calls initalization routines to set up a simple - * console on a Macintosh. This is necessary as the Mac doesn't - * have a stdout & stderr by default. - * - * Results: - * Returns TCL_OK if everything went fine. If it didn't the - * application should probably fail. - * - * Side effects: - * Inits the appropiate console package. - * - *---------------------------------------------------------------------- - */ - -#ifdef __cplusplus -extern "C" -#endif -extern int -MacintoshInit() -{ -#if defined(THINK_C) - - /* Set options for Think C console package */ - /* The console package calls the Mac init calls */ - console_options.pause_atexit = 0; - console_options.title = "\pTcl Interpreter"; - -#elif defined(__MWERKS__) - - /* Set options for CodeWarrior SIOUX package */ - SIOUXSettings.autocloseonquit = true; - SIOUXSettings.showstatusline = true; - SIOUXSettings.asktosaveonclose = false; - InstallConsole(0); - SIOUXSetTitle("\pTcl Interpreter"); - -#elif defined(applec) - - /* Init packages used by MPW SIOW package */ - InitGraf((Ptr)&qd.thePort); - InitFonts(); - InitWindows(); - InitMenus(); - TEInit(); - InitDialogs(nil); - InitCursor(); - -#endif - - TclMacSetEventProc((TclMacConvertEventPtr) SIOUXHandleOneEvent); - - /* No problems with initialization */ - return TCL_OK; -} diff --git a/Lib/tcl/mactkinit.c b/Lib/tcl/mactkinit.c index bfe74029c..78391d445 100644 --- a/Lib/tcl/mactkinit.c +++ b/Lib/tcl/mactkinit.c @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * mactkinit.c * * This is a support file needed to build a new version of Wish. diff --git a/Lib/tcl/std_common.i b/Lib/tcl/std_common.i index 3a6f47042..0718facb8 100644 --- a/Lib/tcl/std_common.i +++ b/Lib/tcl/std_common.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * std_common.i * * SWIG typemaps for STL - common utilities diff --git a/Lib/tcl/std_pair.i b/Lib/tcl/std_pair.i index 52e96674f..1448d6524 100644 --- a/Lib/tcl/std_pair.i +++ b/Lib/tcl/std_pair.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * std_pair.i * * Typemaps for std::pair diff --git a/Lib/tcl/std_vector.i b/Lib/tcl/std_vector.i index d913f00cc..3c8dd24b7 100644 --- a/Lib/tcl/std_vector.i +++ b/Lib/tcl/std_vector.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * std_vector.i * ----------------------------------------------------------------------------- */ diff --git a/Lib/tcl/stl.i b/Lib/tcl/stl.i index afd121341..40c7584ec 100644 --- a/Lib/tcl/stl.i +++ b/Lib/tcl/stl.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * stl.i * ----------------------------------------------------------------------------- */ diff --git a/Lib/tcl/tcl8.swg b/Lib/tcl/tcl8.swg index c33cc7681..5da1bc07c 100644 --- a/Lib/tcl/tcl8.swg +++ b/Lib/tcl/tcl8.swg @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * tcl8.swg * * Tcl configuration module. diff --git a/Lib/tcl/tclinterp.i b/Lib/tcl/tclinterp.i index 48cdb6066..3b45b6d4b 100644 --- a/Lib/tcl/tclinterp.i +++ b/Lib/tcl/tclinterp.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * tclinterp.i * * Tcl_Interp *interp diff --git a/Lib/tcl/tclopers.swg b/Lib/tcl/tclopers.swg index 26b74203d..f113ccd19 100644 --- a/Lib/tcl/tclopers.swg +++ b/Lib/tcl/tclopers.swg @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * tclopers.swg * * C++ overloaded operators. diff --git a/Lib/tcl/tclresult.i b/Lib/tcl/tclresult.i index ca0106432..c63b3ee19 100644 --- a/Lib/tcl/tclresult.i +++ b/Lib/tcl/tclresult.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * tclresult.i * ----------------------------------------------------------------------------- */ diff --git a/Lib/tcl/tclrun.swg b/Lib/tcl/tclrun.swg index 6387fb008..eb8bd253c 100644 --- a/Lib/tcl/tclrun.swg +++ b/Lib/tcl/tclrun.swg @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * tclrun.swg * * This file contains the runtime support for Tcl modules and includes diff --git a/Lib/tcl/tclsh.i b/Lib/tcl/tclsh.i index 2e8ed3316..160ba8d8f 100644 --- a/Lib/tcl/tclsh.i +++ b/Lib/tcl/tclsh.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * tclsh.i * * SWIG File for building new tclsh program diff --git a/Lib/tcl/tclwstrings.swg b/Lib/tcl/tclwstrings.swg index 2d344c20f..b3b682e30 100644 --- a/Lib/tcl/tclwstrings.swg +++ b/Lib/tcl/tclwstrings.swg @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * tclwstrings.wg * * Utility methods for wchar strings diff --git a/Lib/tcl/typemaps.i b/Lib/tcl/typemaps.i index 7c9e04a8b..8bee672cc 100644 --- a/Lib/tcl/typemaps.i +++ b/Lib/tcl/typemaps.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * typemaps.i * * Swig typemap library for Tcl8. This file contains various sorts diff --git a/Lib/tcl/wish.i b/Lib/tcl/wish.i index 077ded61f..260032a81 100644 --- a/Lib/tcl/wish.i +++ b/Lib/tcl/wish.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * wish.i * * SWIG File for making wish diff --git a/Lib/typemaps/attribute.swg b/Lib/typemaps/attribute.swg index f6335be82..19b22ed01 100644 --- a/Lib/typemaps/attribute.swg +++ b/Lib/typemaps/attribute.swg @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * attribute.swg * * Attribute implementation diff --git a/Lib/typemaps/carrays.swg b/Lib/typemaps/carrays.swg index 27ca11779..cdeab36b7 100644 --- a/Lib/typemaps/carrays.swg +++ b/Lib/typemaps/carrays.swg @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * carrays.swg * * This library file contains macros that can be used to manipulate simple diff --git a/Lib/typemaps/cdata.swg b/Lib/typemaps/cdata.swg index 32b3f5a77..5baf7904c 100644 --- a/Lib/typemaps/cdata.swg +++ b/Lib/typemaps/cdata.swg @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * cdata.swg * * This library file contains macros for manipulating raw C data as strings. diff --git a/Lib/typemaps/cmalloc.swg b/Lib/typemaps/cmalloc.swg index 15f962930..45a6ab990 100644 --- a/Lib/typemaps/cmalloc.swg +++ b/Lib/typemaps/cmalloc.swg @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * cmalloc.swg * * This library file contains macros that can be used to create objects using diff --git a/Lib/typemaps/cpointer.swg b/Lib/typemaps/cpointer.swg index ce1af169e..f797a6895 100644 --- a/Lib/typemaps/cpointer.swg +++ b/Lib/typemaps/cpointer.swg @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * cpointer.swg * * This library file contains macros that can be used to manipulate simple diff --git a/Lib/typemaps/cstrings.swg b/Lib/typemaps/cstrings.swg index 9144da790..c60ef6496 100644 --- a/Lib/typemaps/cstrings.swg +++ b/Lib/typemaps/cstrings.swg @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * cstrings.swg * * This file provides typemaps and macros for dealing with various forms diff --git a/Lib/typemaps/exception.swg b/Lib/typemaps/exception.swg index 17a819cd7..12c4ea658 100644 --- a/Lib/typemaps/exception.swg +++ b/Lib/typemaps/exception.swg @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * exceptions.swg * * This SWIG library file provides language independent exception handling diff --git a/Lib/typemaps/ptrtypes.swg b/Lib/typemaps/ptrtypes.swg index 803377afe..e1bc476ed 100644 --- a/Lib/typemaps/ptrtypes.swg +++ b/Lib/typemaps/ptrtypes.swg @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * ptrtypes.swg * * Value typemaps (Type, const Type&) for "Ptr" types, such as swig diff --git a/Lib/typemaps/swigtypemaps.swg b/Lib/typemaps/swigtypemaps.swg index 08abab028..0e39afe4c 100644 --- a/Lib/typemaps/swigtypemaps.swg +++ b/Lib/typemaps/swigtypemaps.swg @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * swigtypemaps.swg * * Unified Typemap Library frontend diff --git a/Lib/typemaps/typemaps.swg b/Lib/typemaps/typemaps.swg index 6e7505765..4629e8dfa 100644 --- a/Lib/typemaps/typemaps.swg +++ b/Lib/typemaps/typemaps.swg @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * typemaps.swg * * Tcl Pointer handling diff --git a/Lib/uffi/uffi.swg b/Lib/uffi/uffi.swg index 78bd23534..41b085998 100644 --- a/Lib/uffi/uffi.swg +++ b/Lib/uffi/uffi.swg @@ -27,8 +27,6 @@ typedef long size_t; %wrapper %{ -;; $Id$ - (eval-when (compile eval) ;;; You can define your own identifier converter if you want. diff --git a/Lib/wchar.i b/Lib/wchar.i index f106a3529..14de34634 100644 --- a/Lib/wchar.i +++ b/Lib/wchar.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * wchar.i * ----------------------------------------------------------------------------- */ diff --git a/Lib/windows.i b/Lib/windows.i index 08ddc2b22..2c093dacc 100644 --- a/Lib/windows.i +++ b/Lib/windows.i @@ -1,7 +1,4 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * * windows.i * * SWIG library file to support types found in windows.h as well as Microsoft diff --git a/Makefile.in b/Makefile.in index ebfc03656..9760fdd9c 100644 --- a/Makefile.in +++ b/Makefile.in @@ -162,50 +162,6 @@ java.actionexample: (cd Examples/$(LANGUAGE)/java && $(MAKE) -s $(chk-set-env) $(ACTION)) \ fi; \ -gifplot-library: - @echo $(ACTION)ing Examples/GIFPlot/Lib - @cd Examples/GIFPlot/Lib && $(MAKE) -k -s $(ACTION) - -check-gifplot: \ - check-tcl-gifplot \ - check-perl5-gifplot \ - check-python-gifplot \ - check-java-gifplot \ - check-guile-gifplot \ - check-mzscheme-gifplot \ - check-ruby-gifplot \ - check-ocaml-gifplot \ - check-octave-gifplot \ - check-php4-gifplot \ - check-pike-gifplot \ - check-chicken-gifplot \ -# check-lua-gifplot \ -# check-csharp-gifplot \ -# check-modula3-gifplot - -check-%-gifplot: gifplot-library - @if test -z "$(skip-$*)"; then \ - echo $* unknown; \ - exit 1; \ - fi - @passed=true; \ - up=`$(srcdir)/Tools/capitalize $*`; \ - dir="Examples/GIFPlot/$$up"; \ - if $(skip-$*); then \ - echo skipping $$up $(ACTION); \ - elif [ ! -f $$dir/check.list ]; then \ - echo skipping $$up $(ACTION) "(no $$dir/check.list)"; \ - else \ - all=`sed '/^#/d' $$dir/check.list`; \ - for a in $$all; do \ - echo $(ACTION)ing $$dir/$$a; \ - (cd $$dir/$$a && \ - $(MAKE) -k -s $(chk-set-env) $(ACTION)) \ - || passed=false; \ - done; \ - fi; \ - test $$passed = true - # Checks testcases in the test-suite excluding those which are known to be broken check-test-suite: \ check-tcl-test-suite \ @@ -255,7 +211,7 @@ partialcheck-test-suite: partialcheck-%-test-suite: @$(MAKE) -k -s check-$*-test-suite ACTION=partialcheck -check: check-aliveness check-examples check-gifplot check-test-suite +check: check-aliveness check-examples check-test-suite # Run known-to-be-broken as well as not broken testcases in the test-suite all-test-suite: \ @@ -315,7 +271,7 @@ broken-%-test-suite: # CLEAN ##################################################################### -clean: clean-objects clean-libfiles clean-examples clean-gifplot clean-test-suite clean-docs +clean: clean-objects clean-libfiles clean-examples clean-test-suite clean-docs clean-objects: clean-source @@ -330,9 +286,6 @@ clean-libfiles: clean-examples: @$(MAKE) -k -s check-examples ACTION=clean -clean-gifplot: - @$(MAKE) -k -s check-gifplot ACTION=clean - clean-test-suite: @$(MAKE) -k -s check-test-suite ACTION=clean @@ -342,9 +295,6 @@ clean-%-examples: clean-%-test-suite: @$(MAKE) -k -s check-$*-test-suite ACTION=clean -clean-%-gifplot: - @$(MAKE) -k -s check-$*-gifplot ACTION=clean - clean-docs: @echo cleaning Docs @test -d $(DOCS) || exit 0; cd $(DOCS) && $(MAKE) -s clean @@ -358,7 +308,7 @@ maintainer-clean: clean-libfiles DISTCLEAN-DEAD = config.status config.log config.cache swig.spec Makefile mkmf.log libtool -distclean: distclean-objects clean-examples clean-gifplot distclean-test-suite clean-docs distclean-dead +distclean: distclean-objects clean-examples distclean-test-suite clean-docs distclean-dead distclean-objects: distclean-source diff --git a/README b/README index 2898130b0..d6174bda5 100644 --- a/README +++ b/README @@ -1,6 +1,6 @@ SWIG (Simplified Wrapper and Interface Generator) -Version: 1.3.36 (24 June 2008) +Version: 2.0.0 (in progress) Tagline: SWIG is a compiler that integrates C and C++ with languages including Perl, Python, Tcl, Ruby, PHP, Java, Ocaml, Lua, @@ -13,61 +13,6 @@ the listed languages, or to extend C/C++ programs with a scripting language. This distribution represents the latest development release of SWIG. -The guilty parties working on this are: - -Active Developers: - William Fulton (wsf@fultondesigns.co.uk) (SWIG core, Java, C#, Windows, Cygwin) - Olly Betts (olly@survex.com) (PHP) - John Lenz (Guile, MzScheme updates, Chicken module, runtime system) - Mark Gossage (mark@gossage.cjb.net) (Lua) - Joseph Wang (joe@gnacademy.org) (R) - Gonzalo Garramuno (ggarra@advancedsl.com.ar) (Ruby, Ruby's UTL) - Xavier Delacour (xavier.delacour@gmail.com) (Octave) - -Major contributors include: - Dave Beazley (dave-swig@dabeaz.com) (SWIG core, Python, Tcl, Perl) - Henning Thielemann (swig@henning-thielemann.de) (Modula3) - Matthias Köppe (mkoeppe@mail.math.uni-magdeburg.de) (Guile, MzScheme) - Luigi Ballabio (luigi.ballabio@fastwebnet.it) (STL wrapping) - Mikel Bancroft (mikel@franz.com) (Allegro CL) - Surendra Singhi (efuzzyone@netscape.net) (CLISP, CFFI) - Marcelo Matus (mmatus@acms.arizona.edu) (SWIG core, Python, UTL[python,perl,tcl,ruby]) - Art Yerkes (ayerkes@speakeasy.net) (Ocaml) - Lyle Johnson (lyle@users.sourceforge.net) (Ruby) - Charlie Savage (cfis@interserv.com) (Ruby) - Thien-Thi Nguyen (ttn@glug.org) (build/test/misc) - Richard Palmer (richard@magicality.org) (PHP) - Sam Liddicott - Anonova Ltd (saml@liddicott.com) (PHP) - Tim Hockin - Sun Microsystems (thockin@sun.com) (PHP) - Kevin Ruland (PHP) - Shibukawa Yoshiki (Japanese Translation) - Jason Stewart (jason@openinformatics.com) (Perl5) - Loic Dachary (Perl5) - David Fletcher (Perl5) - Gary Holt (Perl5) - Masaki Fukushima (Ruby) - Scott Michel (scottm@cs.ucla.edu) (Java directors) - Tiger Feng (songyanf@cs.uchicago.edu) (SWIG core) - Mark Rose (mrose@stm.lbl.gov) (Directors) - Jonah Beckford (beckford@usermail.com) (CHICKEN) - Ahmon Dancy (dancy@franz.com) (Allegro CL) - Dirk Gerrits (Allegro CL) - Neil Cawse (C#) - Harco de Hilster (Java) - Alexey Dyachenko (dyachenko@fromru.com) (Tcl) - Bob Techentin (Tcl) - Martin Froehlich (Guile) - Marcio Luis Teixeira (Guile) - Duncan Temple Lang (R) - -Past contributors include: - James Michael DuPont, Clark McGrew, Dustin Mitchell, Ian Cooke, Catalin Dumitrescu, Baran - Kovuk, Oleg Tolmatcev, Tal Shalif, Lluis Padro, Chris Seatory, Igor Bely, Robin Dunn - (See CHANGES for a more complete list). - -Portions also copyrighted by companies/corporations; - Network Applied Communication Laboratory, Inc - Information-technology Promotion Agency, Japan Up-to-date SWIG related information can be found at diff --git a/Source/CParse/cparse.h b/Source/CParse/cparse.h index 06a901c0d..522ca778f 100644 --- a/Source/CParse/cparse.h +++ b/Source/CParse/cparse.h @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * cparse.h * diff --git a/Source/CParse/cscanner.c b/Source/CParse/cscanner.c index 68d50cd2d..ea265bb56 100644 --- a/Source/CParse/cscanner.c +++ b/Source/CParse/cscanner.c @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * scanner.c * diff --git a/Source/CParse/parser.y b/Source/CParse/parser.y index d28516206..1b055edd9 100644 --- a/Source/CParse/parser.y +++ b/Source/CParse/parser.y @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * parser.y * diff --git a/Source/CParse/templ.c b/Source/CParse/templ.c index a3e992f83..120b75670 100644 --- a/Source/CParse/templ.c +++ b/Source/CParse/templ.c @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * templ.c * diff --git a/Source/CParse/util.c b/Source/CParse/util.c index efae41051..fa934ffc0 100644 --- a/Source/CParse/util.c +++ b/Source/CParse/util.c @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * util.c * diff --git a/Source/DOH/base.c b/Source/DOH/base.c index dcb0140e0..7d19e6c3d 100644 --- a/Source/DOH/base.c +++ b/Source/DOH/base.c @@ -1,13 +1,15 @@ /* ----------------------------------------------------------------------------- + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. + * * base.c * * This file contains the function entry points for dispatching methods on * DOH objects. A number of small utility functions are also included. - * - * Author(s) : David Beazley (beazley@cs.uchicago.edu) - * - * Copyright (C) 1999-2000. The University of Chicago - * See the file LICENSE for information on usage and redistribution. * ----------------------------------------------------------------------------- */ char cvsroot_base_c[] = "$Id$"; diff --git a/Source/DOH/doh.h b/Source/DOH/doh.h index 7ab244fab..396a9cacf 100644 --- a/Source/DOH/doh.h +++ b/Source/DOH/doh.h @@ -1,14 +1,14 @@ /* ----------------------------------------------------------------------------- + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. + * * doh.h * * This file describes of the externally visible functions in DOH. - * - * Author(s) : David Beazley (beazley@cs.uchicago.edu) - * - * Copyright (C) 1999-2000. The University of Chicago - * See the file LICENSE for information on usage and redistribution. - * - * $Id$ * ----------------------------------------------------------------------------- */ #ifndef _DOH_H diff --git a/Source/DOH/dohint.h b/Source/DOH/dohint.h index 1fc5eb7c9..661bed075 100644 --- a/Source/DOH/dohint.h +++ b/Source/DOH/dohint.h @@ -1,15 +1,14 @@ - /* ----------------------------------------------------------------------------- + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. + * * dohint.h * * This file describes internally managed objects. - * - * Author(s) : David Beazley (beazley@cs.uchicago.edu) - * - * Copyright (C) 1999-2000. The University of Chicago - * See the file LICENSE for information on usage and redistribution. - * - * $Id$ * ----------------------------------------------------------------------------- */ #ifndef _DOHINT_H diff --git a/Source/DOH/file.c b/Source/DOH/file.c index 8c53978ee..3d8d20284 100644 --- a/Source/DOH/file.c +++ b/Source/DOH/file.c @@ -1,13 +1,15 @@ /* ----------------------------------------------------------------------------- + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. + * * file.c * * This file implements a file-like object that can be built around an * ordinary FILE * or integer file descriptor. - * - * Author(s) : David Beazley (beazley@cs.uchicago.edu) - * - * Copyright (C) 1999-2000. The University of Chicago - * See the file LICENSE for information on usage and redistribution. * ----------------------------------------------------------------------------- */ char cvsroot_file_c[] = "$Id$"; diff --git a/Source/DOH/fio.c b/Source/DOH/fio.c index f544cee64..2ef605c32 100644 --- a/Source/DOH/fio.c +++ b/Source/DOH/fio.c @@ -1,13 +1,15 @@ /* ----------------------------------------------------------------------------- + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. + * * fio.c * * This file implements a number of standard I/O operations included * formatted output, readline, and splitting. - * - * Author(s) : David Beazley (beazley@cs.uchicago.edu) - * - * Copyright (C) 1999-2000. The University of Chicago - * See the file LICENSE for information on usage and redistribution. * ----------------------------------------------------------------------------- */ char cvsroot_fio_c[] = "$Id$"; diff --git a/Source/DOH/hash.c b/Source/DOH/hash.c index 62aef10f2..ab90e725e 100644 --- a/Source/DOH/hash.c +++ b/Source/DOH/hash.c @@ -1,12 +1,14 @@ /* ----------------------------------------------------------------------------- + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. + * * hash.c * * Implements a simple hash table object. - * - * Author(s) : David Beazley (beazley@cs.uchicago.edu) - * - * Copyright (C) 1999-2000. The University of Chicago - * See the file LICENSE for information on usage and redistribution. * ----------------------------------------------------------------------------- */ char cvsroot_hash_c[] = "$Id$"; diff --git a/Source/DOH/list.c b/Source/DOH/list.c index a45731de1..f3be4fba1 100644 --- a/Source/DOH/list.c +++ b/Source/DOH/list.c @@ -1,12 +1,14 @@ /* ----------------------------------------------------------------------------- + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. + * * list.c * * Implements a simple list object. - * - * Author(s) : David Beazley (beazley@cs.uchicago.edu) - * - * Copyright (C) 1999-2000. The University of Chicago - * See the file LICENSE for information on usage and redistribution. * ----------------------------------------------------------------------------- */ char cvsroot_list_c[] = "$Id$"; diff --git a/Source/DOH/memory.c b/Source/DOH/memory.c index 1c6063ef3..fcacd6170 100644 --- a/Source/DOH/memory.c +++ b/Source/DOH/memory.c @@ -1,13 +1,15 @@ /* ----------------------------------------------------------------------------- + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. + * * memory.c * * This file implements all of DOH's memory management including allocation * of objects and checking of objects. - * - * Author(s) : David Beazley (beazley@cs.uchicago.edu) - * - * Copyright (C) 1999-2000. The University of Chicago - * See the file LICENSE for information on usage and redistribution. * ----------------------------------------------------------------------------- */ char cvsroot_memory_c[] = "$Id$"; diff --git a/Source/DOH/string.c b/Source/DOH/string.c index 1498d717a..ea6b46cb2 100644 --- a/Source/DOH/string.c +++ b/Source/DOH/string.c @@ -1,13 +1,15 @@ /* ----------------------------------------------------------------------------- + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. + * * string.c * * Implements a string object that supports both sequence operations and * file semantics. - * - * Author(s) : David Beazley (beazley@cs.uchicago.edu) - * - * Copyright (C) 1999-2000. The University of Chicago - * See the file LICENSE for information on usage and redistribution. * ----------------------------------------------------------------------------- */ char cvsroot_string_c[] = "$Id$"; diff --git a/Source/DOH/void.c b/Source/DOH/void.c index 0be01561a..2d684b9cd 100644 --- a/Source/DOH/void.c +++ b/Source/DOH/void.c @@ -1,13 +1,15 @@ /* ----------------------------------------------------------------------------- + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. + * * void.c * * Implements a "void" object that is really just a DOH container around * an arbitrary C object represented as a void *. - * - * Author(s) : David Beazley (beazley@cs.uchicago.edu) - * - * Copyright (C) 1999-2000. The University of Chicago - * See the file LICENSE for information on usage and redistribution. * ----------------------------------------------------------------------------- */ char cvsroot_void_c[] = "$Id$"; diff --git a/Source/Include/swigwarn.h b/Source/Include/swigwarn.h index 8c4678847..d7a06c46c 100644 --- a/Source/Include/swigwarn.h +++ b/Source/Include/swigwarn.h @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * swigwarn.h * @@ -16,8 +20,6 @@ * numbers in this file. * ----------------------------------------------------------------------------- */ -/* $Id$ */ - #ifndef SWIGWARN_H_ #define SWIGWARN_H_ diff --git a/Source/Modules/allegrocl.cxx b/Source/Modules/allegrocl.cxx index 217c89b1f..34ca51f8d 100644 --- a/Source/Modules/allegrocl.cxx +++ b/Source/Modules/allegrocl.cxx @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * allegrocl.cxx * diff --git a/Source/Modules/allocate.cxx b/Source/Modules/allocate.cxx index e8397e6a6..31f27e1eb 100644 --- a/Source/Modules/allocate.cxx +++ b/Source/Modules/allocate.cxx @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * allocate.cxx * diff --git a/Source/Modules/browser.cxx b/Source/Modules/browser.cxx index b1bc7349c..592e12783 100644 --- a/Source/Modules/browser.cxx +++ b/Source/Modules/browser.cxx @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * browser.cxx * diff --git a/Source/Modules/cffi.cxx b/Source/Modules/cffi.cxx index 4b3ddac70..97859f090 100644 --- a/Source/Modules/cffi.cxx +++ b/Source/Modules/cffi.cxx @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * cffi.cxx * diff --git a/Source/Modules/chicken.cxx b/Source/Modules/chicken.cxx index 2298d2939..ec77f1870 100644 --- a/Source/Modules/chicken.cxx +++ b/Source/Modules/chicken.cxx @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * chicken.cxx * diff --git a/Source/Modules/clisp.cxx b/Source/Modules/clisp.cxx index 823f22e2c..f0e57f3f0 100644 --- a/Source/Modules/clisp.cxx +++ b/Source/Modules/clisp.cxx @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * clisp.cxx * diff --git a/Source/Modules/contract.cxx b/Source/Modules/contract.cxx index 9bf8decf6..e8687c90b 100644 --- a/Source/Modules/contract.cxx +++ b/Source/Modules/contract.cxx @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * contract.cxx * diff --git a/Source/Modules/csharp.cxx b/Source/Modules/csharp.cxx index 431181355..7992b260a 100644 --- a/Source/Modules/csharp.cxx +++ b/Source/Modules/csharp.cxx @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * csharp.cxx * diff --git a/Source/Modules/directors.cxx b/Source/Modules/directors.cxx index 4363cd813..2050d953e 100644 --- a/Source/Modules/directors.cxx +++ b/Source/Modules/directors.cxx @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * directors.cxx * diff --git a/Source/Modules/emit.cxx b/Source/Modules/emit.cxx index a4cf8cebc..fde3b2457 100644 --- a/Source/Modules/emit.cxx +++ b/Source/Modules/emit.cxx @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * emit.cxx * diff --git a/Source/Modules/guile.cxx b/Source/Modules/guile.cxx index f5f080034..d64c87b49 100644 --- a/Source/Modules/guile.cxx +++ b/Source/Modules/guile.cxx @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * guile.cxx * diff --git a/Source/Modules/java.cxx b/Source/Modules/java.cxx index 0c5ad5401..279eb530e 100644 --- a/Source/Modules/java.cxx +++ b/Source/Modules/java.cxx @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * java.cxx * diff --git a/Source/Modules/lang.cxx b/Source/Modules/lang.cxx index e2fd93f7b..122270a9d 100644 --- a/Source/Modules/lang.cxx +++ b/Source/Modules/lang.cxx @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * lang.cxx * diff --git a/Source/Modules/lua.cxx b/Source/Modules/lua.cxx index 6113da960..e81974c9b 100644 --- a/Source/Modules/lua.cxx +++ b/Source/Modules/lua.cxx @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * lua.cxx * diff --git a/Source/Modules/main.cxx b/Source/Modules/main.cxx index 901ee812e..055af907f 100644 --- a/Source/Modules/main.cxx +++ b/Source/Modules/main.cxx @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * main.cxx * diff --git a/Source/Modules/modula3.cxx b/Source/Modules/modula3.cxx index 6cb24d39a..5ee3c6b5c 100644 --- a/Source/Modules/modula3.cxx +++ b/Source/Modules/modula3.cxx @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * modula3.cxx * diff --git a/Source/Modules/module.cxx b/Source/Modules/module.cxx index 6a0d6bbb9..f4ab560dd 100644 --- a/Source/Modules/module.cxx +++ b/Source/Modules/module.cxx @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * module.cxx * diff --git a/Source/Modules/mzscheme.cxx b/Source/Modules/mzscheme.cxx index 78d4a4b65..01e3b9c8c 100644 --- a/Source/Modules/mzscheme.cxx +++ b/Source/Modules/mzscheme.cxx @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * mzscheme.cxx * diff --git a/Source/Modules/ocaml.cxx b/Source/Modules/ocaml.cxx index 0d0f4c7f2..b8d932ffb 100755 --- a/Source/Modules/ocaml.cxx +++ b/Source/Modules/ocaml.cxx @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * ocaml.cxx * diff --git a/Source/Modules/octave.cxx b/Source/Modules/octave.cxx index d582e8a6c..4aa9c0ab8 100644 --- a/Source/Modules/octave.cxx +++ b/Source/Modules/octave.cxx @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * octave.cxx * diff --git a/Source/Modules/overload.cxx b/Source/Modules/overload.cxx index d16913885..793511c57 100644 --- a/Source/Modules/overload.cxx +++ b/Source/Modules/overload.cxx @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * overload.cxx * diff --git a/Source/Modules/perl5.cxx b/Source/Modules/perl5.cxx index 6e706fc8d..8faff7d7f 100644 --- a/Source/Modules/perl5.cxx +++ b/Source/Modules/perl5.cxx @@ -1,10 +1,10 @@ -/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*- - * vim:expandtab:shiftwidth=2:tabstop=8:smarttab: - */ - /* ---------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * perl5.cxx * diff --git a/Source/Modules/php.cxx b/Source/Modules/php.cxx index 9369c2489..66ca6eff2 100644 --- a/Source/Modules/php.cxx +++ b/Source/Modules/php.cxx @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * php4.cxx * diff --git a/Source/Modules/pike.cxx b/Source/Modules/pike.cxx index 30f9b3d74..f4a6c13e6 100644 --- a/Source/Modules/pike.cxx +++ b/Source/Modules/pike.cxx @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * pike.cxx * diff --git a/Source/Modules/python.cxx b/Source/Modules/python.cxx index bfbada1da..c8d7e06ca 100644 --- a/Source/Modules/python.cxx +++ b/Source/Modules/python.cxx @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * python.cxx * diff --git a/Source/Modules/r.cxx b/Source/Modules/r.cxx index 49d3ecc89..9035f5e9e 100644 --- a/Source/Modules/r.cxx +++ b/Source/Modules/r.cxx @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * r.cxx * diff --git a/Source/Modules/ruby.cxx b/Source/Modules/ruby.cxx index ad448d34e..ec0d3dee9 100644 --- a/Source/Modules/ruby.cxx +++ b/Source/Modules/ruby.cxx @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * ruby.cxx * diff --git a/Source/Modules/s-exp.cxx b/Source/Modules/s-exp.cxx index b89b3097f..86213fcab 100644 --- a/Source/Modules/s-exp.cxx +++ b/Source/Modules/s-exp.cxx @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * s-exp.cxx * diff --git a/Source/Modules/swigmain.cxx b/Source/Modules/swigmain.cxx index 5b103e71e..7cd913e2a 100644 --- a/Source/Modules/swigmain.cxx +++ b/Source/Modules/swigmain.cxx @@ -1,11 +1,15 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. - * - * Simplified Wrapper and Interface Generator (SWIG) + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * swigmain.cxx * + * Simplified Wrapper and Interface Generator (SWIG) + * * This file is the main entry point to SWIG. It collects the command * line options, registers built-in language modules, and instantiates * a module for code generation. If adding new language modules diff --git a/Source/Modules/swigmod.h b/Source/Modules/swigmod.h index 03892e4f6..5dc6fd390 100644 --- a/Source/Modules/swigmod.h +++ b/Source/Modules/swigmod.h @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * swigmod.h * diff --git a/Source/Modules/tcl8.cxx b/Source/Modules/tcl8.cxx index 09bd266c3..7a86108bb 100644 --- a/Source/Modules/tcl8.cxx +++ b/Source/Modules/tcl8.cxx @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * tcl8.cxx * diff --git a/Source/Modules/typepass.cxx b/Source/Modules/typepass.cxx index d663aed6e..e972cea05 100644 --- a/Source/Modules/typepass.cxx +++ b/Source/Modules/typepass.cxx @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * typepass.cxx * diff --git a/Source/Modules/uffi.cxx b/Source/Modules/uffi.cxx index 5d4affb8c..c35ca2666 100644 --- a/Source/Modules/uffi.cxx +++ b/Source/Modules/uffi.cxx @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * uffi.cxx * diff --git a/Source/Modules/utils.cxx b/Source/Modules/utils.cxx index bf8211903..3fe7a2709 100644 --- a/Source/Modules/utils.cxx +++ b/Source/Modules/utils.cxx @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * utils.cxx * diff --git a/Source/Modules/xml.cxx b/Source/Modules/xml.cxx index c74b48d7c..bd595d526 100644 --- a/Source/Modules/xml.cxx +++ b/Source/Modules/xml.cxx @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * xml.cxx * diff --git a/Source/Preprocessor/cpp.c b/Source/Preprocessor/cpp.c index c04f95f00..1e05af6ef 100644 --- a/Source/Preprocessor/cpp.c +++ b/Source/Preprocessor/cpp.c @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * cpp.c * diff --git a/Source/Preprocessor/expr.c b/Source/Preprocessor/expr.c index 4da24a774..3e3f39480 100644 --- a/Source/Preprocessor/expr.c +++ b/Source/Preprocessor/expr.c @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * expr.c * diff --git a/Source/Preprocessor/preprocessor.h b/Source/Preprocessor/preprocessor.h index 4f7ff8804..199e5ae3c 100644 --- a/Source/Preprocessor/preprocessor.h +++ b/Source/Preprocessor/preprocessor.h @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * preprocessor.h * diff --git a/Source/Swig/cwrap.c b/Source/Swig/cwrap.c index 18920ecc2..714613d81 100644 --- a/Source/Swig/cwrap.c +++ b/Source/Swig/cwrap.c @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * cwrap.c * diff --git a/Source/Swig/deprecate.c b/Source/Swig/deprecate.c index 475d2c6cf..f25b9a650 100644 --- a/Source/Swig/deprecate.c +++ b/Source/Swig/deprecate.c @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * deprecate.c * diff --git a/Source/Swig/error.c b/Source/Swig/error.c index 1eaba1f17..0ce53dd5b 100644 --- a/Source/Swig/error.c +++ b/Source/Swig/error.c @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * error.c * diff --git a/Source/Swig/fragment.c b/Source/Swig/fragment.c index 510a01875..896461b30 100644 --- a/Source/Swig/fragment.c +++ b/Source/Swig/fragment.c @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * fragment.c * diff --git a/Source/Swig/getopt.c b/Source/Swig/getopt.c index 87b0f7c9d..b8389b476 100644 --- a/Source/Swig/getopt.c +++ b/Source/Swig/getopt.c @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * getopt.c * diff --git a/Source/Swig/include.c b/Source/Swig/include.c index 3f47be15b..79b97b4d6 100644 --- a/Source/Swig/include.c +++ b/Source/Swig/include.c @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * include.c * diff --git a/Source/Swig/misc.c b/Source/Swig/misc.c index a9c64011e..03dc28d2a 100644 --- a/Source/Swig/misc.c +++ b/Source/Swig/misc.c @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * misc.c * diff --git a/Source/Swig/naming.c b/Source/Swig/naming.c index f34a24612..31cf116dc 100644 --- a/Source/Swig/naming.c +++ b/Source/Swig/naming.c @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * naming.c * diff --git a/Source/Swig/parms.c b/Source/Swig/parms.c index baa1dfbf3..267852cf0 100644 --- a/Source/Swig/parms.c +++ b/Source/Swig/parms.c @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * parms.c * diff --git a/Source/Swig/scanner.c b/Source/Swig/scanner.c index 06e78db37..a082036a5 100644 --- a/Source/Swig/scanner.c +++ b/Source/Swig/scanner.c @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * scanner.c * diff --git a/Source/Swig/stype.c b/Source/Swig/stype.c index 5ffd28eec..30a80b4bd 100644 --- a/Source/Swig/stype.c +++ b/Source/Swig/stype.c @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * stype.c * diff --git a/Source/Swig/swig.h b/Source/Swig/swig.h index 3f736bbd5..9501eaa55 100644 --- a/Source/Swig/swig.h +++ b/Source/Swig/swig.h @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * swig.h * diff --git a/Source/Swig/swigfile.h b/Source/Swig/swigfile.h index c945fb1ac..4f6869109 100644 --- a/Source/Swig/swigfile.h +++ b/Source/Swig/swigfile.h @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * swigfile.h * diff --git a/Source/Swig/swigopt.h b/Source/Swig/swigopt.h index 428d90dce..433ca07e5 100644 --- a/Source/Swig/swigopt.h +++ b/Source/Swig/swigopt.h @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * swigopt.h * diff --git a/Source/Swig/swigparm.h b/Source/Swig/swigparm.h index 529438bae..6ea849424 100644 --- a/Source/Swig/swigparm.h +++ b/Source/Swig/swigparm.h @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * swigparm.h * diff --git a/Source/Swig/swigscan.h b/Source/Swig/swigscan.h index 2486286a9..31b0c2705 100644 --- a/Source/Swig/swigscan.h +++ b/Source/Swig/swigscan.h @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * swigscan.h * diff --git a/Source/Swig/swigtree.h b/Source/Swig/swigtree.h index 2e5c4da36..d4221207c 100644 --- a/Source/Swig/swigtree.h +++ b/Source/Swig/swigtree.h @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * swigtree.h * diff --git a/Source/Swig/swigwrap.h b/Source/Swig/swigwrap.h index 25eeb6f7f..bd1009d0e 100644 --- a/Source/Swig/swigwrap.h +++ b/Source/Swig/swigwrap.h @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * swigwrap.h * diff --git a/Source/Swig/symbol.c b/Source/Swig/symbol.c index c9691fa54..3d6eb508b 100644 --- a/Source/Swig/symbol.c +++ b/Source/Swig/symbol.c @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * symbol.c * diff --git a/Source/Swig/tree.c b/Source/Swig/tree.c index 61dca8353..b6cbca352 100644 --- a/Source/Swig/tree.c +++ b/Source/Swig/tree.c @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * tree.c * diff --git a/Source/Swig/typemap.c b/Source/Swig/typemap.c index 6cbeb67ea..5ee74b629 100644 --- a/Source/Swig/typemap.c +++ b/Source/Swig/typemap.c @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * typemap.c * diff --git a/Source/Swig/typeobj.c b/Source/Swig/typeobj.c index 18d1b2304..2732e2fd5 100644 --- a/Source/Swig/typeobj.c +++ b/Source/Swig/typeobj.c @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * typeobj.c * diff --git a/Source/Swig/typesys.c b/Source/Swig/typesys.c index a9e2898bd..90df2ebd1 100644 --- a/Source/Swig/typesys.c +++ b/Source/Swig/typesys.c @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * typesys.c * diff --git a/Source/Swig/wrapfunc.c b/Source/Swig/wrapfunc.c index 3778066ce..2e18474aa 100644 --- a/Source/Swig/wrapfunc.c +++ b/Source/Swig/wrapfunc.c @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * wrapfunc.c * diff --git a/configure.in b/configure.in index 8a09cd6f7..dada26c7f 100644 --- a/configure.in +++ b/configure.in @@ -2,7 +2,7 @@ dnl Process this file with autoconf to produce a configure script. dnl The macros which aren't shipped with the autotools are stored in the dnl Tools/config directory in .m4 files. -AC_INIT([swig],[1.3.37],[http://www.swig.org]) +AC_INIT([swig],[2.0.0],[http://www.swig.org]) AC_PREREQ(2.58) AC_CONFIG_SRCDIR([Source/Swig/swig.h]) AC_CONFIG_AUX_DIR([Tools/config]) @@ -2135,8 +2135,6 @@ AC_CONFIG_FILES([ \ Examples/Makefile \ Examples/guile/Makefile \ Examples/xml/Makefile \ - Examples/GIFPlot/Makefile \ - Examples/GIFPlot/Lib/Makefile \ Examples/test-suite/chicken/Makefile \ Examples/test-suite/csharp/Makefile \ Examples/test-suite/guile/Makefile \ From 02fbe37ae6147b64e21c153b45a9a09313668438 Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Sat, 6 Mar 2010 11:47:21 +0000 Subject: [PATCH 043/314] Add new GPL license headers to source files added in this branch git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2008-cherylfoil@11911 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Source/DoxygenTranslator/src/DoxygenEntity.cpp | 12 ++++++++---- Source/DoxygenTranslator/src/DoxygenEntity.h | 10 +++++++--- Source/DoxygenTranslator/src/DoxygenParser.cpp | 11 +++++++++++ Source/DoxygenTranslator/src/DoxygenParser.h | 11 +++++++++++ .../DoxygenTranslator/src/DoxygenTranslator.cpp | 10 +++++++--- Source/DoxygenTranslator/src/DoxygenTranslator.h | 8 ++++++-- .../src/Examples/DoxygenTransWTokenizer.cpp | 16 +++++++++++++--- .../src/Examples/DoxygenTransWTokenizer.h | 11 +++++++++++ .../DoxygenTranslator/src/Examples/translator.h | 11 +++++++++++ .../DoxygenTranslator/src/JavaDocConverter.cpp | 11 +++++++++++ Source/DoxygenTranslator/src/JavaDocConverter.h | 8 ++++++-- Source/DoxygenTranslator/src/PyDocConverter.cpp | 10 +++++++--- Source/DoxygenTranslator/src/PyDocConverter.h | 8 ++++++-- Source/DoxygenTranslator/src/Token.cpp | 11 +++++++++++ Source/DoxygenTranslator/src/Token.h | 11 +++++++++++ Source/DoxygenTranslator/src/TokenList.cpp | 11 +++++++++++ Source/DoxygenTranslator/src/TokenList.h | 11 +++++++++++ Source/Swig/warn.c | 8 ++++++-- 18 files changed, 165 insertions(+), 24 deletions(-) diff --git a/Source/DoxygenTranslator/src/DoxygenEntity.cpp b/Source/DoxygenTranslator/src/DoxygenEntity.cpp index f770dc514..dc49c803e 100644 --- a/Source/DoxygenTranslator/src/DoxygenEntity.cpp +++ b/Source/DoxygenTranslator/src/DoxygenEntity.cpp @@ -1,8 +1,12 @@ -/* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. +/* ----------------------------------------------------------------------------- + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * - * python.cxx + * DoxygenEntity.cpp * * Part of the Doxygen comment translation module of SWIG. * ----------------------------------------------------------------------------- */ diff --git a/Source/DoxygenTranslator/src/DoxygenEntity.h b/Source/DoxygenTranslator/src/DoxygenEntity.h index ca42393db..dcdba7644 100644 --- a/Source/DoxygenTranslator/src/DoxygenEntity.h +++ b/Source/DoxygenTranslator/src/DoxygenEntity.h @@ -1,8 +1,12 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * - * python.cxx + * DoxygenEntity.h * * Part of the Doxygen comment translation module of SWIG. * ----------------------------------------------------------------------------- */ diff --git a/Source/DoxygenTranslator/src/DoxygenParser.cpp b/Source/DoxygenTranslator/src/DoxygenParser.cpp index f4bce5445..030d8bee9 100644 --- a/Source/DoxygenTranslator/src/DoxygenParser.cpp +++ b/Source/DoxygenTranslator/src/DoxygenParser.cpp @@ -1,3 +1,14 @@ +/* ----------------------------------------------------------------------------- + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. + * + * DoxygenParser.cpp + * ----------------------------------------------------------------------------- */ + #include "DoxygenParser.h" #include "TokenList.h" diff --git a/Source/DoxygenTranslator/src/DoxygenParser.h b/Source/DoxygenTranslator/src/DoxygenParser.h index c298a92f3..0c1f2d1cb 100644 --- a/Source/DoxygenTranslator/src/DoxygenParser.h +++ b/Source/DoxygenTranslator/src/DoxygenParser.h @@ -1,3 +1,14 @@ +/* ----------------------------------------------------------------------------- + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. + * + * DoxygenParser.h + * ----------------------------------------------------------------------------- */ + #ifndef DOXYGENPARSER_H_ #define DOXYGENPARSER_H_ #include diff --git a/Source/DoxygenTranslator/src/DoxygenTranslator.cpp b/Source/DoxygenTranslator/src/DoxygenTranslator.cpp index 6fe97d298..36ca95579 100644 --- a/Source/DoxygenTranslator/src/DoxygenTranslator.cpp +++ b/Source/DoxygenTranslator/src/DoxygenTranslator.cpp @@ -1,6 +1,10 @@ -/* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. +/* ----------------------------------------------------------------------------- + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * DoxygenTranslator.cpp * diff --git a/Source/DoxygenTranslator/src/DoxygenTranslator.h b/Source/DoxygenTranslator/src/DoxygenTranslator.h index 566b1551d..1a14a4db2 100644 --- a/Source/DoxygenTranslator/src/DoxygenTranslator.h +++ b/Source/DoxygenTranslator/src/DoxygenTranslator.h @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * DoxygenTranslator.h * diff --git a/Source/DoxygenTranslator/src/Examples/DoxygenTransWTokenizer.cpp b/Source/DoxygenTranslator/src/Examples/DoxygenTransWTokenizer.cpp index 930141c97..dd803b75f 100644 --- a/Source/DoxygenTranslator/src/Examples/DoxygenTransWTokenizer.cpp +++ b/Source/DoxygenTranslator/src/Examples/DoxygenTransWTokenizer.cpp @@ -1,6 +1,16 @@ -/* The main class for translating blobs of Doxygen for SWIG - * by Cheryl Foil, mentor Olly Betts, for Google's Summer of Code Program - */ +/* ----------------------------------------------------------------------------- + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. + * + * DoxygenTransWTokenizer.cpp + * + * The main class for translating blobs of Doxygen for SWIG + * ----------------------------------------------------------------------------- */ + //TODO DOH instead of STL? //TODO Most commands are not fully implemented diff --git a/Source/DoxygenTranslator/src/Examples/DoxygenTransWTokenizer.h b/Source/DoxygenTranslator/src/Examples/DoxygenTransWTokenizer.h index fb3181d25..8a51b4d02 100644 --- a/Source/DoxygenTranslator/src/Examples/DoxygenTransWTokenizer.h +++ b/Source/DoxygenTranslator/src/Examples/DoxygenTransWTokenizer.h @@ -1,3 +1,14 @@ +/* ----------------------------------------------------------------------------- + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. + * + * DoxygenTransWTokenizer.h + * ----------------------------------------------------------------------------- */ + #ifndef DOXYGENTRANSWTOKENIZER_H_ #define DOXYGENTRANSWTOKENIZER_H_ diff --git a/Source/DoxygenTranslator/src/Examples/translator.h b/Source/DoxygenTranslator/src/Examples/translator.h index 0ae58f714..f9da98180 100644 --- a/Source/DoxygenTranslator/src/Examples/translator.h +++ b/Source/DoxygenTranslator/src/Examples/translator.h @@ -1,3 +1,14 @@ +/* ----------------------------------------------------------------------------- + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. + * + * translator.h + * ----------------------------------------------------------------------------- */ + #ifndef TRANSLATOR_H_ #define TRANSLATOR_H_ diff --git a/Source/DoxygenTranslator/src/JavaDocConverter.cpp b/Source/DoxygenTranslator/src/JavaDocConverter.cpp index 9de2f99f3..8cca8b3a5 100644 --- a/Source/DoxygenTranslator/src/JavaDocConverter.cpp +++ b/Source/DoxygenTranslator/src/JavaDocConverter.cpp @@ -1,3 +1,14 @@ +/* ----------------------------------------------------------------------------- + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. + * + * JavaDocConverter.cpp + * ----------------------------------------------------------------------------- */ + #include "JavaDocConverter.h" #include "DoxygenParser.h" #include diff --git a/Source/DoxygenTranslator/src/JavaDocConverter.h b/Source/DoxygenTranslator/src/JavaDocConverter.h index d898265ba..69fc8d75d 100644 --- a/Source/DoxygenTranslator/src/JavaDocConverter.h +++ b/Source/DoxygenTranslator/src/JavaDocConverter.h @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * JavaDocConverter.h * diff --git a/Source/DoxygenTranslator/src/PyDocConverter.cpp b/Source/DoxygenTranslator/src/PyDocConverter.cpp index cbe81571b..3b305b9fd 100644 --- a/Source/DoxygenTranslator/src/PyDocConverter.cpp +++ b/Source/DoxygenTranslator/src/PyDocConverter.cpp @@ -1,6 +1,10 @@ -/* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. +/* ----------------------------------------------------------------------------- + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * PyDocConverter.cpp * diff --git a/Source/DoxygenTranslator/src/PyDocConverter.h b/Source/DoxygenTranslator/src/PyDocConverter.h index 5680480fc..ecd033af5 100644 --- a/Source/DoxygenTranslator/src/PyDocConverter.h +++ b/Source/DoxygenTranslator/src/PyDocConverter.h @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * PyDocConverter.h * diff --git a/Source/DoxygenTranslator/src/Token.cpp b/Source/DoxygenTranslator/src/Token.cpp index f7c02b021..6ade97163 100644 --- a/Source/DoxygenTranslator/src/Token.cpp +++ b/Source/DoxygenTranslator/src/Token.cpp @@ -1,3 +1,14 @@ +/* ----------------------------------------------------------------------------- + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. + * + * Token.cpp + * ----------------------------------------------------------------------------- */ + #include "Token.h" #include "DoxygenEntity.h" using namespace std; diff --git a/Source/DoxygenTranslator/src/Token.h b/Source/DoxygenTranslator/src/Token.h index 4ae44b65f..6e10fd338 100644 --- a/Source/DoxygenTranslator/src/Token.h +++ b/Source/DoxygenTranslator/src/Token.h @@ -1,3 +1,14 @@ +/* ----------------------------------------------------------------------------- + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. + * + * Token.h + * ----------------------------------------------------------------------------- */ + #ifndef TOKEN_H_ #define TOKEN_H_ #include diff --git a/Source/DoxygenTranslator/src/TokenList.cpp b/Source/DoxygenTranslator/src/TokenList.cpp index 8eeef97b2..5e13fe164 100644 --- a/Source/DoxygenTranslator/src/TokenList.cpp +++ b/Source/DoxygenTranslator/src/TokenList.cpp @@ -1,3 +1,14 @@ +/* ----------------------------------------------------------------------------- + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. + * + * TokenList.cpp + * ----------------------------------------------------------------------------- */ + #include "TokenList.h" #include #include diff --git a/Source/DoxygenTranslator/src/TokenList.h b/Source/DoxygenTranslator/src/TokenList.h index 841d66e1a..057f67ed4 100644 --- a/Source/DoxygenTranslator/src/TokenList.h +++ b/Source/DoxygenTranslator/src/TokenList.h @@ -1,3 +1,14 @@ +/* ----------------------------------------------------------------------------- + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. + * + * TokenList.h + * ----------------------------------------------------------------------------- */ + #ifndef TOKENLIST_H_ #define TOKENLIST_H_ #include diff --git a/Source/Swig/warn.c b/Source/Swig/warn.c index a8dadc70b..b01815354 100644 --- a/Source/Swig/warn.c +++ b/Source/Swig/warn.c @@ -1,6 +1,10 @@ /* ----------------------------------------------------------------------------- - * See the LICENSE file for information on copyright, usage and redistribution - * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. * * warn.c * From d590621eae215b6be8eb11d22dd59e74b69b3f38 Mon Sep 17 00:00:00 2001 From: Dmitry Kabak Date: Tue, 8 May 2012 19:48:49 +0000 Subject: [PATCH 044/314] Added myself to the COPYRIGHT git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2012-doxygen@13050 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- COPYRIGHT | 1 + 1 file changed, 1 insertion(+) diff --git a/COPYRIGHT b/COPYRIGHT index 2fe0099b8..dc61d89b4 100644 --- a/COPYRIGHT +++ b/COPYRIGHT @@ -19,6 +19,7 @@ Active SWIG Developers: Past SWIG developers and major contributors include: Dave Beazley (dave-swig@dabeaz.com) (SWIG core, Python, Tcl, Perl) + Dmitry Kabak (userdima@gmail.com) (Doxygen) Henning Thielemann (swig@henning-thielemann.de) (Modula3) Matthias Köppe (mkoeppe@mail.math.uni-magdeburg.de) (Guile, MzScheme) Luigi Ballabio (luigi.ballabio@fastwebnet.it) (STL wrapping) From ce39e74f28286e104ae0caff9d78d2cafb11e369 Mon Sep 17 00:00:00 2001 From: Dmitry Kabak Date: Mon, 28 May 2012 19:47:03 +0000 Subject: [PATCH 045/314] Applied Christopher Mangiardi's patch that fixes incorrect comment placement in python single line functions git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2012-doxygen@13133 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Source/Modules/python.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Source/Modules/python.cxx b/Source/Modules/python.cxx index d3d652eb0..c47f695aa 100644 --- a/Source/Modules/python.cxx +++ b/Source/Modules/python.cxx @@ -3979,7 +3979,7 @@ public: if (!have_addtofunc(n)) { if (!fastproxy || olddefs) { Printv(f_shadow, tab4, "def ", symname, "(", parms, ")", returnTypeAnnotation(n), ":", NIL); - Printv(f_shadow, " return ", funcCall(fullname, callParms), "\n", NIL); + Printv(f_shadow, "\n", NIL); if (doxygen) { String *doxygen_comments; if (DoxygenTranslator::getDocumentation(n, PyDoc, doxygen_comments)) { @@ -3987,6 +3987,7 @@ public: Delete(doxygen_comments); } } + Printv(f_shadow, tab8, "return ", funcCall(fullname, callParms), "\n", NIL); } } else { Printv(f_shadow, tab4, "def ", symname, "(", parms, ")", returnTypeAnnotation(n), ":", NIL); From 744d59c9d000444606cf043947bf829d100f802f Mon Sep 17 00:00:00 2001 From: Dmitry Kabak Date: Sun, 3 Jun 2012 16:40:31 +0000 Subject: [PATCH 046/314] Small documentation fix in Doxygen.html git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2012-doxygen@13141 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Doc/Manual/Doxygen.html | 44 +++++++++++++++++++++++++++++++++++++---- 1 file changed, 40 insertions(+), 4 deletions(-) diff --git a/Doc/Manual/Doxygen.html b/Doc/Manual/Doxygen.html index 54161eeb3..989fb0dc4 100644 --- a/Doc/Manual/Doxygen.html +++ b/Doc/Manual/Doxygen.html @@ -36,7 +36,7 @@

    This chapter describes SWIG's support for translating Doxygen comments found in interface and header files into a target language's normal documentation language. -Currently only JavaDoc is supported. +Currently only JavaDoc and PythonDoc is supported.

    35.1 Doxygen Translation Overview

    @@ -45,11 +45,11 @@ Currently only JavaDoc is supported.

    The Doxygen Translation Module of SWIG is an ongoing effort from a Google Summer of Code proposal from Summer 2008. It adds an extra layer of functionality to SWIG, allowing automated translation of Doxygen formatted comments from input files into a documentation language more suited for the target language. -Currently this module only translates into JavaDoc for the SWIG Java Module, but other extensions are to be added in time. +Currently this module only translates into JavaDoc and PythonDoc for the SWIG Java and Python Modules, but other extensions are to be added in time.

    -Questions about running SWIG are best answered in the SWIG Basics chapter as well as the target language modules. (For now, only Java). +Questions about running SWIG are best answered in the SWIG Basics chapter as well as the target language modules. (For now, only Java and Python). The behaviour of this functionality is wildly unpredictable if the interface file is not proper to begin with!

    @@ -72,7 +72,43 @@ class Shape {

    -Because this functionality is currently only extended to Java, you must be able to run SWIG's Java Module in order to make use of this tool. +Please note, as SWIG parses input file by itself with strict grammar, there is only a limited support for various cases of comment placement in the file. +Comments can be placed between two C expressions on separate lines: +

    + +
    +void someOtherFunction();
    +/**
    + * Some comment
    + */
    +void someFunction();
    +
    + +

    +and in some special cases, like function parameter comments: +

    + +
    +void someFunction(
    +         int a ///< Some parameter 
    +     );
    +
    + +

    +or enum element comments: +

    + +
    +enum E_NUMBERS
    +{
    +    EN_ZERO, ///< The first enum item, gets zero as it's value
    +    EN_ONE, ///< The second, EN_ONE=1
    +    EN_THREE
    +};
    +
    + +

    +Just remember, if SWIG shows syntax error parsing the file because of your comment, try to move it in some other, 'safer' place as desribed above.

    35.2.1 Enabling Doxygen Translation

    From ac6b51f13e02dc137f639c6465d227eee7442e08 Mon Sep 17 00:00:00 2001 From: Dmitry Kabak Date: Mon, 4 Jun 2012 18:02:51 +0000 Subject: [PATCH 047/314] Fix to include comment for non-member functions in python git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2012-doxygen@13149 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Source/Modules/python.cxx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Source/Modules/python.cxx b/Source/Modules/python.cxx index c47f695aa..f0f6d0671 100644 --- a/Source/Modules/python.cxx +++ b/Source/Modules/python.cxx @@ -1780,6 +1780,13 @@ public: String *callParms = make_pyParmList(n, false, true, kw); /* Make a wrapper function to insert the code into */ Printv(f_dest, "\ndef ", name, "(", parms, ")", returnTypeAnnotation(n), ":\n", NIL); + if (doxygen) { + String *doxygen_comments; + if (DoxygenTranslator::getDocumentation(n, PyDoc, doxygen_comments)) { + Printf(f_dest, Char(pythoncode(doxygen_comments, tab2))); + Delete(doxygen_comments); + } + } if (have_docstring(n)) Printv(f_dest, " ", docstring(n, AUTODOC_FUNC, tab4), "\n", NIL); if (have_pythonprepend(n)) From e3f41f32a6096f8f8273fb4ba4ca610050f16961 Mon Sep 17 00:00:00 2001 From: Dmitry Kabak Date: Mon, 4 Jun 2012 18:11:29 +0000 Subject: [PATCH 048/314] Added test case to check Doxygen comments parsing, including java and python runtime tests git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2012-doxygen@13150 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Examples/test-suite/common.mk | 1 + Examples/test-suite/doxygen_parsing.i | 84 +++++++++++++++++ Examples/test-suite/java/Makefile.in | 4 +- .../java/doxygen_parsing_runme.java | 89 +++++++++++++++++++ .../python/doxygen_parsing_runme.py | 19 ++++ 5 files changed, 195 insertions(+), 2 deletions(-) create mode 100644 Examples/test-suite/doxygen_parsing.i create mode 100644 Examples/test-suite/java/doxygen_parsing_runme.java create mode 100644 Examples/test-suite/python/doxygen_parsing_runme.py diff --git a/Examples/test-suite/common.mk b/Examples/test-suite/common.mk index 7cc410e7a..ec47ffaa0 100644 --- a/Examples/test-suite/common.mk +++ b/Examples/test-suite/common.mk @@ -187,6 +187,7 @@ CPP_TEST_CASES += \ director_using \ director_wombat \ disown \ + doxygen_parsing \ dynamic_cast \ empty \ enum_rename \ diff --git a/Examples/test-suite/doxygen_parsing.i b/Examples/test-suite/doxygen_parsing.i new file mode 100644 index 000000000..20781cfa8 --- /dev/null +++ b/Examples/test-suite/doxygen_parsing.i @@ -0,0 +1,84 @@ +%module doxygen_parsing + +%inline %{ + +/** + * This is simple comment for a var + */ +int simpleVar=42; +/*! + * This is another type of comment for a var + */ +int simpleVarTwo=42; + +/// This is again another type of comment for a var +int simpleVarThree=42; +//! This is the last type of comment for a var +int simpleVarFour=42; + +/* + We assume that all this comment types are ok, + and later we only use the first-type comments. +*/ + + +/** + * This is simple comment for a function + */ +void simpleFunction(int arg) +{ +} + +/** + * This is simple comment for a class + */ +class CSimpleClass +{ +private: + /** Some member var */ + int simpleVar; + +public: + /** + * Simple method + */ + void simpleMethod(int asd) + { + } + /** + * Simple method with parameter + */ + void simpleMethodWithParameter( + int param /**< Some test param */ + ) + { + } +}; + +/** Test enumeration */ +enum E_TEST +{ + /** the first item */ + E_TEST_ONE, + E_TEST_TWO = 2, /**< the second */ + E_TEST_THREE = 2+1 +}; + +/** + * Comment for template class + */ +template +class CTemplateClass +{ +public: + /** + * Template method + */ + void templateMethod(T arg) + { + } +}; + +%} + +%template(CTemplateClassInt) CTemplateClass; \ No newline at end of file diff --git a/Examples/test-suite/java/Makefile.in b/Examples/test-suite/java/Makefile.in index ef3c981a4..813232620 100644 --- a/Examples/test-suite/java/Makefile.in +++ b/Examples/test-suite/java/Makefile.in @@ -79,8 +79,8 @@ setup = \ run_testcase = \ cd $(JAVA_PACKAGE) && $(COMPILETOOL) $(JAVAC) -classpath . `find . -name "*.java"` && cd .. && \ if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \ - $(COMPILETOOL) $(JAVAC) -classpath . -d . $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) && \ - env LD_LIBRARY_PATH="$(JAVA_PACKAGE):$$LD_LIBRARY_PATH" PATH="$(JAVA_PACKAGE):$$PATH" SHLIB_PATH="$(JAVA_PACKAGE):$$SHLIB_PATH" DYLD_LIBRARY_PATH="$(JAVA_PACKAGE):$$DYLD_LIBRARY_PATH" $(RUNTOOL) $(JAVA) $(JAVAFLAGS) -classpath . $*_runme; \ + $(COMPILETOOL) $(JAVAC) -classpath $(JAVA_HOME)/lib/tools.jar:. -d . $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) && \ + env LD_LIBRARY_PATH="$(JAVA_PACKAGE):$$LD_LIBRARY_PATH" PATH="$(JAVA_PACKAGE):$$PATH" SHLIB_PATH="$(JAVA_PACKAGE):$$SHLIB_PATH" DYLD_LIBRARY_PATH="$(JAVA_PACKAGE):$$DYLD_LIBRARY_PATH" $(RUNTOOL) $(JAVA) $(JAVAFLAGS) -classpath $(JAVA_HOME)/lib/tools.jar:. $*_runme; \ fi # Clean: remove testcase directories diff --git a/Examples/test-suite/java/doxygen_parsing_runme.java b/Examples/test-suite/java/doxygen_parsing_runme.java new file mode 100644 index 000000000..c4264d003 --- /dev/null +++ b/Examples/test-suite/java/doxygen_parsing_runme.java @@ -0,0 +1,89 @@ + +import doxygen_parsing.*; +import com.sun.javadoc.*; +import java.util.HashMap; +import java.util.Map.Entry; +import java.util.Iterator; + +public class doxygen_parsing_runme { + static { + try { + System.loadLibrary("doxygen_parsing"); + } catch (UnsatisfiedLinkError e) { + System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e); + System.exit(1); + } + } + + static HashMap parsedComments = new HashMap(); + static HashMap wantedComments = new HashMap(); + + public static boolean start(RootDoc root) { + + /* + This method is called by 'javadoc' and gets the whole parsed + java file, we get comments and store them + */ + + ClassDoc[] classes = root.classes(); + + for (int i = 0; i < classes.length; i++) { + + if (classes[i].getRawCommentText().length() > 0) + parsedComments.put(classes[i].name(), classes[i].getRawCommentText()); + + MethodDoc[] methods = classes[i].methods(); + for (int j = 0; j < methods.length; j++) { + MethodDoc m = methods[j]; + if (m.getRawCommentText().length() > 0) + parsedComments.put(m.name(), m.getRawCommentText()); + } + } + return true; + } + + public static void main(String argv[]) + { + /* + Here we are using internal javadoc tool, it accepts the name of the class as paramterer, + and calls the start() method of that class with parsed information. + */ + com.sun.tools.javadoc.Main.execute("doxygen_parsing runtime test", + "doxygen_parsing_runme", new String[]{"-quiet", "doxygen_parsing"}); + + wantedComments.put("simpleFunction", " This is simple comment for a function \n"); + + wantedComments.put("CSimpleClass", " This is simple comment for a class \n"); + wantedComments.put("simpleMethod", " Simple method \n"); + wantedComments.put("simpleMethodWithParameter", " Simple method with parameter \n @param\tparam Some test param \n"); + wantedComments.put("CTemplateClassInt", " Comment for template class \n"); + wantedComments.put("templateMethod", " Template method \n"); + + wantedComments.put("setSimpleVar", " This is simple comment for a var \n"); + wantedComments.put("getSimpleVar", " This is simple comment for a var \n"); + wantedComments.put("setSimpleVarTwo", " This is another type of comment for a var \n"); + wantedComments.put("getSimpleVarTwo", " This is another type of comment for a var \n"); + wantedComments.put("setSimpleVarThree", " This is again another type of comment for a var \n"); + wantedComments.put("getSimpleVarThree", " This is again another type of comment for a var \n"); + wantedComments.put("setSimpleVarFour", " This is the last type of comment for a var \n"); + wantedComments.put("getSimpleVarFour", " This is the last type of comment for a var \n"); + + + int errorCount=0; + Iterator< Entry > it = parsedComments.entrySet().iterator(); + + while (it.hasNext()) + { + Entry e = (Entry) it.next(); + + if (!e.getValue().equals(wantedComments.get(e.getKey()))) { + System.out.println("Documentation comments for " + e.getKey() + " does not match: "); + System.out.println("\texpected:"+wantedComments.get(e.getKey())); + System.out.println("\tgot:\t"+e.getValue()); + errorCount++; + } + } + + System.exit(errorCount); + } +} diff --git a/Examples/test-suite/python/doxygen_parsing_runme.py b/Examples/test-suite/python/doxygen_parsing_runme.py new file mode 100644 index 000000000..eef840818 --- /dev/null +++ b/Examples/test-suite/python/doxygen_parsing_runme.py @@ -0,0 +1,19 @@ +#!/usr/bin/python + +import doxygen_parsing +import sys +import re + +def check(got, expected): + if not re.match(str(expected), str(got)): + raise RuntimeError("\n" + "Expected: [" + str(expected) + "]\n" + "Got : [" + str(got) + "]") + +check(doxygen_parsing.simpleFunction.__doc__, '\s+This is simple comment for a function\s+') +check(doxygen_parsing.CSimpleClass.__doc__, '\s+This is simple comment for a class\s+') +check(doxygen_parsing.CSimpleClass.simpleMethod.__doc__, '\s+Simple method\s+') +check(doxygen_parsing.CSimpleClass.simpleMethodWithParameter.__doc__, '' +'\s+Simple method with parameter' +'\s+Arguments:\s+param \(int\)\s+-- Some test param\s+' +) +check(doxygen_parsing.CTemplateClassInt.__doc__, '\s+Comment for template class\s+') +check(doxygen_parsing.CTemplateClassInt.templateMethod.__doc__, '\s+Template method\s+') \ No newline at end of file From b0f8e594c98d56abda1a461212466b72ace351e5 Mon Sep 17 00:00:00 2001 From: Dmitry Kabak Date: Mon, 18 Jun 2012 18:30:18 +0000 Subject: [PATCH 049/314] Implement toggling comment parsing feature on and off git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2012-doxygen@13182 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Source/CParse/cparse.h | 1 + Source/CParse/cscanner.c | 23 ++++++++++++++--------- Source/CParse/parser.y | 3 +-- 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/Source/CParse/cparse.h b/Source/CParse/cparse.h index 922bbfcdc..895118363 100644 --- a/Source/CParse/cparse.h +++ b/Source/CParse/cparse.h @@ -26,6 +26,7 @@ extern "C" { extern int cparse_line; extern int cparse_cplusplus; extern int cparse_start_line; + extern int scan_doxygen_comments; extern void Swig_cparse_cplusplus(int); extern void scanner_file(File *); diff --git a/Source/CParse/cscanner.c b/Source/CParse/cscanner.c index 66a570a95..44af1069b 100644 --- a/Source/CParse/cscanner.c +++ b/Source/CParse/cscanner.c @@ -46,6 +46,9 @@ static int last_brace = 0; static int last_id = 0; static int rename_active = 0; +/* Doxygen comments scanning */ +int scan_doxygen_comments = 1; + /* ----------------------------------------------------------------------------- * Swig_cparse_cplusplus() * ----------------------------------------------------------------------------- */ @@ -337,15 +340,17 @@ static int yylook(void) { if ((strncmp(loc,"/*@SWIG",7) == 0) && (loc[Len(cmt)-3] == '@')) { Scanner_locator(scan, cmt); } - if (strncmp(loc, "/**<", 4) == 0 || strncmp(loc, "///<", 4) == 0||strncmp(loc, "/*!<", 4) == 0||strncmp(loc, "//!<", 4) == 0) { - /* printf("Doxygen Post Comment: %s lines %d-%d [%s]\n", Char(Scanner_file(scan)), Scanner_start_line(scan), Scanner_line(scan), loc); */ - yylval.str = NewString(loc); - return DOXYGENPOSTSTRING; - } - if (strncmp(loc, "/**", 3) == 0 || strncmp(loc, "///", 3) == 0||strncmp(loc, "/*!", 3) == 0||strncmp(loc, "//!", 3) == 0) { - /* printf("Doxygen Comment: %s lines %d-%d [%s]\n", Char(Scanner_file(scan)), Scanner_start_line(scan), Scanner_line(scan), loc); */ - yylval.str = NewString(loc); - return DOXYGENSTRING; + if (scan_doxygen_comments) { /* else just skip this node, to avoid crashes in parser module*/ + if (strncmp(loc, "/**<", 4) == 0 || strncmp(loc, "///<", 4) == 0||strncmp(loc, "/*!<", 4) == 0||strncmp(loc, "//!<", 4) == 0) { + /* printf("Doxygen Post Comment: %s lines %d-%d [%s]\n", Char(Scanner_file(scan)), Scanner_start_line(scan), Scanner_line(scan), loc); */ + yylval.str = NewString(loc); + return DOXYGENPOSTSTRING; + } + if (strncmp(loc, "/**", 3) == 0 || strncmp(loc, "///", 3) == 0||strncmp(loc, "/*!", 3) == 0||strncmp(loc, "//!", 3) == 0) { + /* printf("Doxygen Comment: %s lines %d-%d [%s]\n", Char(Scanner_file(scan)), Scanner_start_line(scan), Scanner_line(scan), loc); */ + yylval.str = NewString(loc); + return DOXYGENSTRING; + } } } break; diff --git a/Source/CParse/parser.y b/Source/CParse/parser.y index 39028cfe7..ffba04884 100644 --- a/Source/CParse/parser.y +++ b/Source/CParse/parser.y @@ -63,7 +63,6 @@ static Node **class_decl = NULL; /* ----------------------------------------------------------------------------- * Doxygen Comment Globals and Assist Functions * ----------------------------------------------------------------------------- */ -int parseComments = 1; /* set this to activate Doxygen uptake into the parse tree */ String *currentComment; /* Location of the stored Doxygen Comment */ String *currentPostComment; /* Location of the stored Doxygen Post-Comment */ String *currentCComment; /* Location of the stored C Comment */ @@ -107,7 +106,7 @@ static Node *new_node(const_String_or_char_ptr tag) { set_nodeType(n,tag); Setfile(n,cparse_file); Setline(n,cparse_line); - if(parseComments){ + if(scan_doxygen_comments){ /* Sets any post comments to the previous node */ if(previousNode != NULL && currentPostComment != 0){ String *copyPostComment = Copy(currentPostComment); From 72b23954fb58b89083045ae562420dcd59472c44 Mon Sep 17 00:00:00 2001 From: Dmitry Kabak Date: Mon, 18 Jun 2012 18:33:30 +0000 Subject: [PATCH 050/314] Fix integration of doxygen with autodoc feature, fixed autodoc test and some code refactored git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2012-doxygen@13183 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Examples/test-suite/python/autodoc_runme.py | 6 +- .../DoxygenTranslator/src/PyDocConverter.cpp | 2 +- Source/Modules/python.cxx | 67 ++++++++----------- 3 files changed, 32 insertions(+), 43 deletions(-) diff --git a/Examples/test-suite/python/autodoc_runme.py b/Examples/test-suite/python/autodoc_runme.py index dc843ae96..b0359f2e0 100644 --- a/Examples/test-suite/python/autodoc_runme.py +++ b/Examples/test-suite/python/autodoc_runme.py @@ -165,9 +165,9 @@ check(F.__init__.__doc__, "\n" check(B.funk.__doc__, "funk(B self, int c, int d) -> int") check(funk.__doc__, "funk(A e, short arg2, int c, int d) -> int") check(funkdefaults.__doc__, "\n" -" funkdefaults(A e, short arg2, int c, int d, double f=2) -> int\n" -" funkdefaults(A e, short arg2, int c, int d) -> int\n" -" " +" funkdefaults(A e, short arg2, int c, int d, double f=2) -> int\n" +" funkdefaults(A e, short arg2, int c, int d) -> int\n" +" " ) check(func_input.__doc__, "func_input(int * INPUT) -> int") diff --git a/Source/DoxygenTranslator/src/PyDocConverter.cpp b/Source/DoxygenTranslator/src/PyDocConverter.cpp index 3b305b9fd..55c3ba61b 100644 --- a/Source/DoxygenTranslator/src/PyDocConverter.cpp +++ b/Source/DoxygenTranslator/src/PyDocConverter.cpp @@ -193,7 +193,7 @@ bool PyDocConverter::getDocumentation(Node *n, String *&documentation) { // if we got something log the result and construct DOH string to return if (pyDocString.length()) { - result = "\"\"\"\n" + pyDocString + "\"\"\"\n"; + result = pyDocString; if (debug) { std::cout << "\n---RESULT IN PYDOC---" << std::endl; diff --git a/Source/Modules/python.cxx b/Source/Modules/python.cxx index f0f6d0671..07437715d 100644 --- a/Source/Modules/python.cxx +++ b/Source/Modules/python.cxx @@ -21,6 +21,7 @@ static int treduce = SWIG_cparse_template_reduce(0); #include #include #include "../DoxygenTranslator/src/DoxygenTranslator.h" +#include "../../../swig/bug.h" #define PYSHADOW_MEMBER 0x2 #define WARN_PYTHON_MULTIPLE_INH 405 @@ -120,7 +121,7 @@ Python Options (available with -python)\n\ -classptr - Generate shadow 'ClassPtr' as in older swig versions\n\ -cppcast - Enable C++ casting operators (default) \n\ -dirvtable - Generate a pseudo virtual table for directors for faster dispatch \n\ - -doxygen - Convert C++ doxygen comments to pydoc comments in proxy classes \n\ + -doxygen - Convert C++ doxygen comments to pydoc comments in proxy classes (default) \n\ -extranative - Return extra native C++ wraps for std containers when possible \n\ -fastinit - Use fast init mechanism for classes (default)\n\ -fastunpack - Use fast unpack mechanism to parse the argument functions \n\ @@ -139,6 +140,7 @@ static const char *usage2 = (char *) "\ -nocastmode - Disable the casting mode (default)\n\ -nocppcast - Disable C++ casting operators, useful for generating bugs\n\ -nodirvtable - Don't use the virtual table feature, resolve the python method each time (default)\n\ + -nodoxygen - Don't convert C++ doxygen comments to pydoc comments in proxy classes \n\ -noexcept - No automatic exception handling\n\ -noextranative - Don't use extra native C++ wraps for std containers when possible (default) \n\ -nofastinit - Use traditional init mechanism for classes \n\ @@ -418,12 +420,17 @@ public: } else if (strcmp(argv[i], "-dirvtable") == 0) { dirvtable = 1; Swig_mark_arg(i); - } else if (strcmp(argv[i], "-doxygen") == 0) { - doxygen = 1; - Swig_mark_arg(i); } else if (strcmp(argv[i], "-nodirvtable") == 0) { dirvtable = 0; Swig_mark_arg(i); + } else if (strcmp(argv[i], "-doxygen") == 0) { + doxygen = 1; + scan_doxygen_comments = 1; + Swig_mark_arg(i); + } else if (strcmp(argv[i], "-nodoxygen") == 0) { + doxygen = 0; + scan_doxygen_comments = 0; + Swig_mark_arg(i); } else if (strcmp(argv[i], "-fastunpack") == 0) { fastunpack = 1; Swig_mark_arg(i); @@ -1194,7 +1201,10 @@ public: bool have_docstring(Node *n) { String *str = Getattr(n, "feature:docstring"); - return (str && Len(str) > 0) || (Getattr(n, "feature:autodoc") && !GetFlag(n, "feature:noautodoc")); + return ((str && Len(str) > 0) + || (Getattr(n, "feature:autodoc") && !GetFlag(n, "feature:noautodoc")) + || (doxygen && Getattr(n, "DoxygenComment")) + ); } /* ------------------------------------------------------------ @@ -1206,8 +1216,10 @@ public: String *docstring(Node *n, autodoc_t ad_type, const String *indent, bool use_triple = true) { String *str = Getattr(n, "feature:docstring"); + String *doxygen_comment = 0; bool have_ds = (str && Len(str) > 0); bool have_auto = (Getattr(n, "feature:autodoc") && !GetFlag(n, "feature:noautodoc")); + bool have_doxygen = doxygen && DoxygenTranslator::getDocumentation(n, PyDoc, doxygen_comment); const char *triple_double = use_triple ? "\"\"\"" : ""; String *autodoc = NULL; String *doc = NULL; @@ -1224,6 +1236,9 @@ public: autodoc = make_autodoc(n, ad_type); have_auto = (autodoc && Len(autodoc) > 0); } + if (have_doxygen) { + have_doxygen = (doxygen_comment && Len(doxygen_comment) > 0); + } // If there is more than one line then make docstrings like this: // // """ @@ -1250,7 +1265,11 @@ public: doc = NewString(""); Printv(doc, triple_double, "\n", pythoncode(autodoc, indent), indent, triple_double, NIL); } - } else + } else if (have_doxygen) { // the lowest priority + doc = NewString(""); + Printv(doc, triple_double, "\n", pythoncode(doxygen_comment, indent), indent, triple_double, NIL); + } + else doc = NewString(""); // Save the generated strings in the parse tree in case they are used later @@ -1780,15 +1799,8 @@ public: String *callParms = make_pyParmList(n, false, true, kw); /* Make a wrapper function to insert the code into */ Printv(f_dest, "\ndef ", name, "(", parms, ")", returnTypeAnnotation(n), ":\n", NIL); - if (doxygen) { - String *doxygen_comments; - if (DoxygenTranslator::getDocumentation(n, PyDoc, doxygen_comments)) { - Printf(f_dest, Char(pythoncode(doxygen_comments, tab2))); - Delete(doxygen_comments); - } - } if (have_docstring(n)) - Printv(f_dest, " ", docstring(n, AUTODOC_FUNC, tab4), "\n", NIL); + Printv(f_dest, " ", docstring(n, AUTODOC_FUNC, tab2), "\n", NIL); if (have_pythonprepend(n)) Printv(f_dest, pythoncode(pythonprepend(n), " "), "\n", NIL); if (have_pythonappend(n)) { @@ -3700,16 +3712,7 @@ public: Printf(f_shadow, ":\n"); - // translate and write pydoc comment if flagged - if (doxygen){ - String *doxygen_comments; - if(DoxygenTranslator::getDocumentation(n, PyDoc, doxygen_comments)){ - Printf(f_shadow, Char(pythoncode(doxygen_comments, shadow_indent))); - Delete(doxygen_comments); - } - } - - // otherwise use default docstrings if requested + // write docstrings if requested if (have_docstring(n)) { String *str = docstring(n, AUTODOC_CLASS, tab4); if (str && Len(str)) @@ -3987,26 +3990,12 @@ public: if (!fastproxy || olddefs) { Printv(f_shadow, tab4, "def ", symname, "(", parms, ")", returnTypeAnnotation(n), ":", NIL); Printv(f_shadow, "\n", NIL); - if (doxygen) { - String *doxygen_comments; - if (DoxygenTranslator::getDocumentation(n, PyDoc, doxygen_comments)) { - Printf(f_shadow, Char(pythoncode(doxygen_comments, tab8))); - Delete(doxygen_comments); - } - } Printv(f_shadow, tab8, "return ", funcCall(fullname, callParms), "\n", NIL); } } else { Printv(f_shadow, tab4, "def ", symname, "(", parms, ")", returnTypeAnnotation(n), ":", NIL); Printv(f_shadow, "\n", NIL); - if (doxygen) { - String *doxygen_comments; - if(DoxygenTranslator::getDocumentation(n, PyDoc, doxygen_comments)){ - Printf(f_shadow, Char(pythoncode(doxygen_comments, tab8))); - Delete(doxygen_comments); - } - } - else if (have_docstring(n)) + if (have_docstring(n)) Printv(f_shadow, tab8, docstring(n, AUTODOC_METHOD, tab8), "\n", NIL); if (have_pythonprepend(n)) { fproxy = 0; From b88de2aa89f297b0c9bda42843836e3cab39f84b Mon Sep 17 00:00:00 2001 From: Dmitry Kabak Date: Mon, 18 Jun 2012 19:13:23 +0000 Subject: [PATCH 051/314] Fixed enum comments generation, added testcases git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2012-doxygen@13184 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Examples/test-suite/doxygen_parsing.i | 9 -- Examples/test-suite/doxygen_parsing_enums.i | 15 +++ .../test-suite/doxygen_parsing_enums_proper.i | 7 ++ .../test-suite/doxygen_parsing_enums_simple.i | 6 ++ .../doxygen_parsing_enums_typesafe.i | 8 ++ .../doxygen_parsing_enums_typeunsafe.i | 6 ++ Examples/test-suite/java/Makefile.in | 4 + .../doxygen_parsing_enums_proper_runme.java | 93 +++++++++++++++++++ .../doxygen_parsing_enums_simple_runme.java | 93 +++++++++++++++++++ .../doxygen_parsing_enums_typesafe_runme.java | 93 +++++++++++++++++++ ...oxygen_parsing_enums_typeunsafe_runme.java | 93 +++++++++++++++++++ .../java/doxygen_parsing_runme.java | 18 ++++ .../src/JavaDocConverter.cpp | 2 +- Source/Modules/java.cxx | 68 +++++++------- 14 files changed, 470 insertions(+), 45 deletions(-) create mode 100644 Examples/test-suite/doxygen_parsing_enums.i create mode 100644 Examples/test-suite/doxygen_parsing_enums_proper.i create mode 100644 Examples/test-suite/doxygen_parsing_enums_simple.i create mode 100644 Examples/test-suite/doxygen_parsing_enums_typesafe.i create mode 100644 Examples/test-suite/doxygen_parsing_enums_typeunsafe.i create mode 100644 Examples/test-suite/java/doxygen_parsing_enums_proper_runme.java create mode 100644 Examples/test-suite/java/doxygen_parsing_enums_simple_runme.java create mode 100644 Examples/test-suite/java/doxygen_parsing_enums_typesafe_runme.java create mode 100644 Examples/test-suite/java/doxygen_parsing_enums_typeunsafe_runme.java diff --git a/Examples/test-suite/doxygen_parsing.i b/Examples/test-suite/doxygen_parsing.i index 20781cfa8..b61317bcd 100644 --- a/Examples/test-suite/doxygen_parsing.i +++ b/Examples/test-suite/doxygen_parsing.i @@ -55,15 +55,6 @@ public: } }; -/** Test enumeration */ -enum E_TEST -{ - /** the first item */ - E_TEST_ONE, - E_TEST_TWO = 2, /**< the second */ - E_TEST_THREE = 2+1 -}; - /** * Comment for template class */ diff --git a/Examples/test-suite/doxygen_parsing_enums.i b/Examples/test-suite/doxygen_parsing_enums.i new file mode 100644 index 000000000..317abf384 --- /dev/null +++ b/Examples/test-suite/doxygen_parsing_enums.i @@ -0,0 +1,15 @@ +%module doxygen_parsing_enums + +%inline %{ + + +/** Test enumeration */ +enum E_TEST +{ + /** the first item */ + E_TEST_ONE, + E_TEST_TWO = 2, /**< the second */ + E_TEST_THREE = 2+1 +}; + +%} \ No newline at end of file diff --git a/Examples/test-suite/doxygen_parsing_enums_proper.i b/Examples/test-suite/doxygen_parsing_enums_proper.i new file mode 100644 index 000000000..1a69a84f1 --- /dev/null +++ b/Examples/test-suite/doxygen_parsing_enums_proper.i @@ -0,0 +1,7 @@ +%module "doxygen_parsing_enums_proper" + +// Test enum commenting using the proper enums in the target language +%include "enums.swg" + +%include "doxygen_parsing_enums.i" + diff --git a/Examples/test-suite/doxygen_parsing_enums_simple.i b/Examples/test-suite/doxygen_parsing_enums_simple.i new file mode 100644 index 000000000..823a27584 --- /dev/null +++ b/Examples/test-suite/doxygen_parsing_enums_simple.i @@ -0,0 +1,6 @@ +%module "doxygen_parsing_enums_simple" + +// Test enum commenting using simple constants (SWIG-1.3.21 and earlier default enum wrapping for C# and Java) +%include "enumsimple.swg" + +%include "doxygen_parsing_enums.i" \ No newline at end of file diff --git a/Examples/test-suite/doxygen_parsing_enums_typesafe.i b/Examples/test-suite/doxygen_parsing_enums_typesafe.i new file mode 100644 index 000000000..25e355ee2 --- /dev/null +++ b/Examples/test-suite/doxygen_parsing_enums_typesafe.i @@ -0,0 +1,8 @@ +%module "doxygen_parsing_enums_typesafe" + +// Test enum commenting using the typesafe enum pattern in the target language +%include "enumtypesafe.swg" + +#define SWIG_TEST_NOCSCONST // For C# typesafe enums + +%include "doxygen_parsing_enums.i" \ No newline at end of file diff --git a/Examples/test-suite/doxygen_parsing_enums_typeunsafe.i b/Examples/test-suite/doxygen_parsing_enums_typeunsafe.i new file mode 100644 index 000000000..e001035df --- /dev/null +++ b/Examples/test-suite/doxygen_parsing_enums_typeunsafe.i @@ -0,0 +1,6 @@ +%module "doxygen_parsing_enums_typeunsafe" + +// Test enum commenting using a type unsafe enum pattern (constant integers in a class for the enum type) +%include "enumtypeunsafe.swg" + +%include "doxygen_parsing_enums.i" \ No newline at end of file diff --git a/Examples/test-suite/java/Makefile.in b/Examples/test-suite/java/Makefile.in index 813232620..3cb9d0c23 100644 --- a/Examples/test-suite/java/Makefile.in +++ b/Examples/test-suite/java/Makefile.in @@ -16,6 +16,10 @@ C_TEST_CASES = \ java_lib_various CPP_TEST_CASES = \ + doxygen_parsing_enums_simple \ + doxygen_parsing_enums_proper \ + doxygen_parsing_enums_typesafe \ + doxygen_parsing_enums_typeunsafe \ enum_thorough_proper \ enum_thorough_simple \ enum_thorough_typeunsafe \ diff --git a/Examples/test-suite/java/doxygen_parsing_enums_proper_runme.java b/Examples/test-suite/java/doxygen_parsing_enums_proper_runme.java new file mode 100644 index 000000000..503e2c68e --- /dev/null +++ b/Examples/test-suite/java/doxygen_parsing_enums_proper_runme.java @@ -0,0 +1,93 @@ + +import doxygen_parsing_enums_proper.*; +import com.sun.javadoc.*; +import java.util.HashMap; +import java.util.Map.Entry; +import java.util.Iterator; + +public class doxygen_parsing_enums_proper_runme { + static { + try { + System.loadLibrary("doxygen_parsing_enums_proper"); + } catch (UnsatisfiedLinkError e) { + System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e); + System.exit(1); + } + } + + static HashMap parsedComments = new HashMap(); + static HashMap wantedComments = new HashMap(); + + public static boolean start(RootDoc root) { + + /* + This method is called by 'javadoc' and gets the whole parsed + java file, we get comments and store them + */ + + ClassDoc[] classes = root.classes(); + + for (int i = 0; i < classes.length; i++) { + + if (classes[i].getRawCommentText().length() > 0) + parsedComments.put(classes[i].name(), classes[i].getRawCommentText()); + + MethodDoc[] methods = classes[i].methods(); + FieldDoc[] fields = classes[i].fields(); + FieldDoc[] constants = classes[i].enumConstants(); + + for (int j = 0; j < constants.length; j++) { + FieldDoc f = constants[j]; + if (f.getRawCommentText().length() > 0) + parsedComments.put(f.name(), f.getRawCommentText()); + } + for (int j = 0; j < fields.length; j++) { + FieldDoc f = fields[j]; + if (f.getRawCommentText().length() > 0) + parsedComments.put(f.name(), f.getRawCommentText()); + } + for (int j = 0; j < methods.length; j++) { + MethodDoc m = methods[j]; + if (m.getRawCommentText().length() > 0) + parsedComments.put(m.name(), m.getRawCommentText()); + } + } + return true; + } + + public static void main(String argv[]) + { + /* + Here we are using internal javadoc tool, it accepts the name of the class as paramterer, + and calls the start() method of that class with parsed information. + */ + com.sun.tools.javadoc.Main.execute("doxygen_parsing_enums_proper runtime test", + "doxygen_parsing_enums_proper_runme", new String[]{"-quiet", "doxygen_parsing_enums_proper"}); + + wantedComments.put("E_TEST", " Test enumeration \n"); + wantedComments.put("E_TEST_ONE", " the first item \n"); + wantedComments.put("E_TEST_TWO", " the second \n"); + + int errorCount=0; + Iterator< Entry > it = parsedComments.entrySet().iterator(); + + while (it.hasNext()) + { + Entry e = (Entry) it.next(); + + if (!e.getValue().equals(wantedComments.get(e.getKey()))) { + System.out.println("Documentation comments for " + e.getKey() + " does not match: "); + System.out.println("\texpected:"+wantedComments.get(e.getKey())); + System.out.println("\tgot:\t"+e.getValue()); + errorCount++; + } + } + + if (parsedComments.size() != wantedComments.size()) { + System.out.println("Found " + (wantedComments.size()-parsedComments.size()) + " missed comment(s)!"); + errorCount++; + } + + System.exit(errorCount); + } +} diff --git a/Examples/test-suite/java/doxygen_parsing_enums_simple_runme.java b/Examples/test-suite/java/doxygen_parsing_enums_simple_runme.java new file mode 100644 index 000000000..ca640b3f0 --- /dev/null +++ b/Examples/test-suite/java/doxygen_parsing_enums_simple_runme.java @@ -0,0 +1,93 @@ + +import doxygen_parsing_enums_simple.*; +import com.sun.javadoc.*; +import java.util.HashMap; +import java.util.Map.Entry; +import java.util.Iterator; + +public class doxygen_parsing_enums_simple_runme { + static { + try { + System.loadLibrary("doxygen_parsing_enums_simple"); + } catch (UnsatisfiedLinkError e) { + System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e); + System.exit(1); + } + } + + static HashMap parsedComments = new HashMap(); + static HashMap wantedComments = new HashMap(); + + public static boolean start(RootDoc root) { + + /* + This method is called by 'javadoc' and gets the whole parsed + java file, we get comments and store them + */ + + ClassDoc[] classes = root.classes(); + + for (int i = 0; i < classes.length; i++) { + + if (classes[i].getRawCommentText().length() > 0) + parsedComments.put(classes[i].name(), classes[i].getRawCommentText()); + + MethodDoc[] methods = classes[i].methods(); + FieldDoc[] fields = classes[i].fields(); + FieldDoc[] constants = classes[i].enumConstants(); + + for (int j = 0; j < constants.length; j++) { + FieldDoc f = constants[j]; + if (f.getRawCommentText().length() > 0) + parsedComments.put(f.name(), f.getRawCommentText()); + } + for (int j = 0; j < fields.length; j++) { + FieldDoc f = fields[j]; + if (f.getRawCommentText().length() > 0) + parsedComments.put(f.name(), f.getRawCommentText()); + } + for (int j = 0; j < methods.length; j++) { + MethodDoc m = methods[j]; + if (m.getRawCommentText().length() > 0) + parsedComments.put(m.name(), m.getRawCommentText()); + } + } + return true; + } + + public static void main(String argv[]) + { + /* + Here we are using internal javadoc tool, it accepts the name of the class as paramterer, + and calls the start() method of that class with parsed information. + */ + com.sun.tools.javadoc.Main.execute("doxygen_parsing_enums_simple runtime test", + "doxygen_parsing_enums_simple_runme", new String[]{"-quiet", "doxygen_parsing_enums_simple"}); + + wantedComments.put("E_TEST", " Test enumeration \n"); + wantedComments.put("E_TEST_ONE", " the first item \n"); + wantedComments.put("E_TEST_TWO", " the second \n"); + + int errorCount=0; + Iterator< Entry > it = parsedComments.entrySet().iterator(); + + while (it.hasNext()) + { + Entry e = (Entry) it.next(); + + if (!e.getValue().equals(wantedComments.get(e.getKey()))) { + System.out.println("Documentation comments for " + e.getKey() + " does not match: "); + System.out.println("\texpected:"+wantedComments.get(e.getKey())); + System.out.println("\tgot:\t"+e.getValue()); + errorCount++; + } + } + + if (parsedComments.size() != wantedComments.size()) { + System.out.println("Found " + (wantedComments.size()-parsedComments.size()) + " missed comment(s)!"); + errorCount++; + } + + System.exit(errorCount); + } +} diff --git a/Examples/test-suite/java/doxygen_parsing_enums_typesafe_runme.java b/Examples/test-suite/java/doxygen_parsing_enums_typesafe_runme.java new file mode 100644 index 000000000..8d87c82d0 --- /dev/null +++ b/Examples/test-suite/java/doxygen_parsing_enums_typesafe_runme.java @@ -0,0 +1,93 @@ + +import doxygen_parsing_enums_typesafe.*; +import com.sun.javadoc.*; +import java.util.HashMap; +import java.util.Map.Entry; +import java.util.Iterator; + +public class doxygen_parsing_enums_typesafe_runme { + static { + try { + System.loadLibrary("doxygen_parsing_enums_typesafe"); + } catch (UnsatisfiedLinkError e) { + System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e); + System.exit(1); + } + } + + static HashMap parsedComments = new HashMap(); + static HashMap wantedComments = new HashMap(); + + public static boolean start(RootDoc root) { + + /* + This method is called by 'javadoc' and gets the whole parsed + java file, we get comments and store them + */ + + ClassDoc[] classes = root.classes(); + + for (int i = 0; i < classes.length; i++) { + + if (classes[i].getRawCommentText().length() > 0) + parsedComments.put(classes[i].name(), classes[i].getRawCommentText()); + + MethodDoc[] methods = classes[i].methods(); + FieldDoc[] fields = classes[i].fields(); + FieldDoc[] constants = classes[i].enumConstants(); + + for (int j = 0; j < constants.length; j++) { + FieldDoc f = constants[j]; + if (f.getRawCommentText().length() > 0) + parsedComments.put(f.name(), f.getRawCommentText()); + } + for (int j = 0; j < fields.length; j++) { + FieldDoc f = fields[j]; + if (f.getRawCommentText().length() > 0) + parsedComments.put(f.name(), f.getRawCommentText()); + } + for (int j = 0; j < methods.length; j++) { + MethodDoc m = methods[j]; + if (m.getRawCommentText().length() > 0) + parsedComments.put(m.name(), m.getRawCommentText()); + } + } + return true; + } + + public static void main(String argv[]) + { + /* + Here we are using internal javadoc tool, it accepts the name of the class as paramterer, + and calls the start() method of that class with parsed information. + */ + com.sun.tools.javadoc.Main.execute("doxygen_parsing_enums_typesafe runtime test", + "doxygen_parsing_enums_typesafe_runme", new String[]{"-quiet", "doxygen_parsing_enums_typesafe"}); + + wantedComments.put("E_TEST", " Test enumeration \n"); + wantedComments.put("E_TEST_ONE", " the first item \n"); + wantedComments.put("E_TEST_TWO", " the second \n"); + + int errorCount=0; + Iterator< Entry > it = parsedComments.entrySet().iterator(); + + while (it.hasNext()) + { + Entry e = (Entry) it.next(); + + if (!e.getValue().equals(wantedComments.get(e.getKey()))) { + System.out.println("Documentation comments for " + e.getKey() + " does not match: "); + System.out.println("\texpected:"+wantedComments.get(e.getKey())); + System.out.println("\tgot:\t"+e.getValue()); + errorCount++; + } + } + + if (parsedComments.size() != wantedComments.size()) { + System.out.println("Found " + (wantedComments.size()-parsedComments.size()) + " missed comment(s)!"); + errorCount++; + } + + System.exit(errorCount); + } +} diff --git a/Examples/test-suite/java/doxygen_parsing_enums_typeunsafe_runme.java b/Examples/test-suite/java/doxygen_parsing_enums_typeunsafe_runme.java new file mode 100644 index 000000000..a01007db1 --- /dev/null +++ b/Examples/test-suite/java/doxygen_parsing_enums_typeunsafe_runme.java @@ -0,0 +1,93 @@ + +import doxygen_parsing_enums_typeunsafe.*; +import com.sun.javadoc.*; +import java.util.HashMap; +import java.util.Map.Entry; +import java.util.Iterator; + +public class doxygen_parsing_enums_typeunsafe_runme { + static { + try { + System.loadLibrary("doxygen_parsing_enums_typeunsafe"); + } catch (UnsatisfiedLinkError e) { + System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e); + System.exit(1); + } + } + + static HashMap parsedComments = new HashMap(); + static HashMap wantedComments = new HashMap(); + + public static boolean start(RootDoc root) { + + /* + This method is called by 'javadoc' and gets the whole parsed + java file, we get comments and store them + */ + + ClassDoc[] classes = root.classes(); + + for (int i = 0; i < classes.length; i++) { + + if (classes[i].getRawCommentText().length() > 0) + parsedComments.put(classes[i].name(), classes[i].getRawCommentText()); + + MethodDoc[] methods = classes[i].methods(); + FieldDoc[] fields = classes[i].fields(); + FieldDoc[] constants = classes[i].enumConstants(); + + for (int j = 0; j < constants.length; j++) { + FieldDoc f = constants[j]; + if (f.getRawCommentText().length() > 0) + parsedComments.put(f.name(), f.getRawCommentText()); + } + for (int j = 0; j < fields.length; j++) { + FieldDoc f = fields[j]; + if (f.getRawCommentText().length() > 0) + parsedComments.put(f.name(), f.getRawCommentText()); + } + for (int j = 0; j < methods.length; j++) { + MethodDoc m = methods[j]; + if (m.getRawCommentText().length() > 0) + parsedComments.put(m.name(), m.getRawCommentText()); + } + } + return true; + } + + public static void main(String argv[]) + { + /* + Here we are using internal javadoc tool, it accepts the name of the class as paramterer, + and calls the start() method of that class with parsed information. + */ + com.sun.tools.javadoc.Main.execute("doxygen_parsing_enums_typeunsafe runtime test", + "doxygen_parsing_enums_typeunsafe_runme", new String[]{"-quiet", "doxygen_parsing_enums_typeunsafe"}); + + wantedComments.put("E_TEST", " Test enumeration \n"); + wantedComments.put("E_TEST_ONE", " the first item \n"); + wantedComments.put("E_TEST_TWO", " the second \n"); + + int errorCount=0; + Iterator< Entry > it = parsedComments.entrySet().iterator(); + + while (it.hasNext()) + { + Entry e = (Entry) it.next(); + + if (!e.getValue().equals(wantedComments.get(e.getKey()))) { + System.out.println("Documentation comments for " + e.getKey() + " does not match: "); + System.out.println("\texpected:"+wantedComments.get(e.getKey())); + System.out.println("\tgot:\t"+e.getValue()); + errorCount++; + } + } + + if (parsedComments.size() != wantedComments.size()) { + System.out.println("Found " + (wantedComments.size()-parsedComments.size()) + " missed comment(s)!"); + errorCount++; + } + + System.exit(errorCount); + } +} diff --git a/Examples/test-suite/java/doxygen_parsing_runme.java b/Examples/test-suite/java/doxygen_parsing_runme.java index c4264d003..fe4b75fa5 100644 --- a/Examples/test-suite/java/doxygen_parsing_runme.java +++ b/Examples/test-suite/java/doxygen_parsing_runme.java @@ -33,6 +33,19 @@ public class doxygen_parsing_runme { parsedComments.put(classes[i].name(), classes[i].getRawCommentText()); MethodDoc[] methods = classes[i].methods(); + FieldDoc[] fields = classes[i].fields(); + FieldDoc[] constants = classes[i].enumConstants(); + + for (int j = 0; j < constants.length; j++) { + FieldDoc f = constants[j]; + if (f.getRawCommentText().length() > 0) + parsedComments.put(f.name(), f.getRawCommentText()); + } + for (int j = 0; j < fields.length; j++) { + FieldDoc f = fields[j]; + if (f.getRawCommentText().length() > 0) + parsedComments.put(f.name(), f.getRawCommentText()); + } for (int j = 0; j < methods.length; j++) { MethodDoc m = methods[j]; if (m.getRawCommentText().length() > 0) @@ -84,6 +97,11 @@ public class doxygen_parsing_runme { } } + if (parsedComments.size() != wantedComments.size()) { + System.out.println("Found " + (wantedComments.size()-parsedComments.size()) + " missed comment(s)!"); + errorCount++; + } + System.exit(errorCount); } } diff --git a/Source/DoxygenTranslator/src/JavaDocConverter.cpp b/Source/DoxygenTranslator/src/JavaDocConverter.cpp index 8cca8b3a5..23f8c6d3e 100644 --- a/Source/DoxygenTranslator/src/JavaDocConverter.cpp +++ b/Source/DoxygenTranslator/src/JavaDocConverter.cpp @@ -13,7 +13,7 @@ #include "DoxygenParser.h" #include #define APPROX_LINE_LENGTH 64 //characters per line allowed -#define TAB_SIZE 8 //characters per line allowed +#define TAB_SIZE 8 //current tab size in spaces int printSortedTree2 = 0; //TODO {@link} {@linkplain} {@docRoot}, and other useful doxy commands that are not a javadoc tag diff --git a/Source/Modules/java.cxx b/Source/Modules/java.cxx index bfde4f19a..8455fbbf6 100644 --- a/Source/Modules/java.cxx +++ b/Source/Modules/java.cxx @@ -49,7 +49,7 @@ class JAVA:public Language { bool global_variable_flag; // Flag for when wrapping a global variable bool old_variable_names; // Flag for old style variable names in the intermediary class bool member_func_flag; // flag set when wrapping a member function - bool doxygen_javadoc_flag; //flag for converting found doxygen to javadoc + bool doxygen; //flag for converting found doxygen to javadoc bool comment_creation_chatter; //flag for getting information about where comments were created in java.cxx String *imclass_name; // intermediary class name @@ -123,7 +123,7 @@ public: global_variable_flag(false), old_variable_names(false), member_func_flag(false), - doxygen_javadoc_flag(true), + doxygen(true), comment_creation_chatter(false), imclass_name(NULL), module_class_name(NULL), @@ -255,6 +255,14 @@ public: Printf(stderr, "Deprecated command line option: %s. Proxy classes are now generated by default.\n", argv[i]); Swig_mark_arg(i); proxy_flag = true; + } else if ((strcmp(argv[i], "-doxygen") == 0)) { + Swig_mark_arg(i); + doxygen = true; + scan_doxygen_comments = true; + } else if ((strcmp(argv[i], "-nodoxygen") == 0)) { + Swig_mark_arg(i); + doxygen = false; + scan_doxygen_comments = false; } else if ((strcmp(argv[i], "-noproxy") == 0)) { Swig_mark_arg(i); proxy_flag = false; @@ -528,7 +536,7 @@ public: // Start writing out the module class file emitBanner(f_module); //Add any structural comments to the top - if(doxygen_javadoc_flag && structuralComments){ + if(doxygen && structuralComments){ Printf(f_module, "%s", structuralComments); } if (package) @@ -537,7 +545,7 @@ public: if (module_imports) Printf(f_module, "%s\n", module_imports); - if (doxygen_javadoc_flag){ + if (doxygen){ String *doxygen_comments; if(DoxygenTranslator::getDocumentation(n, JavaDoc,doxygen_comments)){ if(comment_creation_chatter) @@ -1292,17 +1300,6 @@ public: // Add extra indentation Replaceall(enum_code, "\n", "\n "); Replaceall(enum_code, " \n", "\n"); - - //translate and write javadoc comment if flagged - if (doxygen_javadoc_flag){ - String *doxygen_comments; - if(DoxygenTranslator::getDocumentation(n, JavaDoc,doxygen_comments)){ - if(comment_creation_chatter) - Printf(proxy_class_constants_code, "/* This was generated from enumvalueDeclaration() */"); - Printf(proxy_class_constants_code, Char(doxygen_comments)); - Delete(doxygen_comments); - } - } Printv(proxy_class_constants_code, " ", enum_code, "\n\n", NIL); } else { @@ -1418,30 +1415,29 @@ public: } if (!addSymbol(name, n, scope)) return SWIG_ERROR; + + //translate and write javadoc comment if flagged + if (doxygen){ + String *doxygen_comments; + if(DoxygenTranslator::getDocumentation(n, JavaDoc, doxygen_comments)){ + if(comment_creation_chatter) + Printf(enum_code, "/* This was generated from enumvalueDeclaration() */"); + Printf(enum_code, Char(doxygen_comments)); + Delete(doxygen_comments); + } + } if ((enum_feature == ProperEnum) && parent_name && !unnamedinstance) { // Wrap (non-anonymous) C/C++ enum with a proper Java enum // Emit the enum item. - if (!GetFlag(n, "firstenumitem")) - Printf(enum_code, ",\n"); - - //translate and write javadoc comment if flagged - if (doxygen_javadoc_flag){ - String *doxygen_comments; - if(DoxygenTranslator::getDocumentation(n, JavaDoc,doxygen_comments)){ - if(comment_creation_chatter) - Printf(enum_code, "/* This was generated from enumvalueDeclaration() */"); - Printf(enum_code, Char(doxygen_comments)); - Delete(doxygen_comments); - } - } - + Printf(enum_code, " %s", symname); if (Getattr(n, "enumvalue")) { String *value = enumValue(n); Printf(enum_code, "(%s)", value); Delete(value); } + Printf(enum_code, ",\n"); } else { // Wrap C/C++ enums with constant integers or use the typesafe enum pattern SwigType *typemap_lookup_type = parent_name ? parent_name : NewString("enum "); @@ -1493,7 +1489,7 @@ public: * file * ------------------------------------------------------------------------ */ virtual int doxygenComment(Node *n){ - if (doxygen_javadoc_flag){ + if (doxygen){ String *doxygen_comments; if(DoxygenTranslator::getDocumentation(n, JavaDoc, doxygen_comments)){ if(comment_creation_chatter) @@ -1527,7 +1523,7 @@ public: Swig_save("constantWrapper", n, "value", NIL); //translate and write javadoc comment if flagged - if (doxygen_javadoc_flag){ + if (doxygen){ String *doxygen_comments; if(DoxygenTranslator::getDocumentation(n, JavaDoc, doxygen_comments)){ if(comment_creation_chatter) @@ -1825,7 +1821,7 @@ public: const String *pure_interfaces = typemapLookup(n, "javainterfaces", typemap_lookup_type, WARN_NONE); //translate and write javadoc comment if flagged - if (doxygen_javadoc_flag){ + if (doxygen){ String *doxygen_comments; if(DoxygenTranslator::getDocumentation(n, JavaDoc, doxygen_comments)){ if(comment_creation_chatter) @@ -2231,7 +2227,7 @@ public: } //translate and write javadoc comment if flagged - if (doxygen_javadoc_flag){ + if (doxygen){ String *doxygen_comments; if(DoxygenTranslator::getDocumentation(n, JavaDoc, doxygen_comments)){ if(comment_creation_chatter) @@ -2464,7 +2460,7 @@ public: Printf(im_return_type, "%s", tm); //translate and write javadoc comment if flagged - if (doxygen_javadoc_flag){ + if (doxygen){ String *doxygen_comments; if(DoxygenTranslator::getDocumentation(n, JavaDoc, doxygen_comments)){ if(comment_creation_chatter) @@ -2736,7 +2732,7 @@ public: String *post_code = NewString(""); // translate and write javadoc comment if flagged - if (doxygen_javadoc_flag){ + if (doxygen){ String *doxygen_comments; if(DoxygenTranslator::getDocumentation(n, JavaDoc, doxygen_comments)) { if(comment_creation_chatter) @@ -4523,6 +4519,8 @@ extern "C" Language *swig_java(void) { const char *JAVA::usage = (char *) "\ Java Options (available with -java)\n\ + -doxygen - Convert C++ doxygen comments to JavaDoc comments in proxy classes (default)\n\ + -nodoxygen - Don't convert C++ doxygen comments to JavaDoc comments in proxy classes\n\ -nopgcpp - Suppress premature garbage collection prevention parameter\n\ -noproxy - Generate the low-level functional interface instead\n\ of proxy classes\n\ From 4141c9fd8712797401da42be00ad8e7c5bf498c0 Mon Sep 17 00:00:00 2001 From: Dmitry Kabak Date: Mon, 18 Jun 2012 19:31:35 +0000 Subject: [PATCH 052/314] Added doxygen switches doc git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2012-doxygen@13185 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Doc/Manual/Doxygen.html | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Doc/Manual/Doxygen.html b/Doc/Manual/Doxygen.html index 989fb0dc4..d0e837756 100644 --- a/Doc/Manual/Doxygen.html +++ b/Doc/Manual/Doxygen.html @@ -114,7 +114,16 @@ Just remember, if SWIG shows syntax error parsing the file because of your comme

    -NOT YET ADDED (current development branch has this feature automatically enabled). +There are switches like '-doxygen' and '-nodoxygen' in every module that supports converting +documentation comments. The first one is default, so that swig by default produces correct +proxy files with comments. Some comments in some target languages can be manually overriden by specific +swig's features, like feature:docstring or feature:autodoc, in this cases doxygen comments +have lowest priority. +

    +

    +Switching off may be needed if swig cannot correctly parse your comments, for example showing Error: +Syntax error in input(1). message. Then it will just strip out every comment out of the code and +continue happily.

    35.2.2 Additional Commandline Options

    From 4289b8e27374bdab773a90b5ab9792f7e659ce45 Mon Sep 17 00:00:00 2001 From: Dmitry Kabak Date: Mon, 25 Jun 2012 15:47:36 +0000 Subject: [PATCH 053/314] Refactored comment translator class, implemented result caching git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2012-doxygen@13191 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- .../src/DoxygenTranslator.cpp | 45 ++++-- .../DoxygenTranslator/src/DoxygenTranslator.h | 42 ++++-- .../src/JavaDocConverter.cpp | 11 +- .../DoxygenTranslator/src/JavaDocConverter.h | 2 +- .../DoxygenTranslator/src/PyDocConverter.cpp | 23 ++-- Source/DoxygenTranslator/src/PyDocConverter.h | 2 +- Source/Modules/java.cxx | 128 +++++++++--------- Source/Modules/lang.cxx | 5 +- Source/Modules/python.cxx | 10 +- Source/Modules/swigmod.h | 3 + 10 files changed, 159 insertions(+), 112 deletions(-) diff --git a/Source/DoxygenTranslator/src/DoxygenTranslator.cpp b/Source/DoxygenTranslator/src/DoxygenTranslator.cpp index 36ca95579..a733fdbc7 100644 --- a/Source/DoxygenTranslator/src/DoxygenTranslator.cpp +++ b/Source/DoxygenTranslator/src/DoxygenTranslator.cpp @@ -13,18 +13,41 @@ * ----------------------------------------------------------------------------- */ #include "DoxygenTranslator.h" -#include "JavaDocConverter.h" -#include "PyDocConverter.h" -bool DoxygenTranslator::getDocumentation(Node *node, DocumentationFormat format, String *&documentation) { - switch (format) { - case JavaDoc: - return JavaDocConverter().getDocumentation(node, documentation); - case PyDoc: - return PyDocConverter().getDocumentation(node, documentation); - default: - return false; - } +DoxygenTranslator::DoxygenTranslator() { + // Init the cache + resultsCache = NewHash(); +} +DoxygenTranslator::~DoxygenTranslator() { + // Clean up the cache + Delete(resultsCache); +} + +bool DoxygenTranslator::hasDocumentation(Node *node) { + return getDoxygenComment(node); +} + +String *DoxygenTranslator::getDoxygenComment(Node *node) { + return Getattr(node, "DoxygenComment"); +} + + +String *DoxygenTranslator::getDocumentation(Node *node) { + + if (!hasDocumentation(node)) + return 0; + + // get from cache + String *resultedDocs = Getattr(resultsCache, getDoxygenComment(node)); + + if (resultedDocs) + return resultedDocs; + + // not found in cache, produce it + resultedDocs = makeDocumentation(node); + Setattr(resultsCache, getDoxygenComment(node), resultedDocs); + + return resultedDocs; } void DoxygenTranslator::printTree(std::list < DoxygenEntity > &entityList) { diff --git a/Source/DoxygenTranslator/src/DoxygenTranslator.h b/Source/DoxygenTranslator/src/DoxygenTranslator.h index 1a14a4db2..023bdac89 100644 --- a/Source/DoxygenTranslator/src/DoxygenTranslator.h +++ b/Source/DoxygenTranslator/src/DoxygenTranslator.h @@ -17,16 +17,9 @@ #include "swig.h" #include "DoxygenEntity.h" +#include "DoxygenParser.h" #include -/* - * Describes the availible documentation systems - * that can be translated to. - */ -enum DocumentationFormat { - JavaDoc = 1, - PyDoc = 2 -}; /* * A class to translate doxygen comments attacted to parser nodes @@ -34,20 +27,31 @@ enum DocumentationFormat { */ class DoxygenTranslator { public: + /* + * Constructor + */ + DoxygenTranslator(); /* * Virtual destructor. */ - virtual ~ DoxygenTranslator() { - } + virtual ~ DoxygenTranslator(); /* * Return the documentation for a given node formated for the correct - * documentation system. + * documentation system. The result is cached and translated only once. * @param node The node to extract and translate documentation for. * @param format The documentation format to output. * @param documentation The returned documentation string. * @return A bool to indicate if there was documentation to return for the node. */ - static bool getDocumentation(Node *node, DocumentationFormat format, String *&documentation); + String *getDocumentation(Node *node); + /* + * Whether the specified node has comment or not + */ + bool hasDocumentation(Node *node); + /* + * Get original, Doxygen-format comment string + */ + String *getDoxygenComment(Node *node); protected: /* @@ -57,12 +61,22 @@ protected: * @param documentation The returned documentation string. * @return A bool to indicate if there was documentation to return for the node. */ - virtual bool getDocumentation(Node *node, String *&documentation) = 0; - + virtual String *makeDocumentation(Node *node) = 0; + /* * Prints the details of a parsed entity list to stdout (for debugging). */ void printTree(std::list < DoxygenEntity > &entityList); + + /* + * Doxygen parser object + */ + DoxygenParser parser; + + /* + * Cache of translated comments + */ + Hash *resultsCache; }; #endif diff --git a/Source/DoxygenTranslator/src/JavaDocConverter.cpp b/Source/DoxygenTranslator/src/JavaDocConverter.cpp index 23f8c6d3e..812a6c34d 100644 --- a/Source/DoxygenTranslator/src/JavaDocConverter.cpp +++ b/Source/DoxygenTranslator/src/JavaDocConverter.cpp @@ -150,12 +150,12 @@ std::string JavaDocConverter::translateEntity(DoxygenEntity & doxyEntity) { } -bool JavaDocConverter::getDocumentation(Node *node, String *&documentation) { +String *JavaDocConverter::makeDocumentation(Node *node) { - documentation = Getattr(node, "DoxygenComment"); + String *documentation = getDoxygenComment(node); if (documentation == NULL) { - return false; + return NULL; } std::list < DoxygenEntity > entityList = DoxygenParser().createTree(Char(documentation)); @@ -181,7 +181,6 @@ bool JavaDocConverter::getDocumentation(Node *node, String *&documentation) { std::cout << "\n---RESULT IN JAVADOC---" << std::endl; std::cout << javaDocString; } - - documentation = NewString(javaDocString.c_str()); - return true; + + return NewString(javaDocString.c_str()); } diff --git a/Source/DoxygenTranslator/src/JavaDocConverter.h b/Source/DoxygenTranslator/src/JavaDocConverter.h index 69fc8d75d..1d54e2514 100644 --- a/Source/DoxygenTranslator/src/JavaDocConverter.h +++ b/Source/DoxygenTranslator/src/JavaDocConverter.h @@ -23,7 +23,7 @@ class JavaDocConverter : public DoxygenTranslator { public: JavaDocConverter() : debug(false) { } - virtual bool getDocumentation(Node *node, String *&documentation); + String *makeDocumentation(Node *node); protected: std::string formatCommand(std::string unformattedLine, int indent); diff --git a/Source/DoxygenTranslator/src/PyDocConverter.cpp b/Source/DoxygenTranslator/src/PyDocConverter.cpp index 55c3ba61b..b1e94a062 100644 --- a/Source/DoxygenTranslator/src/PyDocConverter.cpp +++ b/Source/DoxygenTranslator/src/PyDocConverter.cpp @@ -19,7 +19,7 @@ //TODO {@link} {@linkplain} {@docRoot}, and other useful doxy commands that are not a pydoc tag PyDocConverter::PyDocConverter() { - debug = 1; + debug = 0; } std::string PyDocConverter::formatParam(Node *n, DoxygenEntity & doxygenEntity) { @@ -40,6 +40,8 @@ std::string PyDocConverter::formatParam(Node *n, DoxygenEntity & doxygenEntity) std::string paramDescription = justifyString(paramDescriptionEntity.data, DOC_PARAM_STRING_LENGTH); for (p = plist; p;) { + + //Swig_print(p, 1); if (Char(Getattr(p, "name")) == paramNameEntity.data) { std::string name = Char(Swig_name_make(n, 0, Getattr(p, "name"), 0, 0)); std::string type = Char(Swig_name_make(n, 0, Getattr(p, "type"), 0, 0)); @@ -52,7 +54,12 @@ std::string PyDocConverter::formatParam(Node *n, DoxygenEntity & doxygenEntity) result += "-- " + paramDescription.substr(DOC_PARAM_STRING_LENGTH); break; } - p = Getattr(p, "tmap:in") ? Getattr(p, "tmap:in:next") : nextSibling(p); + /* + * doesn't seem to work always: in some cases (especially for 'self' parameters) + * tmap:in is present, but tmap:in:next is not and so this code skips all the parameters + */ + //p = Getattr(p, "tmap:in") ? Getattr(p, "tmap:in:next") : nextSibling(p); + p = nextSibling(p); } Delete(plist); @@ -147,7 +154,8 @@ std::string PyDocConverter::processEntityList(Node *n, std::list < DoxygenEntity return result; } -bool PyDocConverter::getDocumentation(Node *n, String *&documentation) { +String *PyDocConverter::makeDocumentation(Node *n) { + String *documentation; std::string pyDocString, result; // for overloaded functions we must concat documentation for underlying overloads @@ -160,7 +168,7 @@ bool PyDocConverter::getDocumentation(Node *n, String *&documentation) { // for each real method (not a generated overload) append the documentation while (n) { - documentation = Getattr(n, "DoxygenComment"); + documentation = getDoxygenComment(n); if (!Swig_is_generated_overload(n) && documentation) { std::list < DoxygenEntity > entityList = DoxygenParser().createTree(Char(documentation)); allDocumentation.push_back(processEntityList(n, entityList)); @@ -184,7 +192,7 @@ bool PyDocConverter::getDocumentation(Node *n, String *&documentation) { } // for other nodes just process as normal else { - documentation = Getattr(n, "DoxygenComment"); + documentation = getDoxygenComment(n); if (documentation != NULL) { std::list < DoxygenEntity > entityList = DoxygenParser().createTree(Char(documentation)); pyDocString = processEntityList(n, entityList); @@ -201,11 +209,10 @@ bool PyDocConverter::getDocumentation(Node *n, String *&documentation) { std::cout << std::endl; } - documentation = NewString(result.c_str()); - return true; + return NewString(result.c_str()); } - return false; + return 0; } std::string PyDocConverter::generateDivider() { diff --git a/Source/DoxygenTranslator/src/PyDocConverter.h b/Source/DoxygenTranslator/src/PyDocConverter.h index ecd033af5..2d910c8f9 100644 --- a/Source/DoxygenTranslator/src/PyDocConverter.h +++ b/Source/DoxygenTranslator/src/PyDocConverter.h @@ -26,7 +26,7 @@ class PyDocConverter : public DoxygenTranslator { public: PyDocConverter(); - bool getDocumentation(Node *node, String *&documentation); + String *makeDocumentation(Node *node); protected: diff --git a/Source/Modules/java.cxx b/Source/Modules/java.cxx index 8455fbbf6..2c6e1b08c 100644 --- a/Source/Modules/java.cxx +++ b/Source/Modules/java.cxx @@ -17,7 +17,7 @@ char cvsroot_java_cxx[] = "$Id$"; #include // for INT_MAX #include "cparse.h" #include -#include "../DoxygenTranslator/src/DoxygenTranslator.h" +#include "../DoxygenTranslator/src/JavaDocConverter.h" /* Hash type used for upcalls from C/C++ */ typedef DOH UpcallData; @@ -158,11 +158,19 @@ public: dmethods_seq(NULL), dmethods_table(NULL), n_dmethods(0), - n_directors(0) { + n_directors(0){ /* for now, multiple inheritance in directors is disabled, this should be easy to implement though */ director_multiple_inheritance = 0; director_language = 1; + + if (doxygen) + doxygenTranslator = new JavaDocConverter(); + } + + ~JAVA() { + if (doxygen) + delete doxygenTranslator; } /* ----------------------------------------------------------------------------- @@ -286,6 +294,9 @@ public: } } } + + if (doxygen) + doxygenTranslator = new JavaDocConverter(); // Add a symbol to the parser for conditional compilation Preprocessor_define("SWIGJAVA 1", 0); @@ -545,14 +556,12 @@ public: if (module_imports) Printf(f_module, "%s\n", module_imports); - if (doxygen){ - String *doxygen_comments; - if(DoxygenTranslator::getDocumentation(n, JavaDoc,doxygen_comments)){ - if(comment_creation_chatter) - Printf(f_module, "/* This was generated from top() */"); - Printf(f_module, Char(doxygen_comments)); - Delete(doxygen_comments); - } + if (doxygen && doxygenTranslator->hasDocumentation(n)){ + String *doxygen_comments=doxygenTranslator->getDocumentation(n); + if(comment_creation_chatter) + Printf(f_module, "/* This was generated from top() */"); + Printf(f_module, Char(doxygen_comments)); + Delete(doxygen_comments); } if (Len(module_class_modifiers) > 0) Printf(f_module, "%s ", module_class_modifiers); @@ -1417,14 +1426,12 @@ public: return SWIG_ERROR; //translate and write javadoc comment if flagged - if (doxygen){ - String *doxygen_comments; - if(DoxygenTranslator::getDocumentation(n, JavaDoc, doxygen_comments)){ - if(comment_creation_chatter) - Printf(enum_code, "/* This was generated from enumvalueDeclaration() */"); - Printf(enum_code, Char(doxygen_comments)); - Delete(doxygen_comments); - } + if (doxygen && doxygenTranslator->hasDocumentation(n)){ + String *doxygen_comments=doxygenTranslator->getDocumentation(n); + if(comment_creation_chatter) + Printf(enum_code, "/* This was generated from enumvalueDeclaration() */"); + Printf(enum_code, Char(doxygen_comments)); + Delete(doxygen_comments); } if ((enum_feature == ProperEnum) && parent_name && !unnamedinstance) { @@ -1489,14 +1496,12 @@ public: * file * ------------------------------------------------------------------------ */ virtual int doxygenComment(Node *n){ - if (doxygen){ - String *doxygen_comments; - if(DoxygenTranslator::getDocumentation(n, JavaDoc, doxygen_comments)){ - if(comment_creation_chatter) - Printf(structuralComments, "/* This was generated from doxygenComment() */"); - Printf(structuralComments, Char(doxygen_comments)); - Delete(doxygen_comments); - } + if (doxygen && doxygenTranslator->hasDocumentation(n)){ + String *doxygen_comments=doxygenTranslator->getDocumentation(n); + if(comment_creation_chatter) + Printf(structuralComments, "/* This was generated from doxygenComment() */"); + Printf(structuralComments, Char(doxygen_comments)); + Delete(doxygen_comments); } return SWIG_OK; } @@ -1523,14 +1528,12 @@ public: Swig_save("constantWrapper", n, "value", NIL); //translate and write javadoc comment if flagged - if (doxygen){ - String *doxygen_comments; - if(DoxygenTranslator::getDocumentation(n, JavaDoc, doxygen_comments)){ - if(comment_creation_chatter) - Printf(constants_code, "/* This was generated from constantWrapper() */"); - Printf(constants_code, Char(doxygen_comments)); - Delete(doxygen_comments); - } + if (doxygen && doxygenTranslator->hasDocumentation(n)){ + String *doxygen_comments=doxygenTranslator->getDocumentation(n); + if(comment_creation_chatter) + Printf(constants_code, "/* This was generated from constantWrapper() */"); + Printf(constants_code, Char(doxygen_comments)); + Delete(doxygen_comments); } bool is_enum_item = (Cmp(nodeType(n), "enumitem") == 0); @@ -1821,14 +1824,12 @@ public: const String *pure_interfaces = typemapLookup(n, "javainterfaces", typemap_lookup_type, WARN_NONE); //translate and write javadoc comment if flagged - if (doxygen){ - String *doxygen_comments; - if(DoxygenTranslator::getDocumentation(n, JavaDoc, doxygen_comments)){ - if(comment_creation_chatter) - Printf(proxy_class_def, "/* This was generated from emitProxyClassDefAndCPPCasts() */"); - Printf(proxy_class_def, Char(doxygen_comments)); - Delete(doxygen_comments); - } + if (doxygen && doxygenTranslator->hasDocumentation(n)){ + String *doxygen_comments=doxygenTranslator->getDocumentation(n); + if(comment_creation_chatter) + Printf(proxy_class_def, "/* This was generated from emitProxyClassDefAndCPPCasts() */"); + Printf(proxy_class_def, Char(doxygen_comments)); + Delete(doxygen_comments); } // Start writing the proxy class @@ -2227,14 +2228,12 @@ public: } //translate and write javadoc comment if flagged - if (doxygen){ - String *doxygen_comments; - if(DoxygenTranslator::getDocumentation(n, JavaDoc, doxygen_comments)){ - if(comment_creation_chatter) - Printf(function_code, "/* This was generated from proxyclassfunctionhandler() */"); - Printf(function_code, Char(doxygen_comments)); - Delete(doxygen_comments); - } + if (doxygen && doxygenTranslator->hasDocumentation(n)){ + String *doxygen_comments=doxygenTranslator->getDocumentation(n); + if(comment_creation_chatter) + Printf(function_code, "/* This was generated from proxyclassfunctionhandler() */"); + Printf(function_code, Char(doxygen_comments)); + Delete(doxygen_comments); } /* Start generating the proxy function */ @@ -2460,14 +2459,12 @@ public: Printf(im_return_type, "%s", tm); //translate and write javadoc comment if flagged - if (doxygen){ - String *doxygen_comments; - if(DoxygenTranslator::getDocumentation(n, JavaDoc, doxygen_comments)){ - if(comment_creation_chatter) - Printf(function_code, "/* This was generated from constructionhandler() */"); - Printf(function_code, Char(doxygen_comments)); - Delete(doxygen_comments); - } + if (doxygen && doxygenTranslator->hasDocumentation(n)){ + String *doxygen_comments=doxygenTranslator->getDocumentation(n); + if(comment_creation_chatter) + Printf(function_code, "/* This was generated from constructionhandler() */"); + Printf(function_code, Char(doxygen_comments)); + Delete(doxygen_comments); } Printf(function_code, " %s %s(", methodmods, proxy_class_name); @@ -2732,14 +2729,12 @@ public: String *post_code = NewString(""); // translate and write javadoc comment if flagged - if (doxygen){ - String *doxygen_comments; - if(DoxygenTranslator::getDocumentation(n, JavaDoc, doxygen_comments)) { - if(comment_creation_chatter) - Printf(function_code, "/* This was generated from moduleClassFunctionHandler() */"); - Printv(function_code, doxygen_comments, NIL); - Delete(doxygen_comments); - } + if (doxygen && doxygenTranslator->hasDocumentation(n)){ + String *doxygen_comments=doxygenTranslator->getDocumentation(n); + if(comment_creation_chatter) + Printf(function_code, "/* This was generated from moduleClassFunctionHandler() */"); + Printv(function_code, doxygen_comments, NIL); + Delete(doxygen_comments); } if (l) { @@ -4527,3 +4522,4 @@ Java Options (available with -java)\n\ -oldvarnames - Old intermediary method names for variable wrappers\n\ -package - Set name of the Java package to \n\ \n"; + diff --git a/Source/Modules/lang.cxx b/Source/Modules/lang.cxx index d89ef3e40..9e10e0f0b 100644 --- a/Source/Modules/lang.cxx +++ b/Source/Modules/lang.cxx @@ -2869,9 +2869,10 @@ int Language::usingDeclaration(Node *n) { * ---------------------------------------------------------------------- */ int Language::doxygenComment(Node *n){ - String *comment = Getattr(n, "comment"); + String *comment = Getattr(n, "comment"); + Printf(stdout, "doxygenComment : %s\n", comment); - return SWIG_OK; + return SWIG_OK; } diff --git a/Source/Modules/python.cxx b/Source/Modules/python.cxx index 07437715d..40a50d45e 100644 --- a/Source/Modules/python.cxx +++ b/Source/Modules/python.cxx @@ -20,7 +20,7 @@ static int treduce = SWIG_cparse_template_reduce(0); #include #include -#include "../DoxygenTranslator/src/DoxygenTranslator.h" +#include "../DoxygenTranslator/src/PyDocConverter.h" #include "../../../swig/bug.h" #define PYSHADOW_MEMBER 0x2 @@ -548,6 +548,9 @@ public: if (cppcast) { Preprocessor_define((DOH *) "SWIG_CPLUSPLUS_CAST", 0); } + + if (doxygen) + doxygenTranslator = new PyDocConverter; if (!global_name) global_name = NewString("cvar"); @@ -1203,7 +1206,7 @@ public: String *str = Getattr(n, "feature:docstring"); return ((str && Len(str) > 0) || (Getattr(n, "feature:autodoc") && !GetFlag(n, "feature:noautodoc")) - || (doxygen && Getattr(n, "DoxygenComment")) + || (doxygen && doxygenTranslator->hasDocumentation(n)) ); } @@ -1219,7 +1222,7 @@ public: String *doxygen_comment = 0; bool have_ds = (str && Len(str) > 0); bool have_auto = (Getattr(n, "feature:autodoc") && !GetFlag(n, "feature:noautodoc")); - bool have_doxygen = doxygen && DoxygenTranslator::getDocumentation(n, PyDoc, doxygen_comment); + bool have_doxygen = doxygen && doxygenTranslator->hasDocumentation(n); const char *triple_double = use_triple ? "\"\"\"" : ""; String *autodoc = NULL; String *doc = NULL; @@ -1237,6 +1240,7 @@ public: have_auto = (autodoc && Len(autodoc) > 0); } if (have_doxygen) { + doxygen_comment = doxygenTranslator->getDocumentation(n); have_doxygen = (doxygen_comment && Len(doxygen_comment) > 0); } // If there is more than one line then make docstrings like this: diff --git a/Source/Modules/swigmod.h b/Source/Modules/swigmod.h index 897aaa9ef..0acbc1fe7 100644 --- a/Source/Modules/swigmod.h +++ b/Source/Modules/swigmod.h @@ -17,6 +17,7 @@ #include "swig.h" #include "preprocessor.h" #include "swigwarn.h" +#include "../DoxygenTranslator/src/DoxygenTranslator.h" #if !defined(HAVE_BOOL) typedef int bool; @@ -315,6 +316,8 @@ protected: /* Director language module */ int director_language; + // Class instance to translate comments + DoxygenTranslator *doxygenTranslator; private: Hash *symtabs; /* symbol tables */ Hash *classtypes; From 304e232dbcf576c160edefb29abea66e28bc9a10 Mon Sep 17 00:00:00 2001 From: Dmitry Kabak Date: Fri, 29 Jun 2012 19:28:21 +0000 Subject: [PATCH 054/314] Fixed enum comments generation in java git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2012-doxygen@13209 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- .../doxygen_parsing_enums_simple_runme.java | 1 - Source/Modules/java.cxx | 21 ++++++++++++++++--- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/Examples/test-suite/java/doxygen_parsing_enums_simple_runme.java b/Examples/test-suite/java/doxygen_parsing_enums_simple_runme.java index ca640b3f0..ee422e2c4 100644 --- a/Examples/test-suite/java/doxygen_parsing_enums_simple_runme.java +++ b/Examples/test-suite/java/doxygen_parsing_enums_simple_runme.java @@ -64,7 +64,6 @@ public class doxygen_parsing_enums_simple_runme { com.sun.tools.javadoc.Main.execute("doxygen_parsing_enums_simple runtime test", "doxygen_parsing_enums_simple_runme", new String[]{"-quiet", "doxygen_parsing_enums_simple"}); - wantedComments.put("E_TEST", " Test enumeration \n"); wantedComments.put("E_TEST_ONE", " the first item \n"); wantedComments.put("E_TEST_TWO", " the second \n"); diff --git a/Source/Modules/java.cxx b/Source/Modules/java.cxx index 2c6e1b08c..71de5380c 100644 --- a/Source/Modules/java.cxx +++ b/Source/Modules/java.cxx @@ -1279,8 +1279,12 @@ public: Replaceall(enum_code, "$static ", ""); Delete(scope); } else { - // Wrap C++ enum with integers - just indicate start of enum with a comment, no comment for anonymous enums of any sort - if (symname && !Getattr(n, "unnamedinstance")) + //translate and write javadoc comment for the enum itself if flagged + if (doxygen && doxygenTranslator->hasDocumentation(n)){ + Printf(stdout, "Warning: Not emitting comment for %s, not supported in simple enums mode.\n", + Getattr(n, "unnamedinstance") ? "unnamed enum" : symname); + } + else if (symname && !Getattr(n, "unnamedinstance")) Printf(constants_code, " // %s \n", symname); } @@ -1337,7 +1341,18 @@ public: } Printv(f_enum, typemapLookup(n, "javaimports", typemap_lookup_type, WARN_NONE), // Import statements - "\n", enum_code, "\n", NIL); + "\n\n", NIL); + + //translate and write javadoc comment if flagged + if (doxygen && doxygenTranslator->hasDocumentation(n)){ + String *doxygen_comments=doxygenTranslator->getDocumentation(n); + if(comment_creation_chatter) + Printf(f_enum, "/* This was generated from enumDeclaration() */"); + Printf(f_enum, Char(doxygen_comments)); + Delete(doxygen_comments); + } + + Printv(f_enum, enum_code, "\n", NIL); Printf(f_enum, "\n"); Close(f_enum); From 774cbc3ef216d9428620c0076dd569af61107da3 Mon Sep 17 00:00:00 2001 From: Dmitry Kabak Date: Fri, 29 Jun 2012 19:37:42 +0000 Subject: [PATCH 055/314] Fixed comments parsing, but broken li_boost_shared_ptr_bits test git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2012-doxygen@13210 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Examples/test-suite/doxygen_parsing.i | 6 +- .../java/doxygen_parsing_runme.java | 6 +- .../python/doxygen_parsing_runme.py | 1 + Source/CParse/parser.y | 328 +++++++----------- 4 files changed, 138 insertions(+), 203 deletions(-) diff --git a/Examples/test-suite/doxygen_parsing.i b/Examples/test-suite/doxygen_parsing.i index b61317bcd..a83cd77ed 100644 --- a/Examples/test-suite/doxygen_parsing.i +++ b/Examples/test-suite/doxygen_parsing.i @@ -16,6 +16,9 @@ int simpleVarThree=42; //! This is the last type of comment for a var int simpleVarFour=42; +int simpleVarFive=42; +///< This is a post comment + /* We assume that all this comment types are ok, and later we only use the first-type comments. @@ -49,7 +52,8 @@ public: * Simple method with parameter */ void simpleMethodWithParameter( - int param /**< Some test param */ + int param, /**< Some test param */ + int argument /**< Some test argument */ ) { } diff --git a/Examples/test-suite/java/doxygen_parsing_runme.java b/Examples/test-suite/java/doxygen_parsing_runme.java index fe4b75fa5..909de9312 100644 --- a/Examples/test-suite/java/doxygen_parsing_runme.java +++ b/Examples/test-suite/java/doxygen_parsing_runme.java @@ -68,7 +68,9 @@ public class doxygen_parsing_runme { wantedComments.put("CSimpleClass", " This is simple comment for a class \n"); wantedComments.put("simpleMethod", " Simple method \n"); - wantedComments.put("simpleMethodWithParameter", " Simple method with parameter \n @param\tparam Some test param \n"); + wantedComments.put("simpleMethodWithParameter", " Simple method with parameter \n" + + " @param\tparam Some test param \n" + + " @param\targument Some test argument \n"); wantedComments.put("CTemplateClassInt", " Comment for template class \n"); wantedComments.put("templateMethod", " Template method \n"); @@ -80,6 +82,8 @@ public class doxygen_parsing_runme { wantedComments.put("getSimpleVarThree", " This is again another type of comment for a var \n"); wantedComments.put("setSimpleVarFour", " This is the last type of comment for a var \n"); wantedComments.put("getSimpleVarFour", " This is the last type of comment for a var \n"); + wantedComments.put("setSimpleVarFive", " This is a post comment \n"); + wantedComments.put("getSimpleVarFive", " This is a post comment \n"); int errorCount=0; diff --git a/Examples/test-suite/python/doxygen_parsing_runme.py b/Examples/test-suite/python/doxygen_parsing_runme.py index eef840818..097c18f8c 100644 --- a/Examples/test-suite/python/doxygen_parsing_runme.py +++ b/Examples/test-suite/python/doxygen_parsing_runme.py @@ -14,6 +14,7 @@ check(doxygen_parsing.CSimpleClass.simpleMethod.__doc__, '\s+Simple method\s+') check(doxygen_parsing.CSimpleClass.simpleMethodWithParameter.__doc__, '' '\s+Simple method with parameter' '\s+Arguments:\s+param \(int\)\s+-- Some test param\s+' +'argument \(int\)\s+-- Some test argument\s+' ) check(doxygen_parsing.CTemplateClassInt.__doc__, '\s+Comment for template class\s+') check(doxygen_parsing.CTemplateClassInt.templateMethod.__doc__, '\s+Template method\s+') \ No newline at end of file diff --git a/Source/CParse/parser.y b/Source/CParse/parser.y index ffba04884..70f420411 100644 --- a/Source/CParse/parser.y +++ b/Source/CParse/parser.y @@ -24,6 +24,7 @@ char cvsroot_parser_y[] = "$Id$"; #include "preprocessor.h" #include + /* We do this for portability */ #undef alloca #define alloca malloc @@ -67,6 +68,7 @@ String *currentComment; /* Location of the stored Doxygen Comment */ String *currentPostComment; /* Location of the stored Doxygen Post-Comment */ String *currentCComment; /* Location of the stored C Comment */ static Node *previousNode = NULL; /* Pointer to the previous node (for post comments) */ +static Node *currentNode = NULL; /* Pointer to the current node (for post comments) */ int isStructuralDoxygen(String *s){ char *slashPointer = Strchr(s, '\\'); @@ -106,27 +108,9 @@ static Node *new_node(const_String_or_char_ptr tag) { set_nodeType(n,tag); Setfile(n,cparse_file); Setline(n,cparse_line); - if(scan_doxygen_comments){ - /* Sets any post comments to the previous node */ - if(previousNode != NULL && currentPostComment != 0){ - String *copyPostComment = Copy(currentPostComment); - if (!Getattr(previousNode, "DoxygenComment")){ - Setattr(previousNode,"DoxygenComment",copyPostComment);} - else { - Append(copyPostComment, Getattr(previousNode, "DoxygenComment")); - Setattr(previousNode,"DoxygenComment",copyPostComment); - } - - currentPostComment = 0; - } - /* Sets Doxygen Comment if a Comment is Availible */ - if(currentComment != 0){ - String *copyComment = Copy(currentComment); - Setattr(n,"DoxygenComment",copyComment); - currentComment = 0; - } - previousNode = n; - } + /* Remember the previous node in case it will need a post-comment */ + previousNode = currentNode; + currentNode = n; return n; } @@ -205,6 +189,25 @@ static Node *copy_node(Node *n) { return nn; } +static void set_comment(Node *n, String *comment) { + Parm *p; + if (!n || !comment) + return; + + if (Getattr(n, "DoxygenComment")) + Append(Getattr(n, "DoxygenComment"), comment); + else { + Setattr(n, "DoxygenComment", comment); + /* This is the first comment, populate it with @params, if any */ + p = Getattr(n, "parms"); + while (p) { + if (Getattr(p, "DoxygenComment")) + Printv(comment, "\n@param ", Getattr(p, "name"), Getattr(p, "DoxygenComment"), NIL); + p=nextSibling(p); + } + } +} + /* ----------------------------------------------------------------------------- * Variables * ----------------------------------------------------------------------------- */ @@ -1496,6 +1499,7 @@ static void default_arguments(Node *n) { Node *function = n; if (function) { + ParmList *varargs = Getattr(function,"feature:varargs"); if (varargs) { /* Handles the %varargs directive by looking for "feature:varargs" and @@ -1793,6 +1797,7 @@ static void tag_nodes(Node *n, const_String_or_char_ptr attrname, DOH *value) { %type fname stringtype; %type featattr; %type doxygen_comment; +%type doxygen_comment_item; %type c_style_comment; %type doxygen_post_comment; %type doxygen_post_comment_item; @@ -1852,9 +1857,7 @@ interface : interface declaration { declaration : swig_directive { $$ = $1; } | c_declaration { $$ = $1; } | cpp_declaration { $$ = $1; } - | doxygen_comment { $$ = $1; } | c_style_comment { $$ = $1; } - | doxygen_post_comment { $$ = $1; } | SEMI { $$ = 0; } | error { $$ = 0; @@ -1878,6 +1881,14 @@ declaration : swig_directive { $$ = $1; } */ + | doxygen_comment declaration { + $$ = $2; + set_comment($2, $1); + } + | declaration doxygen_post_comment { + $$ = $1; + set_comment($1, $2); + } | error COPERATOR { $$ = 0; skip_decl(); @@ -3442,67 +3453,65 @@ c_constructor_decl : storage_class type LPAREN parms RPAREN ctor_end { A Doxygen Comment (a string in Doxygen Format) ------------------------------------------------------------ */ -doxygen_comment : DOXYGENSTRING - { - /* while(Strchr($1,'/') == Char($1)) - Replace($1,"/","",DOH_REPLACE_FIRST); */ - DohReplace($1, "/**", "", 0); - DohReplace($1, "/*!", "", 0); - DohReplace($1, "///", "", 0); - DohReplace($1, "*/", "", 0); +doxygen_comment_item : DOXYGENSTRING { + DohReplace($1, "/**", "", 0); + DohReplace($1, "/*!", "", 0); + DohReplace($1, "///", "", 0); + DohReplace($1, "//!", "", 0); + DohReplace($1, "*/", "", 0); - /* isStructuralDoxygen() is disabled, since no comment - appears in such case. Need to fix. (most commands are - not translatable to javadoc anyway) */ - if(0 && isStructuralDoxygen($1)){ - $$ = new_node("doxycomm"); - Setattr($$,"DoxygenComment",$1); - } - else { - if(currentComment != 0){ - Append(currentComment,$1); - } - else - currentComment = $1; - $$ = 0; - } - } - ; - - -doxygen_post_comment_item : DOXYGENPOSTSTRING - { - DohReplace($1, "///<", "", 0); - DohReplace($1, "/**<", "", 0); - DohReplace($1, "/*!<", "", 0); - DohReplace($1, "//!<", "", 0); - DohReplace($1, "*/", "", 0); - - $$ = $1; - } - ; - -doxygen_post_comment : doxygen_post_comment doxygen_post_comment_item - { - Append($1, $2); - $$ = $1; - } - | doxygen_post_comment_item - { - $$ = $1; - } - ; - -c_style_comment : C_COMMENT_STRING - { - if(currentCComment != 0){ - Append(currentCComment, $1); + /* isStructuralDoxygen() is disabled, since no comment + appears in such case. Need to fix. (most commands are + not translatable to javadoc anyway) */ + if(0 && isStructuralDoxygen($1)){ + $$ = new_node("doxycomm"); + Setattr($$,"DoxygenComment",$1); + } + else { + $$ = $1; } - else currentCComment = $1; - $$ = 0; - } - ; + } + ; + +doxygen_comment : doxygen_comment doxygen_comment_item { + Append($1, $2); + $$ = $1; + } + | doxygen_comment_item { + $$ = $1; + } + ; + + +doxygen_post_comment_item : DOXYGENPOSTSTRING { + DohReplace($1, "///<", "", 0); + DohReplace($1, "/**<", "", 0); + DohReplace($1, "/*!<", "", 0); + DohReplace($1, "//!<", "", 0); + DohReplace($1, "*/", "", 0); + + $$ = $1; + } + ; + +doxygen_post_comment : doxygen_post_comment doxygen_post_comment_item { + Append($1, $2); + $$ = $1; + } + | doxygen_post_comment_item { + $$ = $1; + } + ; + +c_style_comment : C_COMMENT_STRING { + if(currentCComment != 0){ + Append(currentCComment, $1); + } + else currentCComment = $1; + $$ = 0; + } + ; /* ====================================================================== * C++ Support @@ -4480,9 +4489,7 @@ cpp_member : c_declaration { $$ = $1; } | storage_class idcolon SEMI { $$ = 0; } | cpp_using_decl { $$ = $1; } | cpp_template_decl { $$ = $1; } - | doxygen_comment{ $$ = $1; } | c_style_comment{ $$ = $1; } - | doxygen_post_comment{ $$ = $1; } | cpp_catch_decl { $$ = 0; } | template_directive { $$ = $1; } | warn_directive { $$ = $1; } @@ -4490,6 +4497,14 @@ cpp_member : c_declaration { $$ = $1; } | fragment_directive {$$ = $1; } | types_directive {$$ = $1; } | SEMI { $$ = 0; } + | doxygen_comment cpp_member { + $$ = $2; + set_comment($2, $1); + } + | cpp_member doxygen_post_comment { + $$ = $1; + set_comment($1, $2); + } ; /* Possibly a constructor */ @@ -4890,41 +4905,18 @@ rawparms : parm ptail { set_nextSibling($1,$2); $$ = $1; } - | empty { $$ = 0; } + | empty { $$ = 0; previousNode = currentNode; currentNode=0; } ; ptail : COMMA parm ptail { set_nextSibling($2,$3); $$ = $2; - } - | COMMA doxygen_post_comment parm ptail { - set_nextSibling($3,$4); + } + | COMMA doxygen_post_comment parm ptail { + set_comment(previousNode, $2); + set_nextSibling($3,$4); $$ = $3; - - /** because function parameters are not nodes, - it must be the current function node, which - gets doxy comment set. - */ - - Setattr($3, "postComment", $2); - /* - currentPostComment = $2; - if (previousParmName != 0) { - String *param = NewString("\n@param "); - if (currentComment != 0) { - Append(currentComment, param); - Append(currentComment, previousParmName ); - Append(currentComment, currentPostComment); - } - else { - currentComment = param; - Append(currentComment, Getattr($3, "name") ); - Append(currentComment, currentPostComment); - } - } - currentPostComment = 0; - */ - } + } | empty { $$ = 0; } ; @@ -4932,45 +4924,18 @@ ptail : COMMA parm ptail { parm : rawtype parameter_declarator { SwigType_push($1,$2.type); $$ = NewParmWithoutFileLineInfo($1,$2.id); + previousNode = currentNode; + currentNode = $$; Setfile($$,cparse_file); Setline($$,cparse_line); if ($2.defarg) { Setattr($$,"value",$2.defarg); } } - | rawtype parameter_declarator doxygen_post_comment { - /** handles the last function parameter, which is not followed by comma */ - /* - String *param = NewString("@param "); - String *name = NewString($2.id); - - if (currentComment != 0) { - Append(currentComment, param); - } - else { - currentComment = param; - } - - Append(currentComment, name); - Append(currentComment, $3); - - if (currentPostComment != 0) { - } - currentPostComment = 0; - */ - - SwigType_push($1,$2.type); - $$ = NewParmWithoutFileLineInfo($1,$2.id); - Setattr($$, "lastParamPostComment", $3); - Setfile($$,cparse_file); - Setline($$,cparse_line); - if ($2.defarg) { - Setattr($$,"value",$2.defarg); - } - } - | TEMPLATE LESSTHAN cpptype GREATERTHAN cpptype idcolon def_args { $$ = NewParmWithoutFileLineInfo(NewStringf("template %s %s", $5,$6), 0); + previousNode = currentNode; + currentNode = $$; Setfile($$,cparse_file); Setline($$,cparse_line); if ($7.val) { @@ -4980,9 +4945,19 @@ parm : rawtype parameter_declarator { | PERIOD PERIOD PERIOD { SwigType *t = NewString("v(...)"); $$ = NewParmWithoutFileLineInfo(t, 0); + previousNode = currentNode; + currentNode = $$; Setfile($$,cparse_file); Setline($$,cparse_line); } + | doxygen_comment parm { + $$ = $2; + set_comment($2, $1); + } + | parm doxygen_post_comment { + $$ = $1; + set_comment($1, $2); + } ; valparms : rawvalparms { @@ -5848,66 +5823,15 @@ edecl : ID { Setattr($$,"value",$1); Delete(type); } - - | doxygen_comment ID EQUAL etype { - $$ = new_node("enumitem"); - Setattr($$,"name",$2); - Setattr($$,"enumvalue", $4.val); - if ($4.type == T_CHAR) { - SwigType *type = NewSwigType(T_CHAR); - Setattr($$,"value",NewStringf("\'%(escape)s\'", $4.val)); - Setattr($$,"type",type); - Delete(type); - } else { - SwigType *type = NewSwigType(T_INT); - Setattr($$,"value",$2); - Setattr($$,"type",type); - Delete(type); - } - SetFlag($$,"feature:immutable"); - } - - | doxygen_post_comment ID EQUAL etype { - currentPostComment = $1; - $$ = new_node("enumitem"); - Setattr($$,"name",$2); - Setattr($$,"enumvalue", $4.val); - if ($4.type == T_CHAR) { - SwigType *type = NewSwigType(T_CHAR); - Setattr($$,"value",NewStringf("\'%(escape)s\'", $4.val)); - Setattr($$,"type",type); - Delete(type); - } else { - SwigType *type = NewSwigType(T_INT); - Setattr($$,"value",$2); - Setattr($$,"type",type); - Delete(type); - } - SetFlag($$,"feature:immutable"); - } - - | doxygen_comment ID { - SwigType *type = NewSwigType(T_INT); - $$ = new_node("enumitem"); - Setattr($$,"name",$2); - Setattr($$,"type",type); - SetFlag($$,"feature:immutable"); - Delete(type); + | doxygen_comment edecl { + $$ = $2; + set_comment($2, $1); } - | doxygen_post_comment ID { - SwigType *type = NewSwigType(T_INT); - currentPostComment = $1; - $$ = new_node("enumitem"); - Setattr($$,"name",$2); - Setattr($$,"type",type); - SetFlag($$,"feature:immutable"); - Delete(type); + | doxygen_post_comment edecl { + $$ = $2; + set_comment(previousNode, $1); } - | doxygen_post_comment { - currentPostComment = $1; - $$ = $1; - } - | empty { $$ = 0; } + | empty { $$ = 0; previousNode = currentNode; currentNode = 0; } ; etype : expr { @@ -6557,3 +6481,5 @@ ParmList *Swig_cparse_parms(String *s, Node *file_line_node) { } + +struct S; From 46feb36cfb0f523161f02158c6727cce1a9861b3 Mon Sep 17 00:00:00 2001 From: Dmitry Kabak Date: Sun, 1 Jul 2012 18:42:43 +0000 Subject: [PATCH 056/314] Another fix for enums_simple case, now emitting comment git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2012-doxygen@13216 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Source/Modules/java.cxx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Source/Modules/java.cxx b/Source/Modules/java.cxx index 71de5380c..49a5e9901 100644 --- a/Source/Modules/java.cxx +++ b/Source/Modules/java.cxx @@ -1281,8 +1281,14 @@ public: } else { //translate and write javadoc comment for the enum itself if flagged if (doxygen && doxygenTranslator->hasDocumentation(n)){ - Printf(stdout, "Warning: Not emitting comment for %s, not supported in simple enums mode.\n", - Getattr(n, "unnamedinstance") ? "unnamed enum" : symname); + String *doxygen_comments=doxygenTranslator->getDocumentation(n); + if(comment_creation_chatter) + Printf(constants_code, "/* This was generated from enumDeclaration() */"); + Printf(constants_code, "/* Comment for enum %s */\n", + Getattr(n, "unnamedinstance") ? "" : symname); + Printf(constants_code, Char(doxygen_comments)); + Printf(constants_code, "\n"); + Delete(doxygen_comments); } else if (symname && !Getattr(n, "unnamedinstance")) Printf(constants_code, " // %s \n", symname); From 4c215eb33756199f8505bb9d7a6bbd471d70444e Mon Sep 17 00:00:00 2001 From: Dmitry Kabak Date: Mon, 2 Jul 2012 20:29:49 +0000 Subject: [PATCH 057/314] Refactored most of comments translating code for java, preliminary version, lots of bugs right now git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2012-doxygen@13217 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Examples/test-suite/common.mk | 1 + Examples/test-suite/doxygen_basic_translate.i | 16 ++ .../java/doxygen_basic_translate_runme.java | 94 +++++++++ .../src/JavaDocConverter.cpp | 194 ++++++++++-------- .../DoxygenTranslator/src/JavaDocConverter.h | 37 +++- 5 files changed, 249 insertions(+), 93 deletions(-) create mode 100644 Examples/test-suite/doxygen_basic_translate.i create mode 100644 Examples/test-suite/java/doxygen_basic_translate_runme.java diff --git a/Examples/test-suite/common.mk b/Examples/test-suite/common.mk index ec47ffaa0..ed2d74cd9 100644 --- a/Examples/test-suite/common.mk +++ b/Examples/test-suite/common.mk @@ -188,6 +188,7 @@ CPP_TEST_CASES += \ director_wombat \ disown \ doxygen_parsing \ + doxygen_basic_translate \ dynamic_cast \ empty \ enum_rename \ diff --git a/Examples/test-suite/doxygen_basic_translate.i b/Examples/test-suite/doxygen_basic_translate.i new file mode 100644 index 000000000..c961164d5 --- /dev/null +++ b/Examples/test-suite/doxygen_basic_translate.i @@ -0,0 +1,16 @@ +%module doxygen_basic_translate + +%inline %{ + +/** + * \brief Brief description. + * The comment text + * \author Some author + * \return Some number + * \sa function2 + */ +int function() +{ +} + +%} \ No newline at end of file diff --git a/Examples/test-suite/java/doxygen_basic_translate_runme.java b/Examples/test-suite/java/doxygen_basic_translate_runme.java new file mode 100644 index 000000000..7aee4221b --- /dev/null +++ b/Examples/test-suite/java/doxygen_basic_translate_runme.java @@ -0,0 +1,94 @@ + +import doxygen_basic_translate.*; +import com.sun.javadoc.*; +import java.util.HashMap; +import java.util.Map.Entry; +import java.util.Iterator; + +public class doxygen_basic_translate_runme { + static { + try { + System.loadLibrary("doxygen_basic_translate"); + } catch (UnsatisfiedLinkError e) { + System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e); + System.exit(1); + } + } + + static HashMap parsedComments = new HashMap(); + static HashMap wantedComments = new HashMap(); + + public static boolean start(RootDoc root) { + + /* + This method is called by 'javadoc' and gets the whole parsed + java file, we get comments and store them + */ + + ClassDoc[] classes = root.classes(); + + for (int i = 0; i < classes.length; i++) { + + if (classes[i].getRawCommentText().length() > 0) + parsedComments.put(classes[i].name(), classes[i].getRawCommentText()); + + MethodDoc[] methods = classes[i].methods(); + FieldDoc[] fields = classes[i].fields(); + FieldDoc[] constants = classes[i].enumConstants(); + + for (int j = 0; j < constants.length; j++) { + FieldDoc f = constants[j]; + if (f.getRawCommentText().length() > 0) + parsedComments.put(f.name(), f.getRawCommentText()); + } + for (int j = 0; j < fields.length; j++) { + FieldDoc f = fields[j]; + if (f.getRawCommentText().length() > 0) + parsedComments.put(f.name(), f.getRawCommentText()); + } + for (int j = 0; j < methods.length; j++) { + MethodDoc m = methods[j]; + if (m.getRawCommentText().length() > 0) + parsedComments.put(m.name(), m.getRawCommentText()); + } + } + return true; + } + + public static void main(String argv[]) + { + /* + Here we are using internal javadoc tool, it accepts the name of the class as paramterer, + and calls the start() method of that class with parsed information. + */ + com.sun.tools.javadoc.Main.execute("doxygen_basic_translate runtime test", + "doxygen_basic_translate_runme", new String[]{"-quiet", "doxygen_basic_translate"}); + + wantedComments.put("function", " Brief description. \n The comment text \n" + + " @author\tSome author \n" + + " @return\tSome number \n" + + " @see\tfunction2 \n"); + + int errorCount=0; + Iterator< Entry > it = parsedComments.entrySet().iterator(); + + while (it.hasNext()) + { + Entry e = (Entry) it.next(); + + if (!e.getValue().equals(wantedComments.get(e.getKey()))) { + System.out.println("Documentation comments for " + e.getKey() + " does not match: "); + System.out.println("\texpected:"+wantedComments.get(e.getKey())); + System.out.println("\tgot:\t"+e.getValue()); + errorCount++; + } + } + + if (parsedComments.size() != wantedComments.size()) { + System.out.println("Found " + (wantedComments.size()-parsedComments.size()) + " missed comment(s)!"); + errorCount++; + } + + System.exit(errorCount); + } +} diff --git a/Source/DoxygenTranslator/src/JavaDocConverter.cpp b/Source/DoxygenTranslator/src/JavaDocConverter.cpp index 812a6c34d..0c332c3b9 100644 --- a/Source/DoxygenTranslator/src/JavaDocConverter.cpp +++ b/Source/DoxygenTranslator/src/JavaDocConverter.cpp @@ -14,9 +14,64 @@ #include #define APPROX_LINE_LENGTH 64 //characters per line allowed #define TAB_SIZE 8 //current tab size in spaces -int printSortedTree2 = 0; //TODO {@link} {@linkplain} {@docRoot}, and other useful doxy commands that are not a javadoc tag +// define static escape table, it is filled in JavaDocConverter's constructor +std::map JavaDocConverter::escapeTable; + +void JavaDocConverter::fillEscapeTable() { + if (escapeTable.size()) // fill only once + return; + + escapeTable["&"] = "&"; + escapeTable["\'"] = "&apos"; + escapeTable["\""] = """; + escapeTable["<"] = "<"; + escapeTable[">"] = ">"; +} + + +JavaDocConverter::JavaDocConverter() : debug(false) { + + fillEscapeTable(); + + // these commands insert HTML tags + tagHandlers["c"] = &handleTagC; + tagHandlers["b"] = &handleTagB; + // these commands insert just a single char, all of them need to be escaped + tagHandlers["$"] = &handleTagChar; + tagHandlers["@"] = &handleTagChar; + tagHandlers["\\"] = &handleTagChar; + tagHandlers["<"] = &handleTagChar; + tagHandlers[">"] = &handleTagChar; + tagHandlers["&"] = &handleTagChar; + tagHandlers["#"] = &handleTagChar; + tagHandlers["%"] = &handleTagChar; + tagHandlers["~"] = &handleTagChar; + tagHandlers["\""] = &handleTagChar; + tagHandlers["."] = &handleTagChar; + tagHandlers["::"] = &handleTagChar; + // these commands are stripped out + tagHandlers["brief"] = &handleTagStrip; + tagHandlers["details"] = &handleTagStrip; + tagHandlers["partofdescription"] = &handleTagStrip; + // these commands are kept as-is, they are supported by JavaDoc + tagHandlers["sa"] = &handleTagSeeAll; + tagHandlers["see"] = &handleTagSame; + tagHandlers["param"] = &handleTagSame; + tagHandlers["return"] = &handleTagSame; + tagHandlers["throws"] = &handleTagSame; + tagHandlers["throw"] = &handleTagThrow; + tagHandlers["author"] = &handleTagSame; + tagHandlers["since"] = &handleTagSame; + tagHandlers["version"] = &handleTagSame; + tagHandlers["exception"] = &handleTagSame; + tagHandlers["deprecated"] = &handleTagSame; + // this command just prints it's contents + // (it is internal command of swig's parser, contains plain text) + tagHandlers["plainstd::string"] = &handleTagData; +} + std::string JavaDocConverter::formatCommand(std::string unformattedLine, int indent) { std::string formattedLines = "\n * "; int lastPosition = 0; @@ -56,99 +111,58 @@ std::string JavaDocConverter::formatCommand(std::string unformattedLine, int ind return formattedLines; } -/* Contains the conversions for tags - * could probably be much more efficient... - */ -std::string JavaDocConverter::javaDocFormat(DoxygenEntity & doxygenEntity) { - if (doxygenEntity.typeOfEntity.compare("partofdescription") == 0) { - return doxygenEntity.data; - } - if (doxygenEntity.typeOfEntity.compare("plainstd::string") == 0) { - return doxygenEntity.data; - } else if (doxygenEntity.typeOfEntity.compare("b") == 0) { - return "" + doxygenEntity.data + ""; - } else if (doxygenEntity.typeOfEntity.compare("c") == 0) { - return "" + doxygenEntity.data + ""; - } else if (doxygenEntity.typeOfEntity.compare("@") == 0) { - return "@"; - } else if (doxygenEntity.typeOfEntity.compare("\\") == 0) { - return "\\"; - } else if (doxygenEntity.typeOfEntity.compare("<") == 0) { - return "<"; - } else if (doxygenEntity.typeOfEntity.compare(">") == 0) { - return ">"; - } else if (doxygenEntity.typeOfEntity.compare("&") == 0) { - return "&"; - } else if (doxygenEntity.typeOfEntity.compare("#") == 0) { - return "#"; - } else if (doxygenEntity.typeOfEntity.compare("%") == 0) { - return "%"; - } else if (doxygenEntity.typeOfEntity.compare("~") == 0) { - return "~"; - } - return ""; -} - - std::string JavaDocConverter::translateSubtree(DoxygenEntity & doxygenEntity) { - std::string returnedString; - if (doxygenEntity.isLeaf) { - return javaDocFormat(doxygenEntity) + " "; - } else { - returnedString += javaDocFormat(doxygenEntity); - std::list < DoxygenEntity >::iterator p = doxygenEntity.entityList.begin(); - - while (p != doxygenEntity.entityList.end()) { - returnedString += translateSubtree(*p); - p++; - } + std::string translatedComment; + + if (doxygenEntity.isLeaf) + return translatedComment; + + std::list < DoxygenEntity >::iterator p = doxygenEntity.entityList.begin(); + while (p != doxygenEntity.entityList.end()) { + translateEntity(*p, translatedComment); + translateSubtree(*p); + p++; } - return returnedString; + + return translatedComment; } - -std::string JavaDocConverter::translateEntity(DoxygenEntity & doxyEntity) { - if (doxyEntity.typeOfEntity.compare("partofdescription") == 0) { - return formatCommand(std::string(translateSubtree(doxyEntity)), 0); - } - - if ((doxyEntity.typeOfEntity.compare("brief") == 0) || (doxyEntity.typeOfEntity.compare("details") == 0)) { - return formatCommand(std::string(translateSubtree(doxyEntity)), 0) + "\n * "; - - } else if (doxyEntity.typeOfEntity.compare("plainstd::string") == 0 || - doxyEntity.typeOfEntity.compare("deprecated") == 0 || - doxyEntity.typeOfEntity.compare("brief") == 0) { - return formatCommand(doxyEntity.data, 0) + "\n * "; - - } else if (doxyEntity.typeOfEntity.compare("see") == 0) { - return formatCommand(std::string("@" + doxyEntity.typeOfEntity + "\t\t" + translateSubtree(doxyEntity)), 2); - - } else if (doxyEntity.typeOfEntity.compare("return") == 0 - || doxyEntity.typeOfEntity.compare("author") == 0 - || doxyEntity.typeOfEntity.compare("param") == 0 - || doxyEntity.typeOfEntity.compare("throw") == 0 - || doxyEntity.typeOfEntity.compare("throws") == 0 - || doxyEntity.typeOfEntity.compare("since") == 0 - || doxyEntity.typeOfEntity.compare("version") == 0 - || doxyEntity.typeOfEntity.compare("exception") == 0 - || doxyEntity.typeOfEntity.compare("deprecated") == 0) { - - // this 'if' is a hack - convert doxyEntity.typeOfEntity at the time of parsing - if (doxyEntity.typeOfEntity.compare("throw") == 0) { - doxyEntity.typeOfEntity = "throws"; - } - return formatCommand(std::string("@" + doxyEntity.typeOfEntity + "\t" + translateSubtree(doxyEntity)), 2); - - } else if (doxyEntity.typeOfEntity.compare("sa") == 0) { - return formatCommand(std::string("@see\t\t" + translateSubtree(doxyEntity)), 2); - - } else { - return formatCommand(javaDocFormat(doxyEntity), 0); - } - - return ""; +void JavaDocConverter::translateEntity(DoxygenEntity& tag, std::string& translatedComment) { + // check if we have needed handler and call it + if (tagHandlers.find(tag.typeOfEntity)!=tagHandlers.end()) + tagHandlers[tag.typeOfEntity](this, tag, translatedComment); } +void JavaDocConverter::handleTagC(JavaDocConverter* converter, DoxygenEntity& tag, std::string& translatedComment) { + translatedComment += "" + tag.data + ""; +} +void JavaDocConverter::handleTagB(JavaDocConverter* converter, DoxygenEntity& tag, std::string& translatedComment) { + translatedComment += "" + tag.data + ""; +} +void JavaDocConverter::handleTagThrow(JavaDocConverter* converter, DoxygenEntity& tag, std::string& translatedComment) { + tag.typeOfEntity = "throws"; + handleTagSame(converter, tag, translatedComment); +} +void JavaDocConverter::handleTagSeeAll(JavaDocConverter* converter, DoxygenEntity& tag, std::string& translatedComment) { + tag.typeOfEntity = "see"; + handleTagSame(converter, tag, translatedComment); +} +void JavaDocConverter::handleTagChar(JavaDocConverter* converter, DoxygenEntity& tag, std::string& translatedComment) { + // escape it if we can, else just print + if (escapeTable.find(tag.typeOfEntity)!=escapeTable.end()) + translatedComment += escapeTable[tag.typeOfEntity]; + else + translatedComment += tag.typeOfEntity; +} +void JavaDocConverter::handleTagSame(JavaDocConverter* converter, DoxygenEntity& tag, std::string& translatedComment) { + translatedComment += converter->formatCommand(std::string("@" + tag.typeOfEntity + "\t" + converter->translateSubtree(tag)), 2); +} +void JavaDocConverter::handleTagStrip(JavaDocConverter* converter, DoxygenEntity& tag, std::string& translatedComment) { + translatedComment += converter->formatCommand(converter->translateSubtree(tag), 0); +} +void JavaDocConverter::handleTagData(JavaDocConverter* converter, DoxygenEntity& tag, std::string& translatedComment) { + translatedComment += tag.data + " "; +} String *JavaDocConverter::makeDocumentation(Node *node) { @@ -158,7 +172,7 @@ String *JavaDocConverter::makeDocumentation(Node *node) { return NULL; } - std::list < DoxygenEntity > entityList = DoxygenParser().createTree(Char(documentation)); + std::list < DoxygenEntity > entityList = parser.createTree(Char(documentation)); // entityList.sort(CompareDoxygenEntities()); sorting currently not used, // see CompareDoxygenEntities::operator() in DoxygenEntity.cpp @@ -171,7 +185,7 @@ String *JavaDocConverter::makeDocumentation(Node *node) { std::string javaDocString = "/**"; for (std::list < DoxygenEntity >::iterator entityIterator = entityList.begin(); entityIterator != entityList.end();) { - javaDocString += translateEntity(*entityIterator); + translateEntity(*entityIterator, javaDocString); entityIterator++; } diff --git a/Source/DoxygenTranslator/src/JavaDocConverter.h b/Source/DoxygenTranslator/src/JavaDocConverter.h index 1d54e2514..408ec4bb2 100644 --- a/Source/DoxygenTranslator/src/JavaDocConverter.h +++ b/Source/DoxygenTranslator/src/JavaDocConverter.h @@ -15,24 +15,55 @@ #define JAVADOCCONVERTER_H_ #include "DoxygenTranslator.h" +#include /* * A class to translate doxygen comments into JavaDoc style comments. */ class JavaDocConverter : public DoxygenTranslator { public: - JavaDocConverter() : debug(false) { - } + JavaDocConverter(); String *makeDocumentation(Node *node); protected: std::string formatCommand(std::string unformattedLine, int indent); - std::string translateEntity(DoxygenEntity & doxyEntity); std::string javaDocFormat(DoxygenEntity & doxygenEntity); std::string translateSubtree(DoxygenEntity & doxygenEntity); + void translateEntity(DoxygenEntity &tag, std::string &translatedComment); + + /* + * Typedef for the function that handles one tag + */ + typedef void (*tagHandler)(JavaDocConverter *converter, DoxygenEntity &tag, std::string &translatedComment); + /* + * Here comes various tag handlers + */ + static void handleTagC(JavaDocConverter *converter, DoxygenEntity &tag, std::string &translatedComment); + static void handleTagB(JavaDocConverter *converter, DoxygenEntity &tag, std::string &translatedComment); + static void handleTagThrow(JavaDocConverter *converter, DoxygenEntity &tag, std::string &translatedComment); + static void handleTagSeeAll(JavaDocConverter *converter, DoxygenEntity &tag, std::string &translatedComment); + /* + * Print the name of tag to the output, used for escape-commands + */ + static void handleTagChar(JavaDocConverter *converter, DoxygenEntity &tag, std::string &translatedComment); + /* + * Do not translate and print as-is + */ + static void handleTagSame(JavaDocConverter *converter, DoxygenEntity &tag, std::string &translatedComment); + /* + * Print only the content and strip original tag + */ + static void handleTagStrip(JavaDocConverter *converter, DoxygenEntity &tag, std::string &translatedComment); + /* + * Print only data part of code + */ + static void handleTagData(JavaDocConverter *converter, DoxygenEntity &tag, std::string &translatedComment); private: bool debug; + std::map tagHandlers; + static std::map escapeTable; + void fillEscapeTable(); }; #endif From 48e9052e223a41aad5a543b238a1bc2f58980ec0 Mon Sep 17 00:00:00 2001 From: Dmitry Kabak Date: Mon, 2 Jul 2012 21:43:15 +0000 Subject: [PATCH 058/314] Comment fixed git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2012-doxygen@13247 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Source/DoxygenTranslator/src/DoxygenTranslator.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Source/DoxygenTranslator/src/DoxygenTranslator.h b/Source/DoxygenTranslator/src/DoxygenTranslator.h index 023bdac89..7ddaba9a8 100644 --- a/Source/DoxygenTranslator/src/DoxygenTranslator.h +++ b/Source/DoxygenTranslator/src/DoxygenTranslator.h @@ -39,9 +39,7 @@ public: * Return the documentation for a given node formated for the correct * documentation system. The result is cached and translated only once. * @param node The node to extract and translate documentation for. - * @param format The documentation format to output. - * @param documentation The returned documentation string. - * @return A bool to indicate if there was documentation to return for the node. + * @return The resulted documentation string. */ String *getDocumentation(Node *node); /* From 2004ff23b913d398998a51427113de9af6888b64 Mon Sep 17 00:00:00 2001 From: Dmitry Kabak Date: Wed, 4 Jul 2012 21:47:57 +0000 Subject: [PATCH 059/314] Removed the unwanted header git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2012-doxygen@13251 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Source/Modules/python.cxx | 1 - 1 file changed, 1 deletion(-) diff --git a/Source/Modules/python.cxx b/Source/Modules/python.cxx index 40a50d45e..5d9a97952 100644 --- a/Source/Modules/python.cxx +++ b/Source/Modules/python.cxx @@ -21,7 +21,6 @@ static int treduce = SWIG_cparse_template_reduce(0); #include #include #include "../DoxygenTranslator/src/PyDocConverter.h" -#include "../../../swig/bug.h" #define PYSHADOW_MEMBER 0x2 #define WARN_PYTHON_MULTIPLE_INH 405 From 75961bc7d1965b4edf5a4dcd50ae23ae2d3b59fc Mon Sep 17 00:00:00 2001 From: Dmitry Kabak Date: Wed, 4 Jul 2012 22:04:52 +0000 Subject: [PATCH 060/314] Fixed double-search in map in JavaDocConverter.cpp git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2012-doxygen@13252 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Source/DoxygenTranslator/src/JavaDocConverter.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Source/DoxygenTranslator/src/JavaDocConverter.cpp b/Source/DoxygenTranslator/src/JavaDocConverter.cpp index 0c332c3b9..a3abf100a 100644 --- a/Source/DoxygenTranslator/src/JavaDocConverter.cpp +++ b/Source/DoxygenTranslator/src/JavaDocConverter.cpp @@ -129,8 +129,10 @@ std::string JavaDocConverter::translateSubtree(DoxygenEntity & doxygenEntity) { void JavaDocConverter::translateEntity(DoxygenEntity& tag, std::string& translatedComment) { // check if we have needed handler and call it - if (tagHandlers.find(tag.typeOfEntity)!=tagHandlers.end()) - tagHandlers[tag.typeOfEntity](this, tag, translatedComment); + std::map::iterator it; + it = tagHandlers.find(tag.typeOfEntity); + if (it!=tagHandlers.end()) + (*it).second(this, tag, translatedComment); } void JavaDocConverter::handleTagC(JavaDocConverter* converter, DoxygenEntity& tag, std::string& translatedComment) { From 13adf595ecd3c4481a14e68a9edaac4a49a0dc04 Mon Sep 17 00:00:00 2001 From: Dmitry Kabak Date: Wed, 4 Jul 2012 22:23:22 +0000 Subject: [PATCH 061/314] Refactored the code, got rid of global objects, got rid of tons of string comparisons git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2012-doxygen@13253 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- .../DoxygenTranslator/src/DoxygenCommands.h | 95 ++++ .../DoxygenTranslator/src/DoxygenParser.cpp | 410 +++++------------- Source/DoxygenTranslator/src/DoxygenParser.h | 215 +++++++++ 3 files changed, 410 insertions(+), 310 deletions(-) create mode 100644 Source/DoxygenTranslator/src/DoxygenCommands.h diff --git a/Source/DoxygenTranslator/src/DoxygenCommands.h b/Source/DoxygenTranslator/src/DoxygenCommands.h new file mode 100644 index 000000000..e1eba33f4 --- /dev/null +++ b/Source/DoxygenTranslator/src/DoxygenCommands.h @@ -0,0 +1,95 @@ + +#ifndef DOXYGENCOMMANDS_H +#define DOXYGENCOMMANDS_H + +const char *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", "throws", "todo", "tparam", "typedef", "union", "until", + "var", "verbatim", "verbinclude", "version", "warning", "weakgroup", "xmlonly", "xrefitem", "$", "@", "\\", "&", "~", "<", ">", "#", "%"}; + + +const char *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", "throws", "todo", "version", "warning", "xrefitem"}; +const int sectionIndicatorsSize = sizeof(sectionIndicators) / sizeof(*sectionIndicators); + +/* All of the doxygen commands divided up by how they are parsed */ +const char *simpleCommands[] = { + "n", "$", "@", "\\", "&", "~", "<", ">", "#", "%"}; +const int simpleCommandsSize = sizeof(simpleCommands) / sizeof(*simpleCommands); + +const char *ignoredSimpleCommands[] = { + "nothing at the moment"}; +const int ignoredSimpleCommandsSize = sizeof(ignoredSimpleCommands) / sizeof(*ignoredSimpleCommands); + +const char *commandWords[] = { + "a", "b", "c", "e", "em", "p", "def", "enum", "example", "package", "relates", "namespace", "relatesalso", "anchor", "dontinclude", "include", "includelineno"}; +const int commandWordsSize = sizeof(commandWords) / sizeof(*commandWords); + +const char *ignoredCommandWords[] = { + "copydoc", "copybrief", "copydetails", "verbinclude", "htmlinclude"}; +const int ignoredCommandWordsSize = sizeof(ignoredCommandWords) / sizeof(*ignoredCommandWords); + +const char *commandLines[] = { + "addindex", "fn", "name", "line", "var", "skipline", "typedef", "skip", "until", "property"}; +const int commandLinesSize = sizeof(commandLines) / sizeof(*commandLines); + +const char *ignoreCommandLines[] = { + "nothing at the moment"}; +const int ignoreCommandLinesSize = sizeof(ignoreCommandLines) / sizeof(*ignoreCommandLines); + +const char *commandParagraph[] = { + "partofdescription", "return", "remarks", "since", "test", "sa", "see", "pre", "post", "details", "invariant", + "deprecated", "date", "note", "warning", "version", "todo", "bug", "attention", "brief", "author"}; +const int commandParagraphSize = sizeof(commandParagraph) / sizeof(*commandParagraph); + +const char *ignoreCommandParagraphs[] = { + "nothing at the moment"}; +const int ignoreCommandParagraphsSize = sizeof(ignoreCommandParagraphs) / sizeof(*ignoreCommandParagraphs); + +const char *commandEndCommands[] = { + "code", "dot", "msc", "f$", "f[", "f{environment}{", "htmlonly", "latexonly", "manonly", "verbatim", "xmlonly", "cond", "if", "ifnot", "link"}; +const int commandEndCommandsSize = sizeof(commandEndCommands) / sizeof(*commandEndCommands); + +const char *commandWordParagraphs[] = { + "param", "tparam", "throw", "throws", "retval", "exception"}; +const int commandWordParagraphsSize = sizeof(commandWordParagraphs) / sizeof(*commandWordParagraphs); + +const char *commandWordLines[] = { + "page", "subsection", "subsubsection", "section", "paragraph", "defgroup"}; +const int commandWordLinesSize = sizeof(commandWordLines) / sizeof(*commandWordLines); + +const char *commandWordOWordOWords[] = { + "category", "class", "protocol", "interface", "struct", "union"}; +const int commandWordOWordOWordsSize = sizeof(commandWordOWordOWords) / sizeof(*commandWordOWordOWords); + +const char *commandOWords[] = { + "dir", "file", "cond"}; +const int commandOWordsSize = sizeof(commandOWords) / sizeof(*commandOWords); + +const char *commandErrorThrowings[] = { + "annotatedclassstd::list", "classhierarchy", "define", "functionindex", "header", + "headerfilestd::list", "inherit", "l", "postheader", "private", "privatesection", "protected", + "protectedsection", "public", "publicsection", "endcode", "enddot", "endmsc", "endhtmlonly", + "endlatexonly", "endmanonly", "endlink", "endverbatim", "endxmlonly", "f]", "f}", "endcond", "endif"}; +const int commandErrorThrowingsSize = sizeof(commandErrorThrowings) / sizeof(*commandErrorThrowings); + +const char *commandUniques[] = { + "xrefitem", "arg", "ingroup", "par", "headerfile", "overload", "weakgroup", "ref", "subpage", "dotfile", "image", "addtogroup", "li"}; +const int commandUniquesSize = sizeof(commandUniques) / sizeof(*commandUniques); + +#endif \ No newline at end of file diff --git a/Source/DoxygenTranslator/src/DoxygenParser.cpp b/Source/DoxygenTranslator/src/DoxygenParser.cpp index 030d8bee9..fe4dc5ec0 100644 --- a/Source/DoxygenTranslator/src/DoxygenParser.cpp +++ b/Source/DoxygenTranslator/src/DoxygenParser.cpp @@ -10,135 +10,96 @@ * ----------------------------------------------------------------------------- */ #include "DoxygenParser.h" -#include "TokenList.h" +#include "DoxygenCommands.h" + +#include + +// Define static class members +std::map DoxygenParser::doxygenCommands; +std::set DoxygenParser::doxygenSectionIndicators; -DoxygenParser::DoxygenParser() { +DoxygenParser::DoxygenParser() : noisy(true) { + fillTables(); } DoxygenParser::~DoxygenParser() { } -////////////////////////////////////////// -int noisy = 0; // set this to 1 for extra chatter from the parsing stage. -int addCommand(std::string currCommand, TokenList & tokList, std::list < DoxygenEntity > &aNewList); -std::list < DoxygenEntity > parse(std::list < Token >::iterator endParsingIndex, TokenList & tokList); +void DoxygenParser::fillTables() { + // run it only once + if (doxygenCommands.size()) + return; + + // fill in tables with data from DxygenCommands.h + for (int i = 0; i < simpleCommandsSize; i++) + doxygenCommands[simpleCommands[i]] = SIMPLECOMMAND; + for (int i = 0; i < ignoredSimpleCommandsSize; i++) + doxygenCommands[ignoredSimpleCommands[i]] = IGNOREDSIMPLECOMMAND; + + for (int i = 0; i < commandWordsSize; i++) + doxygenCommands[commandWords[i]] = COMMANDWORD; + for (int i = 0; i < ignoredCommandWordsSize; i++) + doxygenCommands[ignoredCommandWords[i]] = IGNOREDCOMMANDWORD; + + for (int i = 0; i < commandLinesSize; i++) + doxygenCommands[commandLines[i]] = COMMANDLINE; + for (int i = 0; i < ignoreCommandLinesSize; i++) + doxygenCommands[ignoreCommandLines[i]] = IGNOREDCOMMANDLINE; + + for (int i = 0; i < commandParagraphSize; i++) + doxygenCommands[commandParagraph[i]] = COMMANDPARAGRAPH; + for (int i = 0; i < ignoreCommandParagraphsSize; i++) + doxygenCommands[ignoreCommandParagraphs[i]] = IGNORECOMMANDPARAGRAPH; + + for (int i = 0; i < commandEndCommandsSize; i++) + doxygenCommands[commandEndCommands[i]] = COMMANDENDCOMMAND; + for (int i = 0; i < commandWordParagraphsSize; i++) + doxygenCommands[commandWordParagraphs[i]] = COMMANDWORDPARAGRAPH; + for (int i = 0; i < commandWordLinesSize; i++) + doxygenCommands[commandWordLines[i]] = COMMANDWORDLINE; + for (int i = 0; i < commandWordOWordOWordsSize; i++) + doxygenCommands[commandWordOWordOWords[i]] = COMMANDWORDOWORDWORD; + for (int i = 0; i < commandOWordsSize; i++) + doxygenCommands[commandOWords[i]] = COMMANDOWORD; + for (int i = 0; i < commandErrorThrowingsSize; i++) + doxygenCommands[commandErrorThrowings[i]] = COMMANDERRORTHROW; + for (int i = 0; i < commandUniquesSize; i++) + doxygenCommands[commandUniques[i]] = COMMANDUNIQUE; + + // fill section indicators command set + for (int i = 0; i < sectionIndicatorsSize; i++) + doxygenSectionIndicators.insert(sectionIndicators[i]); +} -////////////////////////////////////////// - - -std::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", "throws", "todo", "tparam", "typedef", "union", "until", - "var", "verbatim", "verbinclude", "version", "warning", "weakgroup", "xmlonly", "xrefitem", "$", "@", "\\", "&", "~", "<", ">", "#", "%"}; - - -std::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", "throws", "todo", "version", "warning", "xrefitem"}; - -/* All of the doxygen commands divided up by how they are parsed */ -std::string simpleCommands[] = { - "n", "$", "@", "\\", "&", "~", "<", ">", "#", "%"}; - -std::string ignoredSimpleCommands[] = { - "nothing at the moment"}; - -std::string commandWords[] = { - "a", "b", "c", "e", "em", "p", "def", "enum", "example", "package", "relates", "namespace", "relatesalso", "anchor", "dontinclude", "include", "includelineno"}; - -std::string ignoredCommandWords[] = { - "copydoc", "copybrief", "copydetails", "verbinclude", "htmlinclude"}; - -std::string commandLines[] = { - "addindex", "fn", "name", "line", "var", "skipline", "typedef", "skip", "until", "property"}; - -std::string ignoreCommandLines[] = { - "nothing at the moment"}; - -std::string commandParagraph[] = { - "partofdescription", "return", "remarks", "since", "test", "sa", "see", "pre", "post", "details", "invariant", - "deprecated", "date", "note", "warning", "version", "todo", "bug", "attention", "brief", "author"}; - -std::string ignoreCommandParagraphs[] = { - "nothing at the moment"}; - -std::string commandEndCommands[] = { - "code", "dot", "msc", "f$", "f[", "f{environment}{", "htmlonly", "latexonly", "manonly", "verbatim", "xmlonly", "cond", "if", "ifnot", "link"}; - -std::string commandWordParagraphs[] = { - "param", "tparam", "throw", "throws", "retval", "exception"}; - -std::string commandWordLines[] = { - "page", "subsection", "subsubsection", "section", "paragraph", "defgroup"}; - -std::string commandWordOWordOWords[] = { - "category", "class", "protocol", "interface", "struct", "union"}; - -std::string commandOWords[] = { - "dir", "file", "cond"}; - -std::string commandErrorThrowings[] = { - "annotatedclassstd::list", "classhierarchy", "define", "functionindex", "header", - "headerfilestd::list", "inherit", "l", "postheader", "private", "privatesection", "protected", - "protectedsection", "public", "publicsection", "endcode", "enddot", "endmsc", "endhtmlonly", - "endlatexonly", "endmanonly", "endlink", "endverbatim", "endxmlonly", "f]", "f}", "endcond", "endif"}; -std::string commandUniques[] = { - "xrefitem", "arg", "ingroup", "par", "headerfile", "overload", "weakgroup", "ref", "subpage", "dotfile", "image", "addtogroup", "li"}; - - -/* Changes a std::string to all lower case */ -std::string StringToLower(std::string stringToConvert) { +std::string DoxygenParser::StringToLower(std::string stringToConvert) { for (unsigned int i = 0; i < stringToConvert.length(); i++) { stringToConvert[i] = tolower(stringToConvert[i]); } return stringToConvert; //return the converted std::string } -/* finds out if a command exists (is a possible command) - * from the std::string array commandArray - * returns -1 if no match is found */ -int findCommand(std::string smallString) { +int DoxygenParser::findCommand(std::string smallString) { + std::map::iterator it; smallString = StringToLower(smallString); - int a; - for (unsigned i = 0; i < sizeof(commandArray) / sizeof(*commandArray); i++) { - if ((a = smallString.compare(commandArray[i])) == 0) { - return 101 + i; - } - } + // I'm not sure if we can really do so, because there are different commands + // in doxygenCommands and original commandArray + it = doxygenCommands.find(smallString); + if (it != doxygenCommands.end()) + return 1; return -1; } -/* isSectionIndicator returns a boolean if the command is a section indicator - * This is a helper method for finding the end of a paragraph - * by Doxygen's terms - */ -int isSectionIndicator(std::string smallString) { +int DoxygenParser::isSectionIndicator(std::string smallString) { smallString = StringToLower(smallString); - for (unsigned i = 0; i < sizeof(sectionIndicators) / sizeof(*sectionIndicators); i++) { - if (smallString.compare(sectionIndicators[i]) == 0) { - return 1; - } - } + std::set::iterator it; + it = doxygenSectionIndicators.find(smallString); + if (it != doxygenSectionIndicators.end()) + return 1; return 0; } -/* prints the parse tree */ -void printTree(std::list < DoxygenEntity > &rootList) { +void DoxygenParser::printTree(std::list < DoxygenEntity > &rootList) { std::list < DoxygenEntity >::iterator p = rootList.begin(); while (p != rootList.end()) { (*p).printEntity(0); @@ -146,81 +107,17 @@ void printTree(std::list < DoxygenEntity > &rootList) { } } -/* Determines how a command should be handled (what group it belongs to - * for parsing rules - */ -int commandBelongs(std::string theCommand) { +int DoxygenParser::commandBelongs(std::string theCommand) { std::string smallString = StringToLower(theCommand); //cout << " Looking for command " << theCommand << endl; - unsigned i = 0; - for (i = 0; i < sizeof(simpleCommands) / sizeof(*simpleCommands); i++) { - if (smallString.compare(simpleCommands[i]) == 0) - return SIMPLECOMMAND; - } - for (i = 0; i < sizeof(ignoredSimpleCommands) / sizeof(*ignoredSimpleCommands); i++) { - if (smallString.compare(ignoredSimpleCommands[i]) == 0) - return IGNOREDSIMPLECOMMAND; - } - for (i = 0; i < sizeof(commandWords) / sizeof(*commandWords); i++) { - if (smallString.compare(commandWords[i]) == 0) - return COMMANDWORD; - } - for (i = 0; i < sizeof(ignoredCommandWords) / sizeof(*ignoredCommandWords); i++) { - if (smallString.compare(ignoredCommandWords[i]) == 0) - return IGNOREDCOMMANDWORD; - } - for (i = 0; i < sizeof(commandLines) / sizeof(*commandLines); i++) { - if (smallString.compare(commandLines[i]) == 0) - return COMMANDLINE; - } - for (i = 0; i < sizeof(ignoreCommandLines) / sizeof(*ignoreCommandLines); i++) { - if (smallString.compare(ignoreCommandLines[i]) == 0) - return IGNOREDCOMMANDLINE; - } - for (i = 0; i < sizeof(commandParagraph) / sizeof(*commandParagraph); i++) { - if (smallString.compare(commandParagraph[i]) == 0) - return COMMANDPARAGRAPH; - } - for (i = 0; i < sizeof(ignoreCommandParagraphs) / sizeof(*ignoreCommandParagraphs); i++) { - if (smallString.compare(ignoreCommandParagraphs[i]) == 0) - return IGNORECOMMANDPARAGRAPH; - } - for (i = 0; i < sizeof(commandEndCommands) / sizeof(*commandEndCommands); i++) { - if (smallString.compare(commandEndCommands[i]) == 0) - return COMMANDENDCOMMAND; - } - for (i = 0; i < sizeof(commandWordParagraphs) / sizeof(*commandWordParagraphs); i++) { - if (smallString.compare(commandWordParagraphs[i]) == 0) - return COMMANDWORDPARAGRAPH; - } - for (i = 0; i < sizeof(commandWordLines) / sizeof(*commandWordLines); i++) { - if (smallString.compare(commandWordLines[i]) == 0) - return COMMANDWORDLINE; - } - for (i = 0; i < sizeof(commandWordOWordOWords) / sizeof(*commandWordOWordOWords); i++) { - if (smallString.compare(commandWordOWordOWords[i]) == 0) - return COMMANDWORDOWORDWORD; - } - for (i = 0; i < sizeof(commandOWords) / sizeof(*commandOWords); i++) { - if (smallString.compare(commandOWords[i]) == 0) - return COMMANDOWORD; - } - for (i = 0; i < sizeof(commandErrorThrowings) / sizeof(*commandErrorThrowings); i++) { - if (smallString.compare(commandErrorThrowings[i]) == 0) - return COMMANDERRORTHROW; - } - for (i = 0; i < sizeof(commandUniques) / sizeof(*commandUniques); i++) { - if (smallString.compare(commandUniques[i]) == 0) - return COMMANDUNIQUE; - } + std::map::iterator it; + it = doxygenCommands.find(smallString); + if (it!=doxygenCommands.end()) + return it->second; return 0; } -/* Returns the next word ON THE CURRENT LINE ONLY - * if a new line is encountered, returns a blank std::string. - * Updates the index it is given if success. - */ -std::string getNextWord(TokenList & tokList) { +std::string DoxygenParser::getNextWord(TokenList & tokList) { Token nextToken = tokList.peek(); if (nextToken.tokenType == PLAINSTRING) { nextToken = tokList.next(); @@ -229,10 +126,7 @@ std::string getNextWord(TokenList & tokList) { return ""; } -/* Returns the location of the end of the line as - * an iterator. - */ -std::list < Token >::iterator getOneLine(TokenList & tokList) { +std::list < Token >::iterator DoxygenParser::getOneLine(TokenList & tokList) { std::list < Token >::iterator endOfLine = tokList.iteratorCopy(); while (endOfLine != tokList.end()) { if ((*endOfLine).tokenType == END_LINE) { @@ -247,10 +141,7 @@ std::list < Token >::iterator getOneLine(TokenList & tokList) { return tokList.end(); } -/* Returns a properly formatted std::string -* up til ANY command or end of line is encountered. -*/ -std::string getStringTilCommand(TokenList & tokList) { +std::string DoxygenParser::getStringTilCommand(TokenList & tokList) { std::string description; if (tokList.peek().tokenType == 0) return ""; @@ -263,12 +154,7 @@ std::string getStringTilCommand(TokenList & tokList) { return description; } -/* Returns a properly formatted std::string -* up til the command specified is encountered -*/ -//TODO check that this behaves properly for formulas - -std::string getStringTilEndCommand(std::string theCommand, TokenList & tokList) { +std::string DoxygenParser::getStringTilEndCommand(std::string theCommand, TokenList & tokList) { std::string description; if (tokList.peek().tokenType == 0) return ""; @@ -279,11 +165,7 @@ std::string getStringTilEndCommand(std::string theCommand, TokenList & tokList) return description; } -/* Returns the end of a Paragraph as an iterator- -* Paragraph is defined in Doxygen to be a paragraph of text - * separated by either a structural command or a blank line -*/ -std::list < Token >::iterator getEndOfParagraph(TokenList & tokList) { +std::list < Token >::iterator DoxygenParser::getEndOfParagraph(TokenList & tokList) { std::list < Token >::iterator endOfParagraph = tokList.iteratorCopy(); while (endOfParagraph != tokList.end()) { if ((*endOfParagraph).tokenType == END_LINE) { @@ -311,11 +193,7 @@ std::list < Token >::iterator getEndOfParagraph(TokenList & tokList) { return tokList.end(); } -/* Returns the end of a section, defined as the first blank line OR first encounter of the same -* command. Example of this behaviour is \arg -* if no end is encountered, returns the last token of the std::list. -*/ -std::list < Token >::iterator getEndOfSection(std::string theCommand, TokenList & tokList) { +std::list < Token >::iterator DoxygenParser::getEndOfSection(std::string theCommand, TokenList & tokList) { std::list < Token >::iterator endOfParagraph = tokList.iteratorCopy(); while (endOfParagraph != tokList.end()) { if ((*endOfParagraph).tokenType == COMMAND) { @@ -336,13 +214,7 @@ std::list < Token >::iterator getEndOfSection(std::string theCommand, TokenList return tokList.end(); } -/* This method is for returning the end of 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", tokenList); - * If the end is never encountered, it returns the end of the std::list. - */ -std::list < Token >::iterator getEndCommand(std::string theCommand, TokenList & tokList) { +std::list < Token >::iterator DoxygenParser::getEndCommand(std::string theCommand, TokenList & tokList) { std::list < Token >::iterator endOfCommand = tokList.iteratorCopy(); while (endOfCommand != tokList.end()) { if ((*endOfCommand).tokenType == COMMAND) { @@ -356,48 +228,27 @@ std::list < Token >::iterator getEndCommand(std::string theCommand, TokenList & return tokList.end(); } -/* A specialty method for commands such as \arg that end at the end of a paragraph OR when another \arg is encountered - */ -//TODO getTilAnyCommand -std::list < Token >::iterator getTilAnyCommand(std::string theCommand, TokenList & tokList) { +std::list < Token >::iterator DoxygenParser::getTilAnyCommand(std::string theCommand, TokenList & tokList) { #pragma unused(theCommand,tokList) std::list < Token >::iterator anIterator; return anIterator; } - - - -/* Method for Adding a Simple Command - * Format: @command - * Plain commands, such as newline etc, they contain no other data - * \n \\ \@ \& \$ \# \< \> \% - */ -int addSimpleCommand(std::string theCommand, std::list < DoxygenEntity > &doxyList) { +int DoxygenParser::addSimpleCommand(std::string theCommand, std::list < DoxygenEntity > &doxyList) { if (noisy) cout << "Parsing " << theCommand << endl; doxyList.push_back(DoxygenEntity(theCommand)); return 1; } -/* NOT INCLUDED Simple Commands -* Format: @command -* Plain commands, such as newline etc, they contain no other data -*/ -int ignoreSimpleCommand(std::string theCommand, std::list < DoxygenEntity > &doxyList) { +int DoxygenParser::ignoreSimpleCommand(std::string theCommand, std::list < DoxygenEntity > &doxyList) { #pragma unused(doxyList) if (noisy) cout << "Not Adding " << theCommand << endl; return 1; } -/* CommandWord -* Format: @command -* Commands with a single WORD after then such as @b -* "a", "b", "c", "e", "em", "p", "def", "enum", "example", "package", -* "relates", "namespace", "relatesalso","anchor", "dontinclude", "include", "includelineno" -*/ -int addCommandWord(std::string theCommand, TokenList & tokList, std::list < DoxygenEntity > &doxyList) { +int DoxygenParser::addCommandWord(std::string theCommand, TokenList & tokList, std::list < DoxygenEntity > &doxyList) { if (noisy) cout << "Parsing " << theCommand << endl; std::string name = getNextWord(tokList); @@ -409,12 +260,7 @@ int addCommandWord(std::string theCommand, TokenList & tokList, std::list < Doxy return 0; } -/* NOT INCLUDED CommandWord -* Format: @command -* Commands with a single WORD after then such as @b -* "copydoc", "copybrief", "copydetails", "verbinclude", "htmlinclude" -*/ -int ignoreCommandWord(std::string theCommand, TokenList & tokList, std::list < DoxygenEntity > &doxyList) { +int DoxygenParser::ignoreCommandWord(std::string theCommand, TokenList & tokList, std::list < DoxygenEntity > &doxyList) { #pragma unused(doxyList) if (noisy) cout << "Not Adding " << theCommand << endl; @@ -426,12 +272,7 @@ int ignoreCommandWord(std::string theCommand, TokenList & tokList, std::list < D return 0; } -/* CommandLine -* Format: @command (line) -* Commands with a single LINE after then such as @var -* "addindex", "fn", "name", "line", "var", "skipline", "typedef", "skip", "until", "property" -*/ -int addCommandLine(std::string theCommand, TokenList & tokList, std::list < DoxygenEntity > &doxyList) { +int DoxygenParser::addCommandLine(std::string theCommand, TokenList & tokList, std::list < DoxygenEntity > &doxyList) { if (noisy) cout << "Parsing " << theCommand << endl; std::list < Token >::iterator endOfLine = getOneLine(tokList); @@ -440,12 +281,7 @@ int addCommandLine(std::string theCommand, TokenList & tokList, std::list < Doxy return 1; } -/* NOT INCLUDED CommandLine -* Format: @command (line) -* Commands with a single LINE after then such as @var -* -*/ -int ignoreCommandLine(std::string theCommand, TokenList & tokList, std::list < DoxygenEntity > &doxyList) { +int DoxygenParser::ignoreCommandLine(std::string theCommand, TokenList & tokList, std::list < DoxygenEntity > &doxyList) { #pragma unused(doxyList) if (noisy) cout << "Not Adding " << theCommand << endl; @@ -454,13 +290,7 @@ int ignoreCommandLine(std::string theCommand, TokenList & tokList, std::list < D return 1; } -/* CommandParagraph -* Format: @command {paragraph} -* Commands with a single paragraph after then such as @return -* "return", "remarks", "since", "test", "sa", "see", "pre", "post", "details", "invariant", -* "deprecated", "date", "note", "warning", "version", "todo", "bug", "attention", "brief", "arg", "author" -*/ -int addCommandParagraph(std::string theCommand, TokenList & tokList, std::list < DoxygenEntity > &doxyList) { +int DoxygenParser::addCommandParagraph(std::string theCommand, TokenList & tokList, std::list < DoxygenEntity > &doxyList) { if (noisy) cout << "Parsing " << theCommand << endl; std::list < Token >::iterator endOfParagraph = getEndOfParagraph(tokList); @@ -470,12 +300,7 @@ int addCommandParagraph(std::string theCommand, TokenList & tokList, std::list < return 1; } -/* CommandParagraph -* Format: @command {paragraph} -* Commands with a single LINE after then such as @var -* -*/ -int ignoreCommandParagraph(std::string theCommand, TokenList & tokList, std::list < DoxygenEntity > &doxyList) { +int DoxygenParser::ignoreCommandParagraph(std::string theCommand, TokenList & tokList, std::list < DoxygenEntity > &doxyList) { #pragma unused(doxyList) if (noisy) cout << "Not Adding " << theCommand << endl; @@ -484,27 +309,15 @@ int ignoreCommandParagraph(std::string theCommand, TokenList & tokList, std::lis return 1; } -/* Command EndCommand -* Format: @command and ends at @endcommand -* Commands that take in a block of text such as @code -* "code", "dot", "msc", "f$", "f[", "f{environment}{", "htmlonly", "latexonly", "manonly", -* "verbatim", "xmlonly", "cond", "if", "ifnot", "link" -* Returns 1 if success, 0 if the endcommand is never encountered. -*/ -int addCommandEndCommand(std::string theCommand, TokenList & tokList, std::list < DoxygenEntity > &doxyList) { +int DoxygenParser::addCommandEndCommand(std::string theCommand, TokenList & tokList, std::list < DoxygenEntity > &doxyList) { if (noisy) - cout << "Not Adding " << theCommand << endl; + cout << "Parsing " << theCommand << endl; std::string description = getStringTilEndCommand("end" + theCommand, tokList); doxyList.push_back(DoxygenEntity(theCommand, description)); return 1; } -/* CommandWordParagraph -* Format: @command {paragraph} -* Commands such as param - * "param", "tparam", "throw", "throws", "retval", "exception" -*/ -int addCommandWordParagraph(std::string theCommand, TokenList & tokList, std::list < DoxygenEntity > &doxyList) { +int DoxygenParser::addCommandWordParagraph(std::string theCommand, TokenList & tokList, std::list < DoxygenEntity > &doxyList) { if (noisy) cout << "Parsing " << theCommand << endl; std::string name = getNextWord(tokList); @@ -520,12 +333,7 @@ int addCommandWordParagraph(std::string theCommand, TokenList & tokList, std::li return 1; } -/* CommandWordLine -* Format: @command (line) -* Commands such as param -* "page", "subsection", "subsubsection", "section", "paragraph", "defgroup" -*/ -int addCommandWordLine(std::string theCommand, TokenList & tokList, std::list < DoxygenEntity > &doxyList) { +int DoxygenParser::addCommandWordLine(std::string theCommand, TokenList & tokList, std::list < DoxygenEntity > &doxyList) { if (noisy) cout << "Parsing " << theCommand << endl; std::string name = getNextWord(tokList); @@ -542,12 +350,7 @@ int addCommandWordLine(std::string theCommand, TokenList & tokList, std::list < //else cout << "No line followed " << theCommand << " command. Not added" << endl; } -/* Command Word Optional Word Optional Word -* Format: @command [] [] -* Commands such as class -* "category", "class", "protocol", "interface", "struct", "union" -*/ -int addCommandWordOWordOWord(std::string theCommand, TokenList & tokList, std::list < DoxygenEntity > &doxyList) { +int DoxygenParser::addCommandWordOWordOWord(std::string theCommand, TokenList & tokList, std::list < DoxygenEntity > &doxyList) { if (noisy) cout << "Parsing " << theCommand << endl; std::string name = getNextWord(tokList); @@ -567,12 +370,7 @@ int addCommandWordOWordOWord(std::string theCommand, TokenList & tokList, std::l return 1; } -/* Command Optional Word -* Format: @command [] -* Commands such as dir -* "dir", "file", "cond" -*/ -int addCommandOWord(std::string theCommand, TokenList & tokList, std::list < DoxygenEntity > &doxyList) { +int DoxygenParser::addCommandOWord(std::string theCommand, TokenList & tokList, std::list < DoxygenEntity > &doxyList) { if (noisy) cout << "Parsing " << theCommand << endl; std::string name = getNextWord(tokList); @@ -580,10 +378,7 @@ int addCommandOWord(std::string theCommand, TokenList & tokList, std::list < Dox return 1; } - /* Commands that should not be encountered (such as PHP only) - * goes til the end of line then returns - */ -int addCommandErrorThrow(std::string theCommand, TokenList & tokList, std::list < DoxygenEntity > &doxyList) { +int DoxygenParser::addCommandErrorThrow(std::string theCommand, TokenList & tokList, std::list < DoxygenEntity > &doxyList) { #pragma unused(doxyList) if (noisy) { cout << "Encountered :" << theCommand << endl; @@ -594,8 +389,7 @@ int addCommandErrorThrow(std::string theCommand, TokenList & tokList, std::list return 0; } -/* Adds the unique commands- different process for each unique command */ -int addCommandUnique(std::string theCommand, TokenList & tokList, std::list < DoxygenEntity > &doxyList) { +int DoxygenParser::addCommandUnique(std::string theCommand, TokenList & tokList, std::list < DoxygenEntity > &doxyList) { std::list < DoxygenEntity > aNewList; if (theCommand.compare("arg") == 0 || theCommand.compare("li") == 0) { std::list < Token >::iterator endOfSection = getEndOfSection(theCommand, tokList); @@ -722,11 +516,7 @@ int addCommandUnique(std::string theCommand, TokenList & tokList, std::list < Do return 0; } -/* 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(std::string commandString, TokenList & tokList, std::list < DoxygenEntity > &doxyList) { +int DoxygenParser::addCommand(std::string commandString, TokenList & tokList, std::list < DoxygenEntity > &doxyList) { std::string theCommand = StringToLower(commandString); if (theCommand.compare("plainstd::string") == 0) { std::string nextPhrase = getStringTilCommand(tokList); @@ -785,7 +575,7 @@ int addCommand(std::string commandString, TokenList & tokList, std::list < Doxyg return 0; } -std::list < DoxygenEntity > parse(std::list < Token >::iterator endParsingIndex, TokenList & tokList) { +std::list < DoxygenEntity > DoxygenParser::parse(std::list < Token >::iterator endParsingIndex, TokenList & tokList) { std::list < DoxygenEntity > aNewList; int currCommand; while (tokList.current() != endParsingIndex) { @@ -813,7 +603,7 @@ std::list < DoxygenEntity > parse(std::list < Token >::iterator endParsingIndex, return aNewList; } -std::list < DoxygenEntity > parseRoot(std::list < Token >::iterator endParsingIndex, TokenList & tokList) { +std::list < DoxygenEntity > DoxygenParser::parseRoot(std::list < Token >::iterator endParsingIndex, TokenList & tokList) { std::list < DoxygenEntity > aNewList; int currCommand; diff --git a/Source/DoxygenTranslator/src/DoxygenParser.h b/Source/DoxygenTranslator/src/DoxygenParser.h index 0c1f2d1cb..e64644725 100644 --- a/Source/DoxygenTranslator/src/DoxygenParser.h +++ b/Source/DoxygenTranslator/src/DoxygenParser.h @@ -13,12 +13,227 @@ #define DOXYGENPARSER_H_ #include #include +#include +#include #include "DoxygenEntity.h" +#include "TokenList.h" class DoxygenParser { public: DoxygenParser(); virtual ~DoxygenParser(); std::list < DoxygenEntity > createTree(std::string doxygen); +private: + + /* + *Changes a std::string to all lower case + */ + std::string StringToLower(std::string stringToConvert); + + /* + * Finds out if a command exists (is a possible command) + * returns -1 if no match is found + */ + int findCommand(std::string smallString); + /* + * isSectionIndicator returns a boolean if the command is a section indicator + * This is a helper method for finding the end of a paragraph + * by Doxygen's terms + */ + int isSectionIndicator(std::string smallString); + /* + * Determines how a command should be handled (what group it belongs to + * for parsing rules + */ + int commandBelongs(std::string theCommand); + + /* + *prints the parse tree + */ + void printTree(std::list < DoxygenEntity > &rootList); + + /* + * Returns the next word ON THE CURRENT LINE ONLY + * if a new line is encountered, returns a blank std::string. + * Updates the index it is given if success. + */ + std::string getNextWord(TokenList & tokList); + + /* + * Returns the location of the end of the line as + * an iterator. + */ + std::list < Token >::iterator getOneLine(TokenList & tokList); + + /* + * Returns a properly formatted std::string + * up til ANY command or end of line is encountered. + */ + std::string getStringTilCommand(TokenList & tokList); + + /* + * Returns a properly formatted std::string + * up til the command specified is encountered + */ + //TODO check that this behaves properly for formulas + std::string getStringTilEndCommand(std::string theCommand, TokenList & tokList); + + /* + * Returns the end of a Paragraph as an iterator- + * Paragraph is defined in Doxygen to be a paragraph of text + * separated by either a structural command or a blank line + */ + std::list < Token >::iterator getEndOfParagraph(TokenList & tokList); + + /* + * Returns the end of a section, defined as the first blank line OR first encounter of the same + * command. Example of this behaviour is \arg + * if no end is encountered, returns the last token of the std::list. + */ + std::list < Token >::iterator getEndOfSection(std::string theCommand, TokenList & tokList); + + /* + * This method is for returning the end of 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", tokenList); + * If the end is never encountered, it returns the end of the std::list. + */ + std::list < Token >::iterator getEndCommand(std::string theCommand, TokenList & tokList); + /* + * A specialty method for commands such as \arg that end at the end of a paragraph OR when another \arg is encountered + */ + //TODO getTilAnyCommand + std::list < Token >::iterator getTilAnyCommand(std::string theCommand, TokenList & tokList); + + /* + * Method for Adding a Simple Command + * Format: @command + * Plain commands, such as newline etc, they contain no other data + * \n \\ \@ \& \$ \# \< \> \% + */ + int addSimpleCommand(std::string theCommand, std::list < DoxygenEntity > &doxyList); + /* + * NOT INCLUDED Simple Commands + * Format: @command + * Plain commands, such as newline etc, they contain no other data + */ + int ignoreSimpleCommand(std::string theCommand, std::list < DoxygenEntity > &doxyList); + /* + * CommandWord + * Format: @command + * Commands with a single WORD after then such as @b + * "a", "b", "c", "e", "em", "p", "def", "enum", "example", "package", + * "relates", "namespace", "relatesalso","anchor", "dontinclude", "include", "includelineno" + */ + int addCommandWord(std::string theCommand, TokenList & tokList, std::list < DoxygenEntity > &doxyList); + /* + * NOT INCLUDED CommandWord + * Format: @command + * Commands with a single WORD after then such as @b + * "copydoc", "copybrief", "copydetails", "verbinclude", "htmlinclude" + */ + int ignoreCommandWord(std::string theCommand, TokenList & tokList, std::list < DoxygenEntity > &doxyList); + /* + * CommandLine + * Format: @command (line) + * Commands with a single LINE after then such as @var + * "addindex", "fn", "name", "line", "var", "skipline", "typedef", "skip", "until", "property" + */ + int addCommandLine(std::string theCommand, TokenList & tokList, std::list < DoxygenEntity > &doxyList); + /* + * NOT INCLUDED CommandLine + * Format: @command (line) + * Commands with a single LINE after then such as @var + */ + int ignoreCommandLine(std::string theCommand, TokenList & tokList, std::list < DoxygenEntity > &doxyList); + /* + * CommandParagraph + * Format: @command {paragraph} + * Commands with a single paragraph after then such as @return + * "return", "remarks", "since", "test", "sa", "see", "pre", "post", "details", "invariant", + * "deprecated", "date", "note", "warning", "version", "todo", "bug", "attention", "brief", "arg", "author" + */ + int addCommandParagraph(std::string theCommand, TokenList & tokList, std::list < DoxygenEntity > &doxyList); + /* + * CommandParagraph + * Format: @command {paragraph} + * Commands with a single LINE after then such as @var + */ + int ignoreCommandParagraph(std::string theCommand, TokenList & tokList, std::list < DoxygenEntity > &doxyList); + /* + * Command EndCommand + * Format: @command and ends at @endcommand + * Commands that take in a block of text such as @code + * "code", "dot", "msc", "f$", "f[", "f{environment}{", "htmlonly", "latexonly", "manonly", + * "verbatim", "xmlonly", "cond", "if", "ifnot", "link" + * Returns 1 if success, 0 if the endcommand is never encountered. + */ + int addCommandEndCommand(std::string theCommand, TokenList & tokList, std::list < DoxygenEntity > &doxyList); + /* + * CommandWordParagraph + * Format: @command {paragraph} + * Commands such as param + * "param", "tparam", "throw", "throws", "retval", "exception" + */ + int addCommandWordParagraph(std::string theCommand, TokenList & tokList, std::list < DoxygenEntity > &doxyList); + /* + * CommandWordLine + * Format: @command (line) + * Commands such as param + * "page", "subsection", "subsubsection", "section", "paragraph", "defgroup" + */ + int addCommandWordLine(std::string theCommand, TokenList & tokList, std::list < DoxygenEntity > &doxyList); + /* + * Command Word Optional Word Optional Word + * Format: @command [] [] + * Commands such as class + * "category", "class", "protocol", "interface", "struct", "union" + */ + int addCommandWordOWordOWord(std::string theCommand, TokenList & tokList, std::list < DoxygenEntity > &doxyList); + /* + * Command Optional Word + * Format: @command [] + * Commands such as dir + * "dir", "file", "cond" + */ + int addCommandOWord(std::string theCommand, TokenList & tokList, std::list < DoxygenEntity > &doxyList); + /* + * Commands that should not be encountered (such as PHP only) + * goes til the end of line then returns + */ + int addCommandErrorThrow(std::string theCommand, TokenList & tokList, std::list < DoxygenEntity > &doxyList); + /* + *Adds the unique commands- different process for each unique command + */ + int addCommandUnique(std::string theCommand, TokenList & tokList, std::list < DoxygenEntity > &doxyList); + /* + * 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(std::string commandString, TokenList & tokList, std::list < DoxygenEntity > &doxyList); + + std::list < DoxygenEntity > parse(std::list < Token >::iterator endParsingIndex, TokenList & tokList); + std::list < DoxygenEntity > parseRoot(std::list < Token >::iterator endParsingIndex, TokenList & tokList); + + /* + * Fill static doxygenCommands and sectionIndicators containers + */ + void fillTables(); + + /* + * Whether to print lots of debug info during parsing + */ + bool noisy; + + /* + * Map of Doxygen commands to determine if a string is a + * command and how it needs to be parsed + */ + static std::map doxygenCommands; + + static std::set doxygenSectionIndicators; }; #endif + From 4398d1aee4a7237f514d3cc54e2befa5dbd65d99 Mon Sep 17 00:00:00 2001 From: Dmitry Kabak Date: Wed, 4 Jul 2012 22:28:41 +0000 Subject: [PATCH 062/314] Fixed a bug in parser with doxygen commands like code, dot, verbatim and so on git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2012-doxygen@13254 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Source/DoxygenTranslator/src/DoxygenParser.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Source/DoxygenTranslator/src/DoxygenParser.cpp b/Source/DoxygenTranslator/src/DoxygenParser.cpp index fe4dc5ec0..b760fcf42 100644 --- a/Source/DoxygenTranslator/src/DoxygenParser.cpp +++ b/Source/DoxygenTranslator/src/DoxygenParser.cpp @@ -158,10 +158,14 @@ std::string DoxygenParser::getStringTilEndCommand(std::string theCommand, TokenL std::string description; if (tokList.peek().tokenType == 0) return ""; - while (tokList.peek().tokenString.compare(theCommand) != 0) { - Token currentToken = tokList.next(); - description = description + currentToken.tokenString + " "; + while (tokList.next().tokenString.compare(theCommand) != 0) { + //TODO: it won't output doxygen commands, need a way to fix it + if (tokList.peek().tokenType == PLAINSTRING) + description += tokList.peek().tokenString + " "; + if (tokList.peek().tokenType == END_LINE) + description += "\n"; } + tokList.next(); // eat the end command itself return description; } From f57b515ee7a813995b80913471769b8eb3666fee Mon Sep 17 00:00:00 2001 From: Dmitry Kabak Date: Wed, 4 Jul 2012 22:54:37 +0000 Subject: [PATCH 063/314] Got rid of translated comments cache, seems very inefficient git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2012-doxygen@13255 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- .../DoxygenTranslator/src/DoxygenTranslator.cpp | 16 +--------------- Source/DoxygenTranslator/src/DoxygenTranslator.h | 9 ++------- 2 files changed, 3 insertions(+), 22 deletions(-) diff --git a/Source/DoxygenTranslator/src/DoxygenTranslator.cpp b/Source/DoxygenTranslator/src/DoxygenTranslator.cpp index a733fdbc7..18cf24c85 100644 --- a/Source/DoxygenTranslator/src/DoxygenTranslator.cpp +++ b/Source/DoxygenTranslator/src/DoxygenTranslator.cpp @@ -15,12 +15,8 @@ #include "DoxygenTranslator.h" DoxygenTranslator::DoxygenTranslator() { - // Init the cache - resultsCache = NewHash(); } DoxygenTranslator::~DoxygenTranslator() { - // Clean up the cache - Delete(resultsCache); } bool DoxygenTranslator::hasDocumentation(Node *node) { @@ -37,17 +33,7 @@ String *DoxygenTranslator::getDocumentation(Node *node) { if (!hasDocumentation(node)) return 0; - // get from cache - String *resultedDocs = Getattr(resultsCache, getDoxygenComment(node)); - - if (resultedDocs) - return resultedDocs; - - // not found in cache, produce it - resultedDocs = makeDocumentation(node); - Setattr(resultsCache, getDoxygenComment(node), resultedDocs); - - return resultedDocs; + return makeDocumentation(node); } void DoxygenTranslator::printTree(std::list < DoxygenEntity > &entityList) { diff --git a/Source/DoxygenTranslator/src/DoxygenTranslator.h b/Source/DoxygenTranslator/src/DoxygenTranslator.h index 7ddaba9a8..637b30a9e 100644 --- a/Source/DoxygenTranslator/src/DoxygenTranslator.h +++ b/Source/DoxygenTranslator/src/DoxygenTranslator.h @@ -22,7 +22,7 @@ /* - * A class to translate doxygen comments attacted to parser nodes + * A class to translate doxygen comments attached to parser nodes * into alternative formats for use in code generated for target languages. */ class DoxygenTranslator { @@ -37,7 +37,7 @@ public: virtual ~ DoxygenTranslator(); /* * Return the documentation for a given node formated for the correct - * documentation system. The result is cached and translated only once. + * documentation system. * @param node The node to extract and translate documentation for. * @return The resulted documentation string. */ @@ -70,11 +70,6 @@ protected: * Doxygen parser object */ DoxygenParser parser; - - /* - * Cache of translated comments - */ - Hash *resultsCache; }; #endif From 501bb822e6be59b6407e1317c1e046a388aa22bf Mon Sep 17 00:00:00 2001 From: Dmitry Kabak Date: Wed, 4 Jul 2012 22:56:29 +0000 Subject: [PATCH 064/314] Oops, debug output should be left off by default git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2012-doxygen@13256 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Source/DoxygenTranslator/src/DoxygenParser.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/DoxygenTranslator/src/DoxygenParser.cpp b/Source/DoxygenTranslator/src/DoxygenParser.cpp index b760fcf42..07e61b590 100644 --- a/Source/DoxygenTranslator/src/DoxygenParser.cpp +++ b/Source/DoxygenTranslator/src/DoxygenParser.cpp @@ -19,7 +19,7 @@ std::map DoxygenParser::doxygenCommands; std::set DoxygenParser::doxygenSectionIndicators; -DoxygenParser::DoxygenParser() : noisy(true) { +DoxygenParser::DoxygenParser() : noisy(false) { fillTables(); } From 93a02cc728a5e5f2431445ae808c89d686f62aa5 Mon Sep 17 00:00:00 2001 From: Dmitry Kabak Date: Sat, 7 Jul 2012 13:40:41 +0000 Subject: [PATCH 065/314] Refactored doxygen tests git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2012-doxygen@13261 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Examples/test-suite/doxygen_basic_translate.i | 6 +- Examples/test-suite/doxygen_parsing_enums.i | 4 +- Examples/test-suite/java/commentParser.java | 71 ++++++++++++++++ .../java/doxygen_basic_translate_runme.java | 82 +++---------------- .../doxygen_parsing_enums_proper_runme.java | 75 ++--------------- .../doxygen_parsing_enums_simple_runme.java | 75 ++--------------- .../doxygen_parsing_enums_typesafe_runme.java | 75 ++--------------- ...oxygen_parsing_enums_typeunsafe_runme.java | 75 ++--------------- .../java/doxygen_parsing_runme.java | 71 ++-------------- 9 files changed, 131 insertions(+), 403 deletions(-) create mode 100644 Examples/test-suite/java/commentParser.java diff --git a/Examples/test-suite/doxygen_basic_translate.i b/Examples/test-suite/doxygen_basic_translate.i index c961164d5..af449eb49 100644 --- a/Examples/test-suite/doxygen_basic_translate.i +++ b/Examples/test-suite/doxygen_basic_translate.i @@ -3,7 +3,9 @@ %inline %{ /** - * \brief Brief description. + * \brief + * Brief description. + * * The comment text * \author Some author * \return Some number @@ -13,4 +15,4 @@ int function() { } -%} \ No newline at end of file +%} diff --git a/Examples/test-suite/doxygen_parsing_enums.i b/Examples/test-suite/doxygen_parsing_enums.i index 317abf384..222356510 100644 --- a/Examples/test-suite/doxygen_parsing_enums.i +++ b/Examples/test-suite/doxygen_parsing_enums.i @@ -9,7 +9,7 @@ enum E_TEST /** the first item */ E_TEST_ONE, E_TEST_TWO = 2, /**< the second */ - E_TEST_THREE = 2+1 + E_TEST_THREE = 2+1 /**< the last item */ }; -%} \ No newline at end of file +%} diff --git a/Examples/test-suite/java/commentParser.java b/Examples/test-suite/java/commentParser.java new file mode 100644 index 000000000..3877f5f4d --- /dev/null +++ b/Examples/test-suite/java/commentParser.java @@ -0,0 +1,71 @@ + +import com.sun.javadoc.*; +import java.util.HashMap; +import java.util.Map.Entry; +import java.util.Iterator; + +public class commentParser { + static HashMap parsedComments = new HashMap(); + + public static boolean start(RootDoc root) { + + /* + * This method is called by 'javadoc' and gets the whole parsed java + * file, we get comments and store them + */ + + ClassDoc[] classes = root.classes(); + + for (int i = 0; i < classes.length; i++) { + + if (classes[i].getRawCommentText().length() > 0) + parsedComments.put(classes[i].name(), + classes[i].getRawCommentText()); + + MethodDoc[] methods = classes[i].methods(); + FieldDoc[] fields = classes[i].fields(); + FieldDoc[] constants = classes[i].enumConstants(); + + for (int j = 0; j < constants.length; j++) { + FieldDoc f = constants[j]; + if (f.getRawCommentText().length() > 0) + parsedComments.put(f.name(), f.getRawCommentText()); + } + for (int j = 0; j < fields.length; j++) { + FieldDoc f = fields[j]; + if (f.getRawCommentText().length() > 0) + parsedComments.put(f.name(), f.getRawCommentText()); + } + for (int j = 0; j < methods.length; j++) { + MethodDoc m = methods[j]; + if (m.getRawCommentText().length() > 0) + parsedComments.put(m.name(), m.getRawCommentText()); + } + } + return true; + } + + public static int check(HashMap wantedComments) { + int errorCount=0; + Iterator< Entry > it = parsedComments.entrySet().iterator(); + + while (it.hasNext()) + { + Entry e = (Entry) it.next(); + + if (!e.getValue().equals(wantedComments.get(e.getKey()))) { + System.out.println("Documentation comments for " + e.getKey() + " does not match: "); + System.out.println("\texpected:"+wantedComments.get(e.getKey())); + System.out.println("\tgot:\t"+e.getValue()); + errorCount++; + } + } + + if (parsedComments.size() < wantedComments.size()) { + System.out.println("Found " + (wantedComments.size()-parsedComments.size()) + " missed comment(s)!"); + errorCount++; + } + + return errorCount; + } +} \ No newline at end of file diff --git a/Examples/test-suite/java/doxygen_basic_translate_runme.java b/Examples/test-suite/java/doxygen_basic_translate_runme.java index 7aee4221b..34270de56 100644 --- a/Examples/test-suite/java/doxygen_basic_translate_runme.java +++ b/Examples/test-suite/java/doxygen_basic_translate_runme.java @@ -2,8 +2,6 @@ import doxygen_basic_translate.*; import com.sun.javadoc.*; import java.util.HashMap; -import java.util.Map.Entry; -import java.util.Iterator; public class doxygen_basic_translate_runme { static { @@ -14,81 +12,25 @@ public class doxygen_basic_translate_runme { System.exit(1); } } - - static HashMap parsedComments = new HashMap(); - static HashMap wantedComments = new HashMap(); - - public static boolean start(RootDoc root) { - - /* - This method is called by 'javadoc' and gets the whole parsed - java file, we get comments and store them - */ - - ClassDoc[] classes = root.classes(); - - for (int i = 0; i < classes.length; i++) { - - if (classes[i].getRawCommentText().length() > 0) - parsedComments.put(classes[i].name(), classes[i].getRawCommentText()); - - MethodDoc[] methods = classes[i].methods(); - FieldDoc[] fields = classes[i].fields(); - FieldDoc[] constants = classes[i].enumConstants(); - - for (int j = 0; j < constants.length; j++) { - FieldDoc f = constants[j]; - if (f.getRawCommentText().length() > 0) - parsedComments.put(f.name(), f.getRawCommentText()); - } - for (int j = 0; j < fields.length; j++) { - FieldDoc f = fields[j]; - if (f.getRawCommentText().length() > 0) - parsedComments.put(f.name(), f.getRawCommentText()); - } - for (int j = 0; j < methods.length; j++) { - MethodDoc m = methods[j]; - if (m.getRawCommentText().length() > 0) - parsedComments.put(m.name(), m.getRawCommentText()); - } - } - return true; - } - + public static void main(String argv[]) { /* Here we are using internal javadoc tool, it accepts the name of the class as paramterer, and calls the start() method of that class with parsed information. */ + commentParser parser = new commentParser(); com.sun.tools.javadoc.Main.execute("doxygen_basic_translate runtime test", - "doxygen_basic_translate_runme", new String[]{"-quiet", "doxygen_basic_translate"}); + "commentParser", new String[]{"-quiet", "doxygen_basic_translate"}); + HashMap wantedComments = new HashMap(); + wantedComments.put("function", " Brief description. \n The comment text \n" + - " @author\tSome author \n" + - " @return\tSome number \n" + - " @see\tfunction2 \n"); - - int errorCount=0; - Iterator< Entry > it = parsedComments.entrySet().iterator(); - - while (it.hasNext()) - { - Entry e = (Entry) it.next(); - - if (!e.getValue().equals(wantedComments.get(e.getKey()))) { - System.out.println("Documentation comments for " + e.getKey() + " does not match: "); - System.out.println("\texpected:"+wantedComments.get(e.getKey())); - System.out.println("\tgot:\t"+e.getValue()); - errorCount++; - } - } - - if (parsedComments.size() != wantedComments.size()) { - System.out.println("Found " + (wantedComments.size()-parsedComments.size()) + " missed comment(s)!"); - errorCount++; - } - - System.exit(errorCount); + " @author\tSome author \n" + + " @return\tSome number \n" + + " @see\tfunction2 \n"); + + // and ask the parser to check comments for us + System.exit(parser.check(wantedComments)); } -} +} \ No newline at end of file diff --git a/Examples/test-suite/java/doxygen_parsing_enums_proper_runme.java b/Examples/test-suite/java/doxygen_parsing_enums_proper_runme.java index 503e2c68e..d3993f201 100644 --- a/Examples/test-suite/java/doxygen_parsing_enums_proper_runme.java +++ b/Examples/test-suite/java/doxygen_parsing_enums_proper_runme.java @@ -2,8 +2,6 @@ import doxygen_parsing_enums_proper.*; import com.sun.javadoc.*; import java.util.HashMap; -import java.util.Map.Entry; -import java.util.Iterator; public class doxygen_parsing_enums_proper_runme { static { @@ -14,80 +12,25 @@ public class doxygen_parsing_enums_proper_runme { System.exit(1); } } - - static HashMap parsedComments = new HashMap(); - static HashMap wantedComments = new HashMap(); - - public static boolean start(RootDoc root) { - - /* - This method is called by 'javadoc' and gets the whole parsed - java file, we get comments and store them - */ - - ClassDoc[] classes = root.classes(); - - for (int i = 0; i < classes.length; i++) { - - if (classes[i].getRawCommentText().length() > 0) - parsedComments.put(classes[i].name(), classes[i].getRawCommentText()); - - MethodDoc[] methods = classes[i].methods(); - FieldDoc[] fields = classes[i].fields(); - FieldDoc[] constants = classes[i].enumConstants(); - - for (int j = 0; j < constants.length; j++) { - FieldDoc f = constants[j]; - if (f.getRawCommentText().length() > 0) - parsedComments.put(f.name(), f.getRawCommentText()); - } - for (int j = 0; j < fields.length; j++) { - FieldDoc f = fields[j]; - if (f.getRawCommentText().length() > 0) - parsedComments.put(f.name(), f.getRawCommentText()); - } - for (int j = 0; j < methods.length; j++) { - MethodDoc m = methods[j]; - if (m.getRawCommentText().length() > 0) - parsedComments.put(m.name(), m.getRawCommentText()); - } - } - return true; - } - + public static void main(String argv[]) { /* Here we are using internal javadoc tool, it accepts the name of the class as paramterer, and calls the start() method of that class with parsed information. */ + commentParser parser = new commentParser(); com.sun.tools.javadoc.Main.execute("doxygen_parsing_enums_proper runtime test", - "doxygen_parsing_enums_proper_runme", new String[]{"-quiet", "doxygen_parsing_enums_proper"}); + "commentParser", new String[]{"-quiet", "doxygen_parsing_enums_proper"}); + HashMap wantedComments = new HashMap(); + wantedComments.put("E_TEST", " Test enumeration \n"); wantedComments.put("E_TEST_ONE", " the first item \n"); wantedComments.put("E_TEST_TWO", " the second \n"); - - int errorCount=0; - Iterator< Entry > it = parsedComments.entrySet().iterator(); - - while (it.hasNext()) - { - Entry e = (Entry) it.next(); - - if (!e.getValue().equals(wantedComments.get(e.getKey()))) { - System.out.println("Documentation comments for " + e.getKey() + " does not match: "); - System.out.println("\texpected:"+wantedComments.get(e.getKey())); - System.out.println("\tgot:\t"+e.getValue()); - errorCount++; - } - } - - if (parsedComments.size() != wantedComments.size()) { - System.out.println("Found " + (wantedComments.size()-parsedComments.size()) + " missed comment(s)!"); - errorCount++; - } - - System.exit(errorCount); + wantedComments.put("E_TEST_THREE", " the last item \n"); + + // and ask the parser to check comments for us + System.exit(parser.check(wantedComments)); } } diff --git a/Examples/test-suite/java/doxygen_parsing_enums_simple_runme.java b/Examples/test-suite/java/doxygen_parsing_enums_simple_runme.java index ee422e2c4..1dffe4466 100644 --- a/Examples/test-suite/java/doxygen_parsing_enums_simple_runme.java +++ b/Examples/test-suite/java/doxygen_parsing_enums_simple_runme.java @@ -2,8 +2,6 @@ import doxygen_parsing_enums_simple.*; import com.sun.javadoc.*; import java.util.HashMap; -import java.util.Map.Entry; -import java.util.Iterator; public class doxygen_parsing_enums_simple_runme { static { @@ -14,79 +12,24 @@ public class doxygen_parsing_enums_simple_runme { System.exit(1); } } - - static HashMap parsedComments = new HashMap(); - static HashMap wantedComments = new HashMap(); - - public static boolean start(RootDoc root) { - - /* - This method is called by 'javadoc' and gets the whole parsed - java file, we get comments and store them - */ - - ClassDoc[] classes = root.classes(); - - for (int i = 0; i < classes.length; i++) { - - if (classes[i].getRawCommentText().length() > 0) - parsedComments.put(classes[i].name(), classes[i].getRawCommentText()); - - MethodDoc[] methods = classes[i].methods(); - FieldDoc[] fields = classes[i].fields(); - FieldDoc[] constants = classes[i].enumConstants(); - - for (int j = 0; j < constants.length; j++) { - FieldDoc f = constants[j]; - if (f.getRawCommentText().length() > 0) - parsedComments.put(f.name(), f.getRawCommentText()); - } - for (int j = 0; j < fields.length; j++) { - FieldDoc f = fields[j]; - if (f.getRawCommentText().length() > 0) - parsedComments.put(f.name(), f.getRawCommentText()); - } - for (int j = 0; j < methods.length; j++) { - MethodDoc m = methods[j]; - if (m.getRawCommentText().length() > 0) - parsedComments.put(m.name(), m.getRawCommentText()); - } - } - return true; - } - + public static void main(String argv[]) { /* Here we are using internal javadoc tool, it accepts the name of the class as paramterer, and calls the start() method of that class with parsed information. */ + commentParser parser = new commentParser(); com.sun.tools.javadoc.Main.execute("doxygen_parsing_enums_simple runtime test", - "doxygen_parsing_enums_simple_runme", new String[]{"-quiet", "doxygen_parsing_enums_simple"}); + "commentParser", new String[]{"-quiet", "doxygen_parsing_enums_simple"}); + HashMap wantedComments = new HashMap(); + wantedComments.put("E_TEST_ONE", " the first item \n"); wantedComments.put("E_TEST_TWO", " the second \n"); - - int errorCount=0; - Iterator< Entry > it = parsedComments.entrySet().iterator(); - - while (it.hasNext()) - { - Entry e = (Entry) it.next(); - - if (!e.getValue().equals(wantedComments.get(e.getKey()))) { - System.out.println("Documentation comments for " + e.getKey() + " does not match: "); - System.out.println("\texpected:"+wantedComments.get(e.getKey())); - System.out.println("\tgot:\t"+e.getValue()); - errorCount++; - } - } - - if (parsedComments.size() != wantedComments.size()) { - System.out.println("Found " + (wantedComments.size()-parsedComments.size()) + " missed comment(s)!"); - errorCount++; - } - - System.exit(errorCount); + wantedComments.put("E_TEST_THREE", " the last item \n"); + + // and ask the parser to check comments for us + System.exit(parser.check(wantedComments)); } } diff --git a/Examples/test-suite/java/doxygen_parsing_enums_typesafe_runme.java b/Examples/test-suite/java/doxygen_parsing_enums_typesafe_runme.java index 8d87c82d0..5aed9327e 100644 --- a/Examples/test-suite/java/doxygen_parsing_enums_typesafe_runme.java +++ b/Examples/test-suite/java/doxygen_parsing_enums_typesafe_runme.java @@ -2,8 +2,6 @@ import doxygen_parsing_enums_typesafe.*; import com.sun.javadoc.*; import java.util.HashMap; -import java.util.Map.Entry; -import java.util.Iterator; public class doxygen_parsing_enums_typesafe_runme { static { @@ -14,80 +12,25 @@ public class doxygen_parsing_enums_typesafe_runme { System.exit(1); } } - - static HashMap parsedComments = new HashMap(); - static HashMap wantedComments = new HashMap(); - - public static boolean start(RootDoc root) { - - /* - This method is called by 'javadoc' and gets the whole parsed - java file, we get comments and store them - */ - - ClassDoc[] classes = root.classes(); - - for (int i = 0; i < classes.length; i++) { - - if (classes[i].getRawCommentText().length() > 0) - parsedComments.put(classes[i].name(), classes[i].getRawCommentText()); - - MethodDoc[] methods = classes[i].methods(); - FieldDoc[] fields = classes[i].fields(); - FieldDoc[] constants = classes[i].enumConstants(); - - for (int j = 0; j < constants.length; j++) { - FieldDoc f = constants[j]; - if (f.getRawCommentText().length() > 0) - parsedComments.put(f.name(), f.getRawCommentText()); - } - for (int j = 0; j < fields.length; j++) { - FieldDoc f = fields[j]; - if (f.getRawCommentText().length() > 0) - parsedComments.put(f.name(), f.getRawCommentText()); - } - for (int j = 0; j < methods.length; j++) { - MethodDoc m = methods[j]; - if (m.getRawCommentText().length() > 0) - parsedComments.put(m.name(), m.getRawCommentText()); - } - } - return true; - } - + public static void main(String argv[]) { /* Here we are using internal javadoc tool, it accepts the name of the class as paramterer, and calls the start() method of that class with parsed information. */ + commentParser parser = new commentParser(); com.sun.tools.javadoc.Main.execute("doxygen_parsing_enums_typesafe runtime test", - "doxygen_parsing_enums_typesafe_runme", new String[]{"-quiet", "doxygen_parsing_enums_typesafe"}); + "commentParser", new String[]{"-quiet", "doxygen_parsing_enums_typesafe"}); + HashMap wantedComments = new HashMap(); + wantedComments.put("E_TEST", " Test enumeration \n"); wantedComments.put("E_TEST_ONE", " the first item \n"); wantedComments.put("E_TEST_TWO", " the second \n"); - - int errorCount=0; - Iterator< Entry > it = parsedComments.entrySet().iterator(); - - while (it.hasNext()) - { - Entry e = (Entry) it.next(); - - if (!e.getValue().equals(wantedComments.get(e.getKey()))) { - System.out.println("Documentation comments for " + e.getKey() + " does not match: "); - System.out.println("\texpected:"+wantedComments.get(e.getKey())); - System.out.println("\tgot:\t"+e.getValue()); - errorCount++; - } - } - - if (parsedComments.size() != wantedComments.size()) { - System.out.println("Found " + (wantedComments.size()-parsedComments.size()) + " missed comment(s)!"); - errorCount++; - } - - System.exit(errorCount); + wantedComments.put("E_TEST_THREE", " the last item \n"); + + // and ask the parser to check comments for us + System.exit(parser.check(wantedComments)); } } diff --git a/Examples/test-suite/java/doxygen_parsing_enums_typeunsafe_runme.java b/Examples/test-suite/java/doxygen_parsing_enums_typeunsafe_runme.java index a01007db1..44405f837 100644 --- a/Examples/test-suite/java/doxygen_parsing_enums_typeunsafe_runme.java +++ b/Examples/test-suite/java/doxygen_parsing_enums_typeunsafe_runme.java @@ -2,8 +2,6 @@ import doxygen_parsing_enums_typeunsafe.*; import com.sun.javadoc.*; import java.util.HashMap; -import java.util.Map.Entry; -import java.util.Iterator; public class doxygen_parsing_enums_typeunsafe_runme { static { @@ -14,80 +12,25 @@ public class doxygen_parsing_enums_typeunsafe_runme { System.exit(1); } } - - static HashMap parsedComments = new HashMap(); - static HashMap wantedComments = new HashMap(); - - public static boolean start(RootDoc root) { - - /* - This method is called by 'javadoc' and gets the whole parsed - java file, we get comments and store them - */ - - ClassDoc[] classes = root.classes(); - - for (int i = 0; i < classes.length; i++) { - - if (classes[i].getRawCommentText().length() > 0) - parsedComments.put(classes[i].name(), classes[i].getRawCommentText()); - - MethodDoc[] methods = classes[i].methods(); - FieldDoc[] fields = classes[i].fields(); - FieldDoc[] constants = classes[i].enumConstants(); - - for (int j = 0; j < constants.length; j++) { - FieldDoc f = constants[j]; - if (f.getRawCommentText().length() > 0) - parsedComments.put(f.name(), f.getRawCommentText()); - } - for (int j = 0; j < fields.length; j++) { - FieldDoc f = fields[j]; - if (f.getRawCommentText().length() > 0) - parsedComments.put(f.name(), f.getRawCommentText()); - } - for (int j = 0; j < methods.length; j++) { - MethodDoc m = methods[j]; - if (m.getRawCommentText().length() > 0) - parsedComments.put(m.name(), m.getRawCommentText()); - } - } - return true; - } - + public static void main(String argv[]) { /* Here we are using internal javadoc tool, it accepts the name of the class as paramterer, and calls the start() method of that class with parsed information. */ + commentParser parser = new commentParser(); com.sun.tools.javadoc.Main.execute("doxygen_parsing_enums_typeunsafe runtime test", - "doxygen_parsing_enums_typeunsafe_runme", new String[]{"-quiet", "doxygen_parsing_enums_typeunsafe"}); + "commentParser", new String[]{"-quiet", "doxygen_parsing_enums_typeunsafe"}); + HashMap wantedComments = new HashMap(); + wantedComments.put("E_TEST", " Test enumeration \n"); wantedComments.put("E_TEST_ONE", " the first item \n"); wantedComments.put("E_TEST_TWO", " the second \n"); - - int errorCount=0; - Iterator< Entry > it = parsedComments.entrySet().iterator(); - - while (it.hasNext()) - { - Entry e = (Entry) it.next(); - - if (!e.getValue().equals(wantedComments.get(e.getKey()))) { - System.out.println("Documentation comments for " + e.getKey() + " does not match: "); - System.out.println("\texpected:"+wantedComments.get(e.getKey())); - System.out.println("\tgot:\t"+e.getValue()); - errorCount++; - } - } - - if (parsedComments.size() != wantedComments.size()) { - System.out.println("Found " + (wantedComments.size()-parsedComments.size()) + " missed comment(s)!"); - errorCount++; - } - - System.exit(errorCount); + wantedComments.put("E_TEST_THREE", " the last item \n"); + + // and ask the parser to check comments for us + System.exit(parser.check(wantedComments)); } } diff --git a/Examples/test-suite/java/doxygen_parsing_runme.java b/Examples/test-suite/java/doxygen_parsing_runme.java index 909de9312..ae426da58 100644 --- a/Examples/test-suite/java/doxygen_parsing_runme.java +++ b/Examples/test-suite/java/doxygen_parsing_runme.java @@ -2,8 +2,6 @@ import doxygen_parsing.*; import com.sun.javadoc.*; import java.util.HashMap; -import java.util.Map.Entry; -import java.util.Iterator; public class doxygen_parsing_runme { static { @@ -15,55 +13,18 @@ public class doxygen_parsing_runme { } } - static HashMap parsedComments = new HashMap(); - static HashMap wantedComments = new HashMap(); - - public static boolean start(RootDoc root) { - - /* - This method is called by 'javadoc' and gets the whole parsed - java file, we get comments and store them - */ - - ClassDoc[] classes = root.classes(); - - for (int i = 0; i < classes.length; i++) { - - if (classes[i].getRawCommentText().length() > 0) - parsedComments.put(classes[i].name(), classes[i].getRawCommentText()); - - MethodDoc[] methods = classes[i].methods(); - FieldDoc[] fields = classes[i].fields(); - FieldDoc[] constants = classes[i].enumConstants(); - - for (int j = 0; j < constants.length; j++) { - FieldDoc f = constants[j]; - if (f.getRawCommentText().length() > 0) - parsedComments.put(f.name(), f.getRawCommentText()); - } - for (int j = 0; j < fields.length; j++) { - FieldDoc f = fields[j]; - if (f.getRawCommentText().length() > 0) - parsedComments.put(f.name(), f.getRawCommentText()); - } - for (int j = 0; j < methods.length; j++) { - MethodDoc m = methods[j]; - if (m.getRawCommentText().length() > 0) - parsedComments.put(m.name(), m.getRawCommentText()); - } - } - return true; - } - public static void main(String argv[]) { /* Here we are using internal javadoc tool, it accepts the name of the class as paramterer, and calls the start() method of that class with parsed information. */ + commentParser parser = new commentParser(); com.sun.tools.javadoc.Main.execute("doxygen_parsing runtime test", - "doxygen_parsing_runme", new String[]{"-quiet", "doxygen_parsing"}); + "commentParser", new String[]{"-quiet", "doxygen_parsing"}); + HashMap wantedComments = new HashMap(); + wantedComments.put("simpleFunction", " This is simple comment for a function \n"); wantedComments.put("CSimpleClass", " This is simple comment for a class \n"); @@ -85,27 +46,7 @@ public class doxygen_parsing_runme { wantedComments.put("setSimpleVarFive", " This is a post comment \n"); wantedComments.put("getSimpleVarFive", " This is a post comment \n"); - - int errorCount=0; - Iterator< Entry > it = parsedComments.entrySet().iterator(); - - while (it.hasNext()) - { - Entry e = (Entry) it.next(); - - if (!e.getValue().equals(wantedComments.get(e.getKey()))) { - System.out.println("Documentation comments for " + e.getKey() + " does not match: "); - System.out.println("\texpected:"+wantedComments.get(e.getKey())); - System.out.println("\tgot:\t"+e.getValue()); - errorCount++; - } - } - - if (parsedComments.size() != wantedComments.size()) { - System.out.println("Found " + (wantedComments.size()-parsedComments.size()) + " missed comment(s)!"); - errorCount++; - } - - System.exit(errorCount); + // and ask the parser to check comments for us + System.exit(parser.check(wantedComments)); } } From 293c5cfc1fea4153660fc15776ce0ae71c7cb269 Mon Sep 17 00:00:00 2001 From: Dmitry Kabak Date: Sat, 7 Jul 2012 13:43:19 +0000 Subject: [PATCH 066/314] Added support for commenting the last enum item in parser.y git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2012-doxygen@13262 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Source/CParse/parser.y | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Source/CParse/parser.y b/Source/CParse/parser.y index 70f420411..4bf63b40f 100644 --- a/Source/CParse/parser.y +++ b/Source/CParse/parser.y @@ -5831,6 +5831,10 @@ edecl : ID { $$ = $2; set_comment(previousNode, $1); } + | edecl doxygen_post_comment { + $$ = $1; + set_comment($1, $2); + } | empty { $$ = 0; previousNode = currentNode; currentNode = 0; } ; From 509cbd72b0823381fbcc2ac9c9dab6b3bdbd5ede Mon Sep 17 00:00:00 2001 From: Dmitry Kabak Date: Sat, 7 Jul 2012 13:47:35 +0000 Subject: [PATCH 067/314] Small JavaDoc converter and doxygen parser improvements, now basic tags working git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2012-doxygen@13263 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- .../DoxygenTranslator/src/DoxygenParser.cpp | 1022 ++++++++--------- Source/DoxygenTranslator/src/DoxygenParser.h | 3 +- .../src/JavaDocConverter.cpp | 88 +- .../DoxygenTranslator/src/JavaDocConverter.h | 8 +- 4 files changed, 543 insertions(+), 578 deletions(-) diff --git a/Source/DoxygenTranslator/src/DoxygenParser.cpp b/Source/DoxygenTranslator/src/DoxygenParser.cpp index 07e61b590..e7104b9e0 100644 --- a/Source/DoxygenTranslator/src/DoxygenParser.cpp +++ b/Source/DoxygenTranslator/src/DoxygenParser.cpp @@ -12,645 +12,611 @@ #include "DoxygenParser.h" #include "DoxygenCommands.h" -#include - // Define static class members std::map DoxygenParser::doxygenCommands; std::set DoxygenParser::doxygenSectionIndicators; -DoxygenParser::DoxygenParser() : noisy(false) { - fillTables(); +DoxygenParser::DoxygenParser() : noisy(true) { + fillTables(); } DoxygenParser::~DoxygenParser() { } void DoxygenParser::fillTables() { - // run it only once - if (doxygenCommands.size()) - return; - - // fill in tables with data from DxygenCommands.h - for (int i = 0; i < simpleCommandsSize; i++) - doxygenCommands[simpleCommands[i]] = SIMPLECOMMAND; - for (int i = 0; i < ignoredSimpleCommandsSize; i++) - doxygenCommands[ignoredSimpleCommands[i]] = IGNOREDSIMPLECOMMAND; - - for (int i = 0; i < commandWordsSize; i++) - doxygenCommands[commandWords[i]] = COMMANDWORD; - for (int i = 0; i < ignoredCommandWordsSize; i++) - doxygenCommands[ignoredCommandWords[i]] = IGNOREDCOMMANDWORD; - - for (int i = 0; i < commandLinesSize; i++) - doxygenCommands[commandLines[i]] = COMMANDLINE; - for (int i = 0; i < ignoreCommandLinesSize; i++) - doxygenCommands[ignoreCommandLines[i]] = IGNOREDCOMMANDLINE; - - for (int i = 0; i < commandParagraphSize; i++) - doxygenCommands[commandParagraph[i]] = COMMANDPARAGRAPH; - for (int i = 0; i < ignoreCommandParagraphsSize; i++) - doxygenCommands[ignoreCommandParagraphs[i]] = IGNORECOMMANDPARAGRAPH; - - for (int i = 0; i < commandEndCommandsSize; i++) - doxygenCommands[commandEndCommands[i]] = COMMANDENDCOMMAND; - for (int i = 0; i < commandWordParagraphsSize; i++) - doxygenCommands[commandWordParagraphs[i]] = COMMANDWORDPARAGRAPH; - for (int i = 0; i < commandWordLinesSize; i++) - doxygenCommands[commandWordLines[i]] = COMMANDWORDLINE; - for (int i = 0; i < commandWordOWordOWordsSize; i++) - doxygenCommands[commandWordOWordOWords[i]] = COMMANDWORDOWORDWORD; - for (int i = 0; i < commandOWordsSize; i++) - doxygenCommands[commandOWords[i]] = COMMANDOWORD; - for (int i = 0; i < commandErrorThrowingsSize; i++) - doxygenCommands[commandErrorThrowings[i]] = COMMANDERRORTHROW; - for (int i = 0; i < commandUniquesSize; i++) - doxygenCommands[commandUniques[i]] = COMMANDUNIQUE; - - // fill section indicators command set - for (int i = 0; i < sectionIndicatorsSize; i++) - doxygenSectionIndicators.insert(sectionIndicators[i]); + // run it only once + if (doxygenCommands.size()) + return; + + // fill in tables with data from DxygenCommands.h + for (int i = 0; i < simpleCommandsSize; i++) + doxygenCommands[simpleCommands[i]] = SIMPLECOMMAND; + for (int i = 0; i < ignoredSimpleCommandsSize; i++) + doxygenCommands[ignoredSimpleCommands[i]] = IGNOREDSIMPLECOMMAND; + + for (int i = 0; i < commandWordsSize; i++) + doxygenCommands[commandWords[i]] = COMMANDWORD; + for (int i = 0; i < ignoredCommandWordsSize; i++) + doxygenCommands[ignoredCommandWords[i]] = IGNOREDCOMMANDWORD; + + for (int i = 0; i < commandLinesSize; i++) + doxygenCommands[commandLines[i]] = COMMANDLINE; + for (int i = 0; i < ignoreCommandLinesSize; i++) + doxygenCommands[ignoreCommandLines[i]] = IGNOREDCOMMANDLINE; + + for (int i = 0; i < commandParagraphSize; i++) + doxygenCommands[commandParagraph[i]] = COMMANDPARAGRAPH; + for (int i = 0; i < ignoreCommandParagraphsSize; i++) + doxygenCommands[ignoreCommandParagraphs[i]] = IGNORECOMMANDPARAGRAPH; + + for (int i = 0; i < commandEndCommandsSize; i++) + doxygenCommands[commandEndCommands[i]] = COMMANDENDCOMMAND; + for (int i = 0; i < commandWordParagraphsSize; i++) + doxygenCommands[commandWordParagraphs[i]] = COMMANDWORDPARAGRAPH; + for (int i = 0; i < commandWordLinesSize; i++) + doxygenCommands[commandWordLines[i]] = COMMANDWORDLINE; + for (int i = 0; i < commandWordOWordOWordsSize; i++) + doxygenCommands[commandWordOWordOWords[i]] = COMMANDWORDOWORDWORD; + for (int i = 0; i < commandOWordsSize; i++) + doxygenCommands[commandOWords[i]] = COMMANDOWORD; + for (int i = 0; i < commandErrorThrowingsSize; i++) + doxygenCommands[commandErrorThrowings[i]] = COMMANDERRORTHROW; + for (int i = 0; i < commandUniquesSize; i++) + doxygenCommands[commandUniques[i]] = COMMANDUNIQUE; + + // fill section indicators command set + for (int i = 0; i < sectionIndicatorsSize; i++) + doxygenSectionIndicators.insert(sectionIndicators[i]); } std::string DoxygenParser::StringToLower(std::string stringToConvert) { - for (unsigned int i = 0; i < stringToConvert.length(); i++) { - stringToConvert[i] = tolower(stringToConvert[i]); - } - return stringToConvert; //return the converted std::string + for (unsigned int i = 0; i < stringToConvert.length(); i++) { + stringToConvert[i] = tolower(stringToConvert[i]); + } + return stringToConvert; //return the converted std::string } int DoxygenParser::findCommand(std::string smallString) { - std::map::iterator it; - smallString = StringToLower(smallString); - // I'm not sure if we can really do so, because there are different commands - // in doxygenCommands and original commandArray - it = doxygenCommands.find(smallString); - if (it != doxygenCommands.end()) - return 1; - return -1; + std::map::iterator it; + smallString = StringToLower(smallString); + // I'm not sure if we can really do so, because there are different commands + // in doxygenCommands and original commandArray + it = doxygenCommands.find(smallString); + if (it != doxygenCommands.end()) + return 1; + return -1; } int DoxygenParser::isSectionIndicator(std::string smallString) { - smallString = StringToLower(smallString); - std::set::iterator it; - it = doxygenSectionIndicators.find(smallString); - if (it != doxygenSectionIndicators.end()) - return 1; - return 0; + smallString = StringToLower(smallString); + std::set::iterator it; + it = doxygenSectionIndicators.find(smallString); + if (it != doxygenSectionIndicators.end()) + return 1; + return 0; } void DoxygenParser::printTree(std::list < DoxygenEntity > &rootList) { - std::list < DoxygenEntity >::iterator p = rootList.begin(); - while (p != rootList.end()) { - (*p).printEntity(0); - p++; - } + std::list < DoxygenEntity >::iterator p = rootList.begin(); + while (p != rootList.end()) { + (*p).printEntity(0); + p++; + } } int DoxygenParser::commandBelongs(std::string theCommand) { - std::string smallString = StringToLower(theCommand); - //cout << " Looking for command " << theCommand << endl; - std::map::iterator it; - it = doxygenCommands.find(smallString); - if (it!=doxygenCommands.end()) - return it->second; - return 0; + std::string smallString = StringToLower(theCommand); + //cout << " Looking for command " << theCommand << endl; + std::map::iterator it; + it = doxygenCommands.find(smallString); + if (it!=doxygenCommands.end()) + return it->second; + return 0; } std::string DoxygenParser::getNextWord(TokenList & tokList) { - Token nextToken = tokList.peek(); - if (nextToken.tokenType == PLAINSTRING) { - nextToken = tokList.next(); - return nextToken.tokenString; - } - return ""; + Token nextToken = tokList.peek(); + if (nextToken.tokenType == PLAINSTRING) { + nextToken = tokList.next(); + return nextToken.tokenString; + } + return ""; } std::list < Token >::iterator DoxygenParser::getOneLine(TokenList & tokList) { - std::list < Token >::iterator endOfLine = tokList.iteratorCopy(); - while (endOfLine != tokList.end()) { - if ((*endOfLine).tokenType == END_LINE) { - //cout << "REACHED END" << endl; - //endOfLine++; - return endOfLine; - } - //cout << (* endOfLine).toString(); - endOfLine++; - } + std::list < Token >::iterator endOfLine = tokList.iteratorCopy(); + while (endOfLine != tokList.end()) { + if ((*endOfLine).tokenType == END_LINE) { + //cout << "REACHED END" << endl; + //endOfLine++; + return endOfLine; + } + //cout << (* endOfLine).toString(); + endOfLine++; + } - return tokList.end(); + return tokList.end(); } std::string DoxygenParser::getStringTilCommand(TokenList & tokList) { - std::string description; - if (tokList.peek().tokenType == 0) - return ""; - while (tokList.peek().tokenType == PLAINSTRING) { - Token currentToken = tokList.next(); - if (currentToken.tokenType == PLAINSTRING) { - description = description + currentToken.tokenString + " "; - } - } - return description; + std::string description; + if (tokList.peek().tokenType == 0) + return ""; + while (tokList.peek().tokenType == PLAINSTRING) { + Token currentToken = tokList.next(); + if (currentToken.tokenType == PLAINSTRING) { + description = description + currentToken.tokenString + " "; + } + } + return description; } std::string DoxygenParser::getStringTilEndCommand(std::string theCommand, TokenList & tokList) { - std::string description; - if (tokList.peek().tokenType == 0) - return ""; - while (tokList.next().tokenString.compare(theCommand) != 0) { - //TODO: it won't output doxygen commands, need a way to fix it - if (tokList.peek().tokenType == PLAINSTRING) - description += tokList.peek().tokenString + " "; - if (tokList.peek().tokenType == END_LINE) - description += "\n"; - } - tokList.next(); // eat the end command itself - return description; + std::string description; + if (tokList.peek().tokenType == 0) + return ""; + while (tokList.next().tokenString.compare(theCommand) != 0) { + //TODO: it won't output doxygen commands, need a way to fix it + if (tokList.peek().tokenType == PLAINSTRING) + description += tokList.peek().tokenString + " "; + if (tokList.peek().tokenType == END_LINE) + description += "\n"; + } + tokList.next(); // eat the end command itself + return description; } std::list < Token >::iterator DoxygenParser::getEndOfParagraph(TokenList & tokList) { - std::list < Token >::iterator endOfParagraph = tokList.iteratorCopy(); - while (endOfParagraph != tokList.end()) { - if ((*endOfParagraph).tokenType == END_LINE) { - endOfParagraph++; - if (endOfParagraph != tokList.end() && (*endOfParagraph).tokenType == END_LINE) { - endOfParagraph++; - //cout << "ENCOUNTERED END OF PARA" << endl; - return endOfParagraph; - } + std::list < Token >::iterator endOfParagraph = tokList.iteratorCopy(); + while (endOfParagraph != tokList.end()) { + if ((*endOfParagraph).tokenType == END_LINE) { + endOfParagraph++; + if (endOfParagraph != tokList.end() && (*endOfParagraph).tokenType == END_LINE) { + endOfParagraph++; + //cout << "ENCOUNTERED END OF PARA" << endl; + return endOfParagraph; + } - } else if ((*endOfParagraph).tokenType == COMMAND) { + } else if ((*endOfParagraph).tokenType == COMMAND) { - if (isSectionIndicator((*endOfParagraph).tokenString)) { - return endOfParagraph; - } else - endOfParagraph++; + if (isSectionIndicator((*endOfParagraph).tokenString)) { + return endOfParagraph; + } else + endOfParagraph++; - } else if ((*endOfParagraph).tokenType == PLAINSTRING) { - endOfParagraph++; - } else { - return tokList.end(); - } - } + } else if ((*endOfParagraph).tokenType == PLAINSTRING) { + endOfParagraph++; + } else { + return tokList.end(); + } + } - return tokList.end(); + return tokList.end(); } std::list < Token >::iterator DoxygenParser::getEndOfSection(std::string theCommand, TokenList & tokList) { - std::list < Token >::iterator endOfParagraph = tokList.iteratorCopy(); - while (endOfParagraph != tokList.end()) { - if ((*endOfParagraph).tokenType == COMMAND) { - if (theCommand.compare((*endOfParagraph).tokenString) == 0) - return endOfParagraph; - else - endOfParagraph++; - } else if ((*endOfParagraph).tokenType == PLAINSTRING) { - endOfParagraph++; - } else if ((*endOfParagraph).tokenType == END_LINE) { - endOfParagraph++; - if ((*endOfParagraph).tokenType == END_LINE) { - endOfParagraph++; - return endOfParagraph; - } - } - } - return tokList.end(); + std::list < Token >::iterator endOfParagraph = tokList.iteratorCopy(); + while (endOfParagraph != tokList.end()) { + if ((*endOfParagraph).tokenType == COMMAND) { + if (theCommand.compare((*endOfParagraph).tokenString) == 0) + return endOfParagraph; + else + endOfParagraph++; + } else if ((*endOfParagraph).tokenType == PLAINSTRING) { + endOfParagraph++; + } else if ((*endOfParagraph).tokenType == END_LINE) { + endOfParagraph++; + if ((*endOfParagraph).tokenType == END_LINE) { + endOfParagraph++; + return endOfParagraph; + } + } + } + return tokList.end(); } std::list < Token >::iterator DoxygenParser::getEndCommand(std::string theCommand, TokenList & tokList) { - std::list < Token >::iterator endOfCommand = tokList.iteratorCopy(); - while (endOfCommand != tokList.end()) { - if ((*endOfCommand).tokenType == COMMAND) { - if (theCommand.compare((*endOfCommand).tokenString) == 0) { - return endOfCommand; - } - endOfCommand++; - } - } - //End command not found - return tokList.end(); + std::list < Token >::iterator endOfCommand = tokList.iteratorCopy(); + while (endOfCommand != tokList.end()) { + if ((*endOfCommand).tokenType == COMMAND) { + if (theCommand.compare((*endOfCommand).tokenString) == 0) { + return endOfCommand; + } + endOfCommand++; + } + } + //End command not found + return tokList.end(); } std::list < Token >::iterator DoxygenParser::getTilAnyCommand(std::string theCommand, TokenList & tokList) { #pragma unused(theCommand,tokList) - std::list < Token >::iterator anIterator; - return anIterator; + std::list < Token >::iterator anIterator; + return anIterator; } int DoxygenParser::addSimpleCommand(std::string theCommand, std::list < DoxygenEntity > &doxyList) { - if (noisy) - cout << "Parsing " << theCommand << endl; - doxyList.push_back(DoxygenEntity(theCommand)); - return 1; + if (noisy) + cout << "Parsing " << theCommand << endl; + doxyList.push_back(DoxygenEntity(theCommand)); + return 1; } int DoxygenParser::ignoreSimpleCommand(std::string theCommand, std::list < DoxygenEntity > &doxyList) { #pragma unused(doxyList) - if (noisy) - cout << "Not Adding " << theCommand << endl; - return 1; + if (noisy) + cout << "Not Adding " << theCommand << endl; + return 1; } int DoxygenParser::addCommandWord(std::string theCommand, TokenList & tokList, std::list < DoxygenEntity > &doxyList) { - if (noisy) - cout << "Parsing " << theCommand << endl; - std::string name = getNextWord(tokList); - if (!name.empty()) { - doxyList.push_back(DoxygenEntity(theCommand, name)); - return 1; - } else - cout << "No word followed " << theCommand << " command. Not added" << endl; - return 0; + if (noisy) + cout << "Parsing " << theCommand << endl; + std::string name = getNextWord(tokList); + if (!name.empty()) { + doxyList.push_back(DoxygenEntity(theCommand, name)); + return 1; + } else + cout << "No word followed " << theCommand << " command. Not added" << endl; + return 0; } int DoxygenParser::ignoreCommandWord(std::string theCommand, TokenList & tokList, std::list < DoxygenEntity > &doxyList) { #pragma unused(doxyList) - if (noisy) - cout << "Not Adding " << theCommand << endl; - std::string name = getNextWord(tokList); - if (!name.empty()) - return 1; - else - cout << "WARNING: No word followed " << theCommand << " command." << endl; - return 0; + if (noisy) + cout << "Not Adding " << theCommand << endl; + std::string name = getNextWord(tokList); + if (!name.empty()) + return 1; + else + cout << "WARNING: No word followed " << theCommand << " command." << endl; + return 0; } int DoxygenParser::addCommandLine(std::string theCommand, TokenList & tokList, std::list < DoxygenEntity > &doxyList) { - if (noisy) - cout << "Parsing " << theCommand << endl; - std::list < Token >::iterator endOfLine = getOneLine(tokList); - std::list < DoxygenEntity > aNewList = parse(endOfLine, tokList); - doxyList.push_back(DoxygenEntity(theCommand, aNewList)); - return 1; + if (noisy) + cout << "Parsing " << theCommand << endl; + std::list < Token >::iterator endOfLine = getOneLine(tokList); + std::list < DoxygenEntity > aNewList = parse(endOfLine, tokList); + doxyList.push_back(DoxygenEntity(theCommand, aNewList)); + return 1; } int DoxygenParser::ignoreCommandLine(std::string theCommand, TokenList & tokList, std::list < DoxygenEntity > &doxyList) { #pragma unused(doxyList) - if (noisy) - cout << "Not Adding " << theCommand << endl; - std::list < Token >::iterator endOfLine = getOneLine(tokList); - tokList.setIterator(endOfLine); - return 1; + if (noisy) + cout << "Not Adding " << theCommand << endl; + std::list < Token >::iterator endOfLine = getOneLine(tokList); + tokList.setIterator(endOfLine); + return 1; } int DoxygenParser::addCommandParagraph(std::string theCommand, TokenList & tokList, std::list < DoxygenEntity > &doxyList) { - if (noisy) - cout << "Parsing " << theCommand << endl; - std::list < Token >::iterator endOfParagraph = getEndOfParagraph(tokList); - std::list < DoxygenEntity > aNewList; - aNewList = parse(endOfParagraph, tokList); - doxyList.push_back(DoxygenEntity(theCommand, aNewList)); - return 1; + if (noisy) + cout << "Parsing " << theCommand << endl; + std::list < Token >::iterator endOfParagraph = getEndOfParagraph(tokList); + std::list < DoxygenEntity > aNewList; + aNewList = parse(endOfParagraph, tokList); + doxyList.push_back(DoxygenEntity(theCommand, aNewList)); + return 1; } int DoxygenParser::ignoreCommandParagraph(std::string theCommand, TokenList & tokList, std::list < DoxygenEntity > &doxyList) { #pragma unused(doxyList) - if (noisy) - cout << "Not Adding " << theCommand << endl; - std::list < Token >::iterator endOfParagraph = getEndOfParagraph(tokList); - tokList.setIterator(endOfParagraph); - return 1; + if (noisy) + cout << "Not Adding " << theCommand << endl; + std::list < Token >::iterator endOfParagraph = getEndOfParagraph(tokList); + tokList.setIterator(endOfParagraph); + return 1; } int DoxygenParser::addCommandEndCommand(std::string theCommand, TokenList & tokList, std::list < DoxygenEntity > &doxyList) { - if (noisy) - cout << "Parsing " << theCommand << endl; - std::string description = getStringTilEndCommand("end" + theCommand, tokList); - doxyList.push_back(DoxygenEntity(theCommand, description)); - return 1; + if (noisy) + cout << "Parsing " << theCommand << endl; + std::string description = getStringTilEndCommand("end" + theCommand, tokList); + doxyList.push_back(DoxygenEntity(theCommand, description)); + return 1; } int DoxygenParser::addCommandWordParagraph(std::string theCommand, TokenList & tokList, std::list < DoxygenEntity > &doxyList) { - if (noisy) - cout << "Parsing " << theCommand << endl; - std::string name = getNextWord(tokList); - if (name.empty()) { - cout << "No word followed " << theCommand << " command. Not added" << endl; - return 0; - } - std::list < Token >::iterator endOfParagraph = getEndOfParagraph(tokList); - std::list < DoxygenEntity > aNewList; - aNewList = parse(endOfParagraph, tokList); - aNewList.push_front(DoxygenEntity("plainstd::string", name)); - doxyList.push_back(DoxygenEntity(theCommand, aNewList)); - return 1; + if (noisy) + cout << "Parsing " << theCommand << endl; + std::string name = getNextWord(tokList); + if (name.empty()) { + cout << "No word followed " << theCommand << " command. Not added" << endl; + return 0; + } + std::list < Token >::iterator endOfParagraph = getEndOfParagraph(tokList); + std::list < DoxygenEntity > aNewList; + aNewList = parse(endOfParagraph, tokList); + aNewList.push_front(DoxygenEntity("plainstd::string", name)); + doxyList.push_back(DoxygenEntity(theCommand, aNewList)); + return 1; } int DoxygenParser::addCommandWordLine(std::string theCommand, TokenList & tokList, std::list < DoxygenEntity > &doxyList) { - if (noisy) - cout << "Parsing " << theCommand << endl; - std::string name = getNextWord(tokList); - if (name.empty()) { - cout << "No word followed " << theCommand << " command. Not added" << endl; - return 0; - } - std::list < Token >::iterator endOfLine = getOneLine(tokList); - std::list < DoxygenEntity > aNewList; - aNewList = parse(endOfLine, tokList); - aNewList.push_front(DoxygenEntity("plainstd::string", name)); - doxyList.push_back(DoxygenEntity(theCommand, aNewList)); - return 1; - //else cout << "No line followed " << theCommand << " command. Not added" << endl; + if (noisy) + cout << "Parsing " << theCommand << endl; + std::string name = getNextWord(tokList); + if (name.empty()) { + cout << "No word followed " << theCommand << " command. Not added" << endl; + return 0; + } + std::list < Token >::iterator endOfLine = getOneLine(tokList); + std::list < DoxygenEntity > aNewList; + aNewList = parse(endOfLine, tokList); + aNewList.push_front(DoxygenEntity("plainstd::string", name)); + doxyList.push_back(DoxygenEntity(theCommand, aNewList)); + return 1; + //else cout << "No line followed " << theCommand << " command. Not added" << endl; } int DoxygenParser::addCommandWordOWordOWord(std::string theCommand, TokenList & tokList, std::list < DoxygenEntity > &doxyList) { - if (noisy) - cout << "Parsing " << theCommand << endl; - std::string name = getNextWord(tokList); - if (name.empty()) { - cout << "No word followed " << theCommand << " command. Not added" << endl; - return 0; - } - std::string headerfile = getNextWord(tokList); - std::string headername = getNextWord(tokList); - std::list < DoxygenEntity > aNewList; - aNewList.push_back(DoxygenEntity("plainstd::string", name)); - if (!headerfile.empty()) - aNewList.push_back(DoxygenEntity("plainstd::string", headerfile)); - if (!headername.empty()) - aNewList.push_back(DoxygenEntity("plainstd::string", headername)); - doxyList.push_back(DoxygenEntity(theCommand, aNewList)); - return 1; + if (noisy) + cout << "Parsing " << theCommand << endl; + std::string name = getNextWord(tokList); + if (name.empty()) { + cout << "No word followed " << theCommand << " command. Not added" << endl; + return 0; + } + std::string headerfile = getNextWord(tokList); + std::string headername = getNextWord(tokList); + std::list < DoxygenEntity > aNewList; + aNewList.push_back(DoxygenEntity("plainstd::string", name)); + if (!headerfile.empty()) + aNewList.push_back(DoxygenEntity("plainstd::string", headerfile)); + if (!headername.empty()) + aNewList.push_back(DoxygenEntity("plainstd::string", headername)); + doxyList.push_back(DoxygenEntity(theCommand, aNewList)); + return 1; } int DoxygenParser::addCommandOWord(std::string theCommand, TokenList & tokList, std::list < DoxygenEntity > &doxyList) { - if (noisy) - cout << "Parsing " << theCommand << endl; - std::string name = getNextWord(tokList); - doxyList.push_back(DoxygenEntity(theCommand, name)); - return 1; + if (noisy) + cout << "Parsing " << theCommand << endl; + std::string name = getNextWord(tokList); + doxyList.push_back(DoxygenEntity(theCommand, name)); + return 1; } int DoxygenParser::addCommandErrorThrow(std::string theCommand, TokenList & tokList, std::list < DoxygenEntity > &doxyList) { #pragma unused(doxyList) - if (noisy) { - cout << "Encountered :" << theCommand << endl; - cout << "This command should not have been encountered. Behaviour past this may be unpredictable " << endl; - } - std::list < Token >::iterator endOfLine = getOneLine(tokList); - tokList.setIterator(endOfLine); - return 0; + if (noisy) { + cout << "Encountered :" << theCommand << endl; + cout << "This command should not have been encountered. Behaviour past this may be unpredictable " << endl; + } + std::list < Token >::iterator endOfLine = getOneLine(tokList); + tokList.setIterator(endOfLine); + return 0; } int DoxygenParser::addCommandUnique(std::string theCommand, TokenList & tokList, std::list < DoxygenEntity > &doxyList) { - std::list < DoxygenEntity > aNewList; - if (theCommand.compare("arg") == 0 || theCommand.compare("li") == 0) { - std::list < Token >::iterator endOfSection = getEndOfSection(theCommand, tokList); - std::list < DoxygenEntity > aNewList; - aNewList = parse(endOfSection, tokList); - doxyList.push_back(DoxygenEntity(theCommand, aNewList)); - } - // \xrefitem "(heading)" "(std::list title)" {text} - else if (theCommand.compare("xrefitem") == 0) { - //TODO Implement xrefitem - if (noisy) - cout << "Not Adding " << theCommand << endl; - std::list < Token >::iterator endOfParagraph = getEndOfParagraph(tokList); - tokList.setIterator(endOfParagraph); - return 1; - } - // \ingroup ( [ ]) - else if (theCommand.compare("ingroup") == 0) { - std::string name = getNextWord(tokList); - aNewList.push_back(DoxygenEntity("plainstd::string", name)); - name = getNextWord(tokList); - if (!name.empty()) - aNewList.push_back(DoxygenEntity("plainstd::string", name)); - name = getNextWord(tokList); - if (!name.empty()) - aNewList.push_back(DoxygenEntity("plainstd::string", name)); - doxyList.push_back(DoxygenEntity(theCommand, aNewList)); - return 1; - } - // \par [(paragraph title)] { paragraph } - else if (theCommand.compare("par") == 0) { - std::list < Token >::iterator endOfLine = getOneLine(tokList); - aNewList = parse(endOfLine, tokList); - std::list < DoxygenEntity > aNewList2; - aNewList2 = parse(endOfLine, tokList); - aNewList.splice(aNewList.end(), aNewList2); - doxyList.push_back(DoxygenEntity(theCommand, aNewList)); - return 1; - } - // \headerfile [] - else if (theCommand.compare("headerfile") == 0) { - std::list < DoxygenEntity > aNewList; - std::string name = getNextWord(tokList); - aNewList.push_back(DoxygenEntity("plainstd::string", name)); - name = getNextWord(tokList); - if (!name.empty()) - aNewList.push_back(DoxygenEntity("plainstd::string", name)); - doxyList.push_back(DoxygenEntity(theCommand, aNewList)); - return 1; - } - // \overload [(function declaration)] - else if (theCommand.compare("overload") == 0) { - std::list < Token >::iterator endOfLine = getOneLine(tokList); - if (endOfLine != tokList.current()) { - std::list < DoxygenEntity > aNewList; - aNewList = parse(endOfLine, tokList); - doxyList.push_back(DoxygenEntity(theCommand, aNewList)); - } else - doxyList.push_back(DoxygenEntity(theCommand)); - return 1; - } - // \weakgroup [(title)] - else if (theCommand.compare("weakgroup") == 0) { - if (noisy) - cout << "Parsing " << theCommand << endl; - std::string name = getNextWord(tokList); - if (name.empty()) { - cout << "No word followed " << theCommand << " command. Not added" << endl; - return 0; - } - std::list < DoxygenEntity > aNewList; - std::list < Token >::iterator endOfLine = getOneLine(tokList); - if (endOfLine != tokList.current()) { - aNewList = parse(endOfLine, tokList); - } - aNewList.push_front(DoxygenEntity("plainstd::string", name)); - doxyList.push_back(DoxygenEntity(theCommand, aNewList)); - } - // \ref ["(text)"] - else if (theCommand.compare("ref") == 0) { - //TODO Implement ref - if (noisy) - cout << "Not Adding " << theCommand << endl; - std::list < Token >::iterator endOfParagraph = getEndOfParagraph(tokList); - tokList.setIterator(endOfParagraph); - } - // \subpage ["(text)"] - else if (theCommand.compare("subpage") == 0) { - //TODO implement subpage - if (noisy) - cout << "Not Adding " << theCommand << endl; - std::list < Token >::iterator endOfParagraph = getEndOfParagraph(tokList); - tokList.setIterator(endOfParagraph); - } - // \dotfile ["caption"] - else if (theCommand.compare("dotfile") == 0) { - //TODO implement dotfile - if (noisy) - cout << "Not Adding " << theCommand << endl; - std::list < Token >::iterator endOfParagraph = getEndOfParagraph(tokList); - tokList.setIterator(endOfParagraph); - } - // \image ["caption"] [=] - else if (theCommand.compare("image") == 0) { - //todo implement image - } - // \addtogroup [(title)] - else if (theCommand.compare("addtogroup") == 0) { - if (noisy) - cout << "Parsing " << theCommand << endl; - std::string name = getNextWord(tokList); - if (name.empty()) { - cout << "No word followed " << theCommand << " command. Not added" << endl; - return 0; - } - std::list < DoxygenEntity > aNewList; - std::list < Token >::iterator endOfLine = getOneLine(tokList); - if (endOfLine != tokList.current()) { - aNewList = parse(endOfLine, tokList); - } - aNewList.push_front(DoxygenEntity("plainstd::string", name)); - doxyList.push_back(DoxygenEntity(theCommand, aNewList)); - } - return 0; + std::list < DoxygenEntity > aNewList; + if (theCommand.compare("arg") == 0 || theCommand.compare("li") == 0) { + std::list < Token >::iterator endOfSection = getEndOfSection(theCommand, tokList); + std::list < DoxygenEntity > aNewList; + aNewList = parse(endOfSection, tokList); + doxyList.push_back(DoxygenEntity(theCommand, aNewList)); + } + // \xrefitem "(heading)" "(std::list title)" {text} + else if (theCommand.compare("xrefitem") == 0) { + //TODO Implement xrefitem + if (noisy) + cout << "Not Adding " << theCommand << endl; + std::list < Token >::iterator endOfParagraph = getEndOfParagraph(tokList); + tokList.setIterator(endOfParagraph); + return 1; + } + // \ingroup ( [ ]) + else if (theCommand.compare("ingroup") == 0) { + std::string name = getNextWord(tokList); + aNewList.push_back(DoxygenEntity("plainstd::string", name)); + name = getNextWord(tokList); + if (!name.empty()) + aNewList.push_back(DoxygenEntity("plainstd::string", name)); + name = getNextWord(tokList); + if (!name.empty()) + aNewList.push_back(DoxygenEntity("plainstd::string", name)); + doxyList.push_back(DoxygenEntity(theCommand, aNewList)); + return 1; + } + // \par [(paragraph title)] { paragraph } + else if (theCommand.compare("par") == 0) { + std::list < Token >::iterator endOfLine = getOneLine(tokList); + aNewList = parse(endOfLine, tokList); + std::list < DoxygenEntity > aNewList2; + aNewList2 = parse(endOfLine, tokList); + aNewList.splice(aNewList.end(), aNewList2); + doxyList.push_back(DoxygenEntity(theCommand, aNewList)); + return 1; + } + // \headerfile [] + else if (theCommand.compare("headerfile") == 0) { + std::list < DoxygenEntity > aNewList; + std::string name = getNextWord(tokList); + aNewList.push_back(DoxygenEntity("plainstd::string", name)); + name = getNextWord(tokList); + if (!name.empty()) + aNewList.push_back(DoxygenEntity("plainstd::string", name)); + doxyList.push_back(DoxygenEntity(theCommand, aNewList)); + return 1; + } + // \overload [(function declaration)] + else if (theCommand.compare("overload") == 0) { + std::list < Token >::iterator endOfLine = getOneLine(tokList); + if (endOfLine != tokList.current()) { + std::list < DoxygenEntity > aNewList; + aNewList = parse(endOfLine, tokList); + doxyList.push_back(DoxygenEntity(theCommand, aNewList)); + } else + doxyList.push_back(DoxygenEntity(theCommand)); + return 1; + } + // \weakgroup [(title)] + else if (theCommand.compare("weakgroup") == 0) { + if (noisy) + cout << "Parsing " << theCommand << endl; + std::string name = getNextWord(tokList); + if (name.empty()) { + cout << "No word followed " << theCommand << " command. Not added" << endl; + return 0; + } + std::list < DoxygenEntity > aNewList; + std::list < Token >::iterator endOfLine = getOneLine(tokList); + if (endOfLine != tokList.current()) { + aNewList = parse(endOfLine, tokList); + } + aNewList.push_front(DoxygenEntity("plainstd::string", name)); + doxyList.push_back(DoxygenEntity(theCommand, aNewList)); + } + // \ref ["(text)"] + else if (theCommand.compare("ref") == 0) { + //TODO Implement ref + if (noisy) + cout << "Not Adding " << theCommand << endl; + std::list < Token >::iterator endOfParagraph = getEndOfParagraph(tokList); + tokList.setIterator(endOfParagraph); + } + // \subpage ["(text)"] + else if (theCommand.compare("subpage") == 0) { + //TODO implement subpage + if (noisy) + cout << "Not Adding " << theCommand << endl; + std::list < Token >::iterator endOfParagraph = getEndOfParagraph(tokList); + tokList.setIterator(endOfParagraph); + } + // \dotfile ["caption"] + else if (theCommand.compare("dotfile") == 0) { + //TODO implement dotfile + if (noisy) + cout << "Not Adding " << theCommand << endl; + std::list < Token >::iterator endOfParagraph = getEndOfParagraph(tokList); + tokList.setIterator(endOfParagraph); + } + // \image ["caption"] [=] + else if (theCommand.compare("image") == 0) { + //todo implement image + } + // \addtogroup [(title)] + else if (theCommand.compare("addtogroup") == 0) { + if (noisy) + cout << "Parsing " << theCommand << endl; + std::string name = getNextWord(tokList); + if (name.empty()) { + cout << "No word followed " << theCommand << " command. Not added" << endl; + return 0; + } + std::list < DoxygenEntity > aNewList; + std::list < Token >::iterator endOfLine = getOneLine(tokList); + if (endOfLine != tokList.current()) { + aNewList = parse(endOfLine, tokList); + } + aNewList.push_front(DoxygenEntity("plainstd::string", name)); + doxyList.push_back(DoxygenEntity(theCommand, aNewList)); + } + return 0; } int DoxygenParser::addCommand(std::string commandString, TokenList & tokList, std::list < DoxygenEntity > &doxyList) { - std::string theCommand = StringToLower(commandString); - if (theCommand.compare("plainstd::string") == 0) { - std::string nextPhrase = getStringTilCommand(tokList); - if (noisy) - cout << "Parsing plain std::string :" << nextPhrase << endl; - doxyList.push_back(DoxygenEntity("plainstd::string", nextPhrase)); - return 1; - } - int commandNumber = commandBelongs(theCommand); - if (commandNumber == SIMPLECOMMAND) { - return addSimpleCommand(theCommand, doxyList); - } - if (commandNumber == IGNOREDSIMPLECOMMAND) { - return ignoreSimpleCommand(theCommand, doxyList); - } - if (commandNumber == COMMANDWORD) { - return addCommandWord(theCommand, tokList, doxyList); - } - if (commandNumber == IGNOREDCOMMANDWORD) { - return ignoreCommandWord(theCommand, tokList, doxyList); - } - if (commandNumber == COMMANDLINE) { - return addCommandLine(theCommand, tokList, doxyList); - } - if (commandNumber == IGNOREDCOMMANDLINE) { - return ignoreCommandLine(theCommand, tokList, doxyList); - } - if (commandNumber == COMMANDPARAGRAPH) { - return addCommandParagraph(theCommand, tokList, doxyList); - } - if (commandNumber == IGNORECOMMANDPARAGRAPH) { - return ignoreCommandParagraph(theCommand, tokList, doxyList); - } - if (commandNumber == COMMANDENDCOMMAND) { - return addCommandEndCommand(theCommand, tokList, doxyList); - } - if (commandNumber == COMMANDWORDPARAGRAPH) { - return addCommandWordParagraph(theCommand, tokList, doxyList); - } - if (commandNumber == COMMANDWORDLINE) { - return addCommandWordLine(theCommand, tokList, doxyList); - } - if (commandNumber == COMMANDWORDOWORDWORD) { - return addCommandWordOWordOWord(theCommand, tokList, doxyList); - } - if (commandNumber == COMMANDOWORD) { - return addCommandOWord(theCommand, tokList, doxyList); - } - if (commandNumber == COMMANDERRORTHROW) { - return addCommandErrorThrow(theCommand, tokList, doxyList); - } - if (commandNumber == COMMANDUNIQUE) { - return addCommandUnique(theCommand, tokList, doxyList); - } - - return 0; -} - -std::list < DoxygenEntity > DoxygenParser::parse(std::list < Token >::iterator endParsingIndex, TokenList & tokList) { - std::list < DoxygenEntity > aNewList; - int currCommand; - while (tokList.current() != endParsingIndex) { - Token currToken = tokList.peek(); - if (noisy) - cout << "Parsing for phrase starting in:" << currToken.toString() << endl; - if (currToken.tokenType == END_LINE) { - tokList.next(); - } else if (currToken.tokenType == COMMAND) { - currCommand = findCommand(currToken.tokenString); - if (currCommand < 0) { - if (noisy) - cout << "Unidentified Command " << currToken.tokenString << endl; - tokList.next(); - addCommand(std::string("plainstd::string"), tokList, aNewList); - } else { - tokList.next(); - addCommand(currToken.tokenString, tokList, aNewList); - } - } else if (currToken.tokenType == PLAINSTRING) { - addCommand(std::string("plainstd::string"), tokList, aNewList); - } - break; - } - return aNewList; -} - -std::list < DoxygenEntity > DoxygenParser::parseRoot(std::list < Token >::iterator endParsingIndex, TokenList & tokList) { - - std::list < DoxygenEntity > aNewList; - int currCommand; - - while (tokList.current() != endParsingIndex) { - - Token currToken = tokList.peek(); - if (noisy) { - cout << "Parsing for phrase starting in:" << currToken.toString() << endl; - } - - if (currToken.tokenType == END_LINE) { - tokList.next(); - } else if (currToken.tokenType == COMMAND) { - currCommand = findCommand(currToken.tokenString); - if (currCommand < 0) { - if (noisy) { - cout << "Unidentified Command " << currToken.tokenString << endl; + std::string theCommand = StringToLower(commandString); + if (theCommand.compare("plainstd::string") == 0) { + std::string nextPhrase = getStringTilCommand(tokList); + if (noisy) + cout << "Parsing plain std::string :" << nextPhrase << endl; + doxyList.push_back(DoxygenEntity("plainstd::string", nextPhrase)); + return 1; } - tokList.next(); - addCommand(std::string("partofdescription"), tokList, aNewList); - } else { - tokList.next(); - addCommand(currToken.tokenString, tokList, aNewList); - } - } else if (currToken.tokenType == PLAINSTRING) { - addCommand(std::string("partofdescription"), tokList, aNewList); - } - } - return aNewList; + int commandNumber = commandBelongs(theCommand); + if (commandNumber == SIMPLECOMMAND) { + return addSimpleCommand(theCommand, doxyList); + } + if (commandNumber == IGNOREDSIMPLECOMMAND) { + return ignoreSimpleCommand(theCommand, doxyList); + } + if (commandNumber == COMMANDWORD) { + return addCommandWord(theCommand, tokList, doxyList); + } + if (commandNumber == IGNOREDCOMMANDWORD) { + return ignoreCommandWord(theCommand, tokList, doxyList); + } + if (commandNumber == COMMANDLINE) { + return addCommandLine(theCommand, tokList, doxyList); + } + if (commandNumber == IGNOREDCOMMANDLINE) { + return ignoreCommandLine(theCommand, tokList, doxyList); + } + if (commandNumber == COMMANDPARAGRAPH) { + return addCommandParagraph(theCommand, tokList, doxyList); + } + if (commandNumber == IGNORECOMMANDPARAGRAPH) { + return ignoreCommandParagraph(theCommand, tokList, doxyList); + } + if (commandNumber == COMMANDENDCOMMAND) { + return addCommandEndCommand(theCommand, tokList, doxyList); + } + if (commandNumber == COMMANDWORDPARAGRAPH) { + return addCommandWordParagraph(theCommand, tokList, doxyList); + } + if (commandNumber == COMMANDWORDLINE) { + return addCommandWordLine(theCommand, tokList, doxyList); + } + if (commandNumber == COMMANDWORDOWORDWORD) { + return addCommandWordOWordOWord(theCommand, tokList, doxyList); + } + if (commandNumber == COMMANDOWORD) { + return addCommandOWord(theCommand, tokList, doxyList); + } + if (commandNumber == COMMANDERRORTHROW) { + return addCommandErrorThrow(theCommand, tokList, doxyList); + } + if (commandNumber == COMMANDUNIQUE) { + return addCommandUnique(theCommand, tokList, doxyList); + } + + return 0; +} + +std::list < DoxygenEntity > DoxygenParser::parse(std::list < Token >::iterator endParsingIndex, TokenList & tokList, bool root) { + // if we are root, than any strings should be added as 'partofdescription', else as 'plainstd::string' + std::string currPlainstringCommandType = root ? "partofdescription" : "plainstd::string"; + std::list < DoxygenEntity > aNewList; + int currCommand; + while (tokList.current() != endParsingIndex) { + Token currToken = tokList.peek(); + if (noisy) + cout << "Parsing for phrase starting in:" << currToken.toString() << endl; + if (currToken.tokenType == END_LINE) { + tokList.next(); + } else if (currToken.tokenType == COMMAND) { + currCommand = findCommand(currToken.tokenString); + if (currCommand < 0) { + if (noisy) + cout << "Unidentified Command " << currToken.tokenString << endl; + tokList.next(); + addCommand(currPlainstringCommandType, tokList, aNewList); + } else { + tokList.next(); + addCommand(currToken.tokenString, tokList, aNewList); + } + } else if (currToken.tokenType == PLAINSTRING) { + addCommand(currPlainstringCommandType, tokList, aNewList); + } + } + return aNewList; } std::list < DoxygenEntity > DoxygenParser::createTree(std::string doxygenBlob) { - TokenList tokList = TokenList(doxygenBlob); - if (noisy) { - cout << "---TOKEN LIST---" << endl; - tokList.printList(); - } - std::list < DoxygenEntity > rootList; - rootList = parseRoot(tokList.end(), tokList); - if (noisy) { - cout << "PARSED LIST" << endl; - printTree(rootList); - } - return rootList; + TokenList tokList = TokenList(doxygenBlob); + if (noisy) { + cout << "---TOKEN LIST---" << endl; + tokList.printList(); + } + std::list < DoxygenEntity > rootList; + rootList = parse(tokList.end(), tokList, true); + if (noisy) { + cout << "PARSED LIST" << endl; + printTree(rootList); + } + return rootList; } diff --git a/Source/DoxygenTranslator/src/DoxygenParser.h b/Source/DoxygenTranslator/src/DoxygenParser.h index e64644725..8becdff02 100644 --- a/Source/DoxygenTranslator/src/DoxygenParser.h +++ b/Source/DoxygenTranslator/src/DoxygenParser.h @@ -213,8 +213,7 @@ private: */ int addCommand(std::string commandString, TokenList & tokList, std::list < DoxygenEntity > &doxyList); - std::list < DoxygenEntity > parse(std::list < Token >::iterator endParsingIndex, TokenList & tokList); - std::list < DoxygenEntity > parseRoot(std::list < Token >::iterator endParsingIndex, TokenList & tokList); + std::list < DoxygenEntity > parse(std::list < Token >::iterator endParsingIndex, TokenList & tokList, bool root=false); /* * Fill static doxygenCommands and sectionIndicators containers diff --git a/Source/DoxygenTranslator/src/JavaDocConverter.cpp b/Source/DoxygenTranslator/src/JavaDocConverter.cpp index a3abf100a..7bdda082e 100644 --- a/Source/DoxygenTranslator/src/JavaDocConverter.cpp +++ b/Source/DoxygenTranslator/src/JavaDocConverter.cpp @@ -16,10 +16,11 @@ #define TAB_SIZE 8 //current tab size in spaces //TODO {@link} {@linkplain} {@docRoot}, and other useful doxy commands that are not a javadoc tag -// define static escape table, it is filled in JavaDocConverter's constructor +// define static tables, they are filled in JavaDocConverter's constructor std::map JavaDocConverter::escapeTable; +std::map JavaDocConverter::tagHandlers; -void JavaDocConverter::fillEscapeTable() { +void JavaDocConverter::fillStaticTables() { if (escapeTable.size()) // fill only once return; @@ -28,48 +29,47 @@ void JavaDocConverter::fillEscapeTable() { escapeTable["\""] = """; escapeTable["<"] = "<"; escapeTable[">"] = ">"; + + // these commands insert HTML tags + tagHandlers["c"] = &handleTagC; + tagHandlers["b"] = &handleTagB; + // these commands insert just a single char, some of them need to be escaped + tagHandlers["$"] = &handleTagChar; + tagHandlers["@"] = &handleTagChar; + tagHandlers["\\"] = &handleTagChar; + tagHandlers["<"] = &handleTagChar; + tagHandlers[">"] = &handleTagChar; + tagHandlers["&"] = &handleTagChar; + tagHandlers["#"] = &handleTagChar; + tagHandlers["%"] = &handleTagChar; + tagHandlers["~"] = &handleTagChar; + tagHandlers["\""] = &handleTagChar; + tagHandlers["."] = &handleTagChar; + tagHandlers["::"] = &handleTagChar; + // these commands are stripped out + tagHandlers["brief"] = &handleParagraph; + tagHandlers["details"] = &handleParagraph; + tagHandlers["partofdescription"] = &handleParagraph; + // these commands are kept as-is, they are supported by JavaDoc + tagHandlers["sa"] = &handleTagSeeAll; + tagHandlers["see"] = &handleTagSame; + tagHandlers["param"] = &handleTagSame; + tagHandlers["return"] = &handleTagSame; + tagHandlers["throws"] = &handleTagSame; + tagHandlers["throw"] = &handleTagThrow; + tagHandlers["author"] = &handleTagSame; + tagHandlers["since"] = &handleTagSame; + tagHandlers["version"] = &handleTagSame; + tagHandlers["exception"] = &handleTagSame; + tagHandlers["deprecated"] = &handleTagSame; + // this command just prints it's contents + // (it is internal command of swig's parser, contains plain text) + tagHandlers["plainstd::string"] = &handlePlainString; } JavaDocConverter::JavaDocConverter() : debug(false) { - - fillEscapeTable(); - - // these commands insert HTML tags - tagHandlers["c"] = &handleTagC; - tagHandlers["b"] = &handleTagB; - // these commands insert just a single char, all of them need to be escaped - tagHandlers["$"] = &handleTagChar; - tagHandlers["@"] = &handleTagChar; - tagHandlers["\\"] = &handleTagChar; - tagHandlers["<"] = &handleTagChar; - tagHandlers[">"] = &handleTagChar; - tagHandlers["&"] = &handleTagChar; - tagHandlers["#"] = &handleTagChar; - tagHandlers["%"] = &handleTagChar; - tagHandlers["~"] = &handleTagChar; - tagHandlers["\""] = &handleTagChar; - tagHandlers["."] = &handleTagChar; - tagHandlers["::"] = &handleTagChar; - // these commands are stripped out - tagHandlers["brief"] = &handleTagStrip; - tagHandlers["details"] = &handleTagStrip; - tagHandlers["partofdescription"] = &handleTagStrip; - // these commands are kept as-is, they are supported by JavaDoc - tagHandlers["sa"] = &handleTagSeeAll; - tagHandlers["see"] = &handleTagSame; - tagHandlers["param"] = &handleTagSame; - tagHandlers["return"] = &handleTagSame; - tagHandlers["throws"] = &handleTagSame; - tagHandlers["throw"] = &handleTagThrow; - tagHandlers["author"] = &handleTagSame; - tagHandlers["since"] = &handleTagSame; - tagHandlers["version"] = &handleTagSame; - tagHandlers["exception"] = &handleTagSame; - tagHandlers["deprecated"] = &handleTagSame; - // this command just prints it's contents - // (it is internal command of swig's parser, contains plain text) - tagHandlers["plainstd::string"] = &handleTagData; + fillStaticTables(); } std::string JavaDocConverter::formatCommand(std::string unformattedLine, int indent) { @@ -136,10 +136,10 @@ void JavaDocConverter::translateEntity(DoxygenEntity& tag, std::string& translat } void JavaDocConverter::handleTagC(JavaDocConverter* converter, DoxygenEntity& tag, std::string& translatedComment) { - translatedComment += "" + tag.data + ""; + translatedComment += "" + tag.data + " "; } void JavaDocConverter::handleTagB(JavaDocConverter* converter, DoxygenEntity& tag, std::string& translatedComment) { - translatedComment += "" + tag.data + ""; + translatedComment += "" + tag.data + " "; } void JavaDocConverter::handleTagThrow(JavaDocConverter* converter, DoxygenEntity& tag, std::string& translatedComment) { tag.typeOfEntity = "throws"; @@ -159,10 +159,10 @@ void JavaDocConverter::handleTagChar(JavaDocConverter* converter, DoxygenEntity& void JavaDocConverter::handleTagSame(JavaDocConverter* converter, DoxygenEntity& tag, std::string& translatedComment) { translatedComment += converter->formatCommand(std::string("@" + tag.typeOfEntity + "\t" + converter->translateSubtree(tag)), 2); } -void JavaDocConverter::handleTagStrip(JavaDocConverter* converter, DoxygenEntity& tag, std::string& translatedComment) { +void JavaDocConverter::handleParagraph(JavaDocConverter* converter, DoxygenEntity& tag, std::string& translatedComment) { translatedComment += converter->formatCommand(converter->translateSubtree(tag), 0); } -void JavaDocConverter::handleTagData(JavaDocConverter* converter, DoxygenEntity& tag, std::string& translatedComment) { +void JavaDocConverter::handlePlainString(JavaDocConverter* converter, DoxygenEntity& tag, std::string& translatedComment) { translatedComment += tag.data + " "; } diff --git a/Source/DoxygenTranslator/src/JavaDocConverter.h b/Source/DoxygenTranslator/src/JavaDocConverter.h index 408ec4bb2..9776a17e0 100644 --- a/Source/DoxygenTranslator/src/JavaDocConverter.h +++ b/Source/DoxygenTranslator/src/JavaDocConverter.h @@ -53,17 +53,17 @@ protected: /* * Print only the content and strip original tag */ - static void handleTagStrip(JavaDocConverter *converter, DoxygenEntity &tag, std::string &translatedComment); + static void handleParagraph(JavaDocConverter *converter, DoxygenEntity &tag, std::string &translatedComment); /* * Print only data part of code */ - static void handleTagData(JavaDocConverter *converter, DoxygenEntity &tag, std::string &translatedComment); + static void handlePlainString(JavaDocConverter *converter, DoxygenEntity &tag, std::string &translatedComment); private: bool debug; - std::map tagHandlers; + static std::map tagHandlers; static std::map escapeTable; - void fillEscapeTable(); + void fillStaticTables(); }; #endif From 92112f69f159ca8ffc2caf21c6815d610a1f27b3 Mon Sep 17 00:00:00 2001 From: Dmitry Kabak Date: Sat, 7 Jul 2012 13:55:25 +0000 Subject: [PATCH 068/314] Refactored java commentParser class git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2012-doxygen@13264 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Examples/test-suite/java/commentParser.java | 22 ++++++--------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/Examples/test-suite/java/commentParser.java b/Examples/test-suite/java/commentParser.java index 3877f5f4d..1b167cfcd 100644 --- a/Examples/test-suite/java/commentParser.java +++ b/Examples/test-suite/java/commentParser.java @@ -14,30 +14,20 @@ public class commentParser { * file, we get comments and store them */ - ClassDoc[] classes = root.classes(); + for (ClassDoc classDoc : root.classes()) { - for (int i = 0; i < classes.length; i++) { + if (classDoc.getRawCommentText().length() > 0) + parsedComments.put(classDoc.name(), classDoc.getRawCommentText()); - if (classes[i].getRawCommentText().length() > 0) - parsedComments.put(classes[i].name(), - classes[i].getRawCommentText()); - - MethodDoc[] methods = classes[i].methods(); - FieldDoc[] fields = classes[i].fields(); - FieldDoc[] constants = classes[i].enumConstants(); - - for (int j = 0; j < constants.length; j++) { - FieldDoc f = constants[j]; + for (FieldDoc f : classDoc.enumConstants()) { if (f.getRawCommentText().length() > 0) parsedComments.put(f.name(), f.getRawCommentText()); } - for (int j = 0; j < fields.length; j++) { - FieldDoc f = fields[j]; + for (FieldDoc f : classDoc.fields()) { if (f.getRawCommentText().length() > 0) parsedComments.put(f.name(), f.getRawCommentText()); } - for (int j = 0; j < methods.length; j++) { - MethodDoc m = methods[j]; + for (MethodDoc m : classDoc.methods()) { if (m.getRawCommentText().length() > 0) parsedComments.put(m.name(), m.getRawCommentText()); } From 2d47ffc87d2900273b09e837ff24d48e38587f09 Mon Sep 17 00:00:00 2001 From: Dmitry Kabak Date: Sat, 7 Jul 2012 15:24:35 +0000 Subject: [PATCH 069/314] Fixed small bug in DoxygenParser.cpp, now it won't freeze if it doesn't find doxygen ending tag. Also turned debug output off git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2012-doxygen@13265 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Source/DoxygenTranslator/src/DoxygenParser.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Source/DoxygenTranslator/src/DoxygenParser.cpp b/Source/DoxygenTranslator/src/DoxygenParser.cpp index e7104b9e0..238a6c75b 100644 --- a/Source/DoxygenTranslator/src/DoxygenParser.cpp +++ b/Source/DoxygenTranslator/src/DoxygenParser.cpp @@ -17,7 +17,7 @@ std::map DoxygenParser::doxygenCommands; std::set DoxygenParser::doxygenSectionIndicators; -DoxygenParser::DoxygenParser() : noisy(true) { +DoxygenParser::DoxygenParser() : noisy(false) { fillTables(); } @@ -156,7 +156,8 @@ std::string DoxygenParser::getStringTilEndCommand(std::string theCommand, TokenL std::string description; if (tokList.peek().tokenType == 0) return ""; - while (tokList.next().tokenString.compare(theCommand) != 0) { + while (tokList.current() != tokList.end() + && tokList.next().tokenString.compare(theCommand) != 0) { //TODO: it won't output doxygen commands, need a way to fix it if (tokList.peek().tokenType == PLAINSTRING) description += tokList.peek().tokenString + " "; From b3f53b98a079ee006a2a95c82d2b853fa413627d Mon Sep 17 00:00:00 2001 From: Dmitry Kabak Date: Sat, 7 Jul 2012 18:48:10 +0000 Subject: [PATCH 070/314] Added error reporting in case when there is no closing doxygen tag git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2012-doxygen@13266 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Source/DoxygenTranslator/src/DoxygenParser.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Source/DoxygenTranslator/src/DoxygenParser.cpp b/Source/DoxygenTranslator/src/DoxygenParser.cpp index 238a6c75b..623d37658 100644 --- a/Source/DoxygenTranslator/src/DoxygenParser.cpp +++ b/Source/DoxygenTranslator/src/DoxygenParser.cpp @@ -156,13 +156,17 @@ std::string DoxygenParser::getStringTilEndCommand(std::string theCommand, TokenL std::string description; if (tokList.peek().tokenType == 0) return ""; - while (tokList.current() != tokList.end() - && tokList.next().tokenString.compare(theCommand) != 0) { + while (tokList.next().tokenString.compare(theCommand) != 0) { //TODO: it won't output doxygen commands, need a way to fix it if (tokList.peek().tokenType == PLAINSTRING) description += tokList.peek().tokenString + " "; if (tokList.peek().tokenType == END_LINE) description += "\n"; + + if (tokList.current() == tokList.end()) { + cout << "Error, @" << theCommand << " command expected." << endl; + break; + } } tokList.next(); // eat the end command itself return description; From db3b39bc85dd50a2dff276dd368e0e966d12e22f Mon Sep 17 00:00:00 2001 From: Dmitry Kabak Date: Mon, 9 Jul 2012 08:19:17 +0000 Subject: [PATCH 071/314] Added project plan to SVN git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2012-doxygen@13267 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Doc/Devel/plan-gsoc-2012.txt | 285 +++++++++++++++++++++++++++++++++++ 1 file changed, 285 insertions(+) create mode 100644 Doc/Devel/plan-gsoc-2012.txt diff --git a/Doc/Devel/plan-gsoc-2012.txt b/Doc/Devel/plan-gsoc-2012.txt new file mode 100644 index 000000000..1796bcf78 --- /dev/null +++ b/Doc/Devel/plan-gsoc-2012.txt @@ -0,0 +1,285 @@ + + + + +This document describes goals for the Google Summer of Code 2012, +SWIG code documentation project. + +Author: Marko Klopcic + + +Introduction +============ + +The goal of this project is _not_ to translate _any_ possible doxygen +formatted comment to JavaDoc or PyDoc, but to make it possible to +translate a subset of comment types in C/C++ code to +JavaDoc and PyDoc. Covering all the Doxygen functionality would be to +complex for the limited time. Hovewer, the code must be extendable so +that implementing missing features would not require redesign of the +comment handling code in SWIG. + +There will also be a possiblity to add untranslated comments to Java +and Python code (## comments, see Doxygen manual), if the user will +prefer to use Doxygen on the generated code. + +Abbreviations: + JD - JavaDoc + PD - PyDoc + + +Functionality +============= + + Types of comments + ----------------- + + Note: + See 'http://www.stack.nl/~dimitri/doxygen/docblocks.html' for + the detailed description of Doxygen syntax and terms used in this + section. + + 1. Only JavaDoc (/** */) and Qt (/*! */) styles of comment blocks + will be supported by SWIG translator. + + 2. The following doc after members will be supported: + + int var; ///< Detailed description after the member + //!< + + int var; //!< Brief description after the member + + int var; ///< Brief description after the member + + 3. Only comments before or after declaration/definition will be + supported. Comments with structural commands will be ignored + (warning will be written). (What about writing them to + 'package.info.java' for JD?) + + + Tags + ---- + + This section contains all doxygen tags taken from + http://www.stack.nl/~dimitri/doxygen/commands.html. If a tag is + marked as 'ignored', then the tag is ignored, but the text is copied + to the destination documentation. + + Supported: + + \a - translated to in JD, surrounded with _ in PD + \addindex - ignored + \addtogroup - ignored + \anchor - ignored, not supported by JD and PD + \arg - translated to @param in JD, special formatting in PD + \attention - ignored, content printed out + \authors, \author - translated to @author in JD, 'Author:' in PD + \b - in JD, surrounded with __ in PD + \brief - ignored, content printed out + \bug - ignored, content printed out + \c - translated to in JD, ignored in PD + \callgraph - ignored, not supported by JD and PD + \callergraph - ignored, not supported by JD and PD + \category - ignored, used only in Objective C + \cite - translated to in JD, single quotes in PD + \class - ignored (structural command) + \code - translated to in JD, ignored in PD + \cond - translated to 'Conditional comment: '. Later + SWIG may support definitions of conditions in config file. + \copybrief - ignored. Later SWIG may support this command by + performing copy + \copydetails - ignored. Later SWIG may support this command by + performing copy + \copydoc - ignored. Later SWIG may support this command by + performing copy + \copyright - replaced with text 'Copyright' in PD and PD + \date - ignored, content printed out + \def + \defgroup + \deprecated - translated to @deprecated in JD, 'Deprecated:' in PD + \details - ignored, content printed out + \dir - not supported + \dontinclude - not supported + \dot - not supported. Later SWIG may call dot and produce the graph image to include in JD and PD + \dotfile - see note for \dot + \e - translated to in JD + \else - see note for \cond + \elseif - see note for \cond + \em - translated to in JD + \endcode - see note for \code + \endcond - translated to 'End of conditional comment: '. Later + SWIG may support definitions of conditions in config file. + \enddot - see note for \dot + \endhtmlonly - not supported + \endif - see note for \cond + \endinternal - not supported + \endlatexonly - not supported + \endlink - see note for \link + \endmanonly - not supported + \endmsc - see note for \msc + \endrtfonly - not supported + \endverbatim - see note for \verbatim + \endxmlonly - not supported + \enum - ignored (structural command) + \example - translated to 'Example:' in JD and PD + \exception - equivalent to throws + \extends - not supported + \f$ + \f[ + \f] + \f{ + \f} + \file + \fn + \headerfile + \hideinitializer + \htmlinclude + \htmlonly + \if + \ifnot + \image + \implements + \include + \includelineno + \ingroup + \internal + \invariant + \interface + \latexonly + \li + \line + \link + \mainpage + \manonly + \memberof + \msc + \mscfile + \n + \name + \namespace + \nosubgrouping + \note + \overload + \p + \package + \page + \par + \paragraph + \param + \post + \pre + \private + \privatesection + \property + \protected + \protectedsection + \protocol + \public + \publicsection + \ref - ignored, not supported by JD and PD + \related + \relates + \relatedalso + \relatesalso + \remark + \remarks + \result + \return + \returns + \retval + \rtfonly + \sa + \section + \see + \short + \showinitializer + \since + \skip + \skipline + \snippet + \struct + \subpage + \subsection + \subsubsection + \tableofcontents + \test + \throw + \throws + \todo + \tparam + \typedef + \union + \until + \var + \verbatim + \verbinclude + \version + \warning + \weakgroup + \xmlonly + \xrefitem + \$ + \@ + \\ + \& + \~ + \< + \> + \# + \% + \" + \. + \:: + + +Tests +===== + +The following test cases will be implemented: + +- Class comments, JD and Qt style. +- Class comments, JD and Qt style. + +- Struct comments, JD and Qt style. +- Enum comments, JD and Qt style. + +- Class attributes, JD and Qt style, comment before and after declaration. +- Class methods, JD and Qt style, comment of parameters in function + comment. +- Class methods, JD and Qt style, comment of parameters + after parameter declaration. + +- Struct attributes, JD and Qt style, comment before and after declaration. +- Struct methods, JD and Qt style, comment of parameters in function + comment. +- Struct methods, JD and Qt style, comment of parameters + after parameter declaration. + +- Enum items JD and Qt style, comment before items +- Enum items JD and Qt style, comment after items + +- Class comment, JD and Qt style, with all supported tags. +- Class comment, JD and Qt style, with all doxygen tags, including + ignored ones. + + +Refactoring +=========== + +All the code in directory _DoxygenTranslator_ should be refactored: +- all methods should be class members +- most static methods should be normal members +- replace C arrays of strings and sequential searches with STL data + structures and algorithms. +- use singletons instead of class instantiaion for each comment found. + + +Documentation +============= + +SWIG documentation will contain: +- command line options +- list of implemented features (types and placements of comments) +- list of unimplemented features (types and placements of comments) +- list of tags and their translations (all Doxygen tags). + From 0e2f37bc544dd0fbaad632ef4101dc1d7e44cae0 Mon Sep 17 00:00:00 2001 From: Dmitry Kabak Date: Mon, 9 Jul 2012 10:11:29 +0000 Subject: [PATCH 072/314] Extended project plan, now it is also the description of how are the doxygen tags translated git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2012-doxygen@13269 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Doc/Devel/plan-gsoc-2012.txt | 218 ++++++++++++++++++----------------- 1 file changed, 114 insertions(+), 104 deletions(-) diff --git a/Doc/Devel/plan-gsoc-2012.txt b/Doc/Devel/plan-gsoc-2012.txt index 1796bcf78..faf9359f9 100644 --- a/Doc/Devel/plan-gsoc-2012.txt +++ b/Doc/Devel/plan-gsoc-2012.txt @@ -64,19 +64,22 @@ Functionality http://www.stack.nl/~dimitri/doxygen/commands.html. If a tag is marked as 'ignored', then the tag is ignored, but the text is copied to the destination documentation. + Not all of the tags are currently implemented. The status of + implementation and time estimation for every tag may be seen in + plan-gsoc-2012-timings.txt - Supported: + Doxygen tags: \a - translated to in JD, surrounded with _ in PD \addindex - ignored \addtogroup - ignored \anchor - ignored, not supported by JD and PD \arg - translated to @param in JD, special formatting in PD - \attention - ignored, content printed out + \attention - ignored \authors, \author - translated to @author in JD, 'Author:' in PD \b - in JD, surrounded with __ in PD - \brief - ignored, content printed out - \bug - ignored, content printed out + \brief - ignored + \bug - ignored \c - translated to in JD, ignored in PD \callgraph - ignored, not supported by JD and PD \callergraph - ignored, not supported by JD and PD @@ -93,132 +96,139 @@ Functionality \copydoc - ignored. Later SWIG may support this command by performing copy \copyright - replaced with text 'Copyright' in PD and PD - \date - ignored, content printed out + \date - ignored \def \defgroup \deprecated - translated to @deprecated in JD, 'Deprecated:' in PD - \details - ignored, content printed out + \details - ignored \dir - not supported \dontinclude - not supported - \dot - not supported. Later SWIG may call dot and produce the graph image to include in JD and PD + \dot - not supported. Later SWIG may call dot and produce the graph image + to include in JD and PD \dotfile - see note for \dot - \e - translated to in JD + \e - equivalent \a \else - see note for \cond \elseif - see note for \cond - \em - translated to in JD + \em - equivalent to \a \endcode - see note for \code \endcond - translated to 'End of conditional comment: '. Later SWIG may support definitions of conditions in config file. \enddot - see note for \dot - \endhtmlonly - not supported + \endhtmlonly - ignored \endif - see note for \cond - \endinternal - not supported - \endlatexonly - not supported + \endinternal - ignored + \endlatexonly - ignored \endlink - see note for \link - \endmanonly - not supported + \endmanonly - ignored \endmsc - see note for \msc - \endrtfonly - not supported + \endrtfonly - ignored \endverbatim - see note for \verbatim - \endxmlonly - not supported + \endxmlonly - ignored \enum - ignored (structural command) \example - translated to 'Example:' in JD and PD - \exception - equivalent to throws + \exception - equivalent to throws, but translates to @exception in JD \extends - not supported \f$ \f[ \f] \f{ \f} - \file + \file \fn - \headerfile - \hideinitializer - \htmlinclude - \htmlonly - \if - \ifnot - \image - \implements - \include - \includelineno - \ingroup - \internal - \invariant - \interface - \latexonly - \li - \line - \link - \mainpage - \manonly - \memberof - \msc - \mscfile - \n - \name - \namespace - \nosubgrouping - \note - \overload - \p - \package - \page - \par - \paragraph - \param - \post - \pre - \private - \privatesection - \property - \protected - \protectedsection - \protocol - \public - \publicsection + \headerfile - not supported + \hideinitializer - not supported + \htmlinclude - not supported + \htmlonly - not supported + \if - see note for \cond + \ifnot - see note for \cond + \image - translated to in JD only when target=HTML, ignored in PD + \implements - not supported + \include - not supported + \includelineno - not supported + \ingroup - not supported. Later swig may print group names as plain text + in comments like 'Code group: something' in both JD and PD + \internal - ignored + \invariant - ignored + \interface - ignored (structural command) + \latexonly - ignored + \li - trabslated to
  • in JD, ignored in PD + \line - not supported + \link - translated to {@link ...} in JD, ignored in PD + \mainpage - ignored + \manonly - ignored + \memberof - not supported + \msc - not supported. Later SWIG may call dot and produce the graph image + to include in JD and PD + \mscfile - see note for \msc + \n - prints the new line + \name - ignored + \namespace - included in package-info.java if nspace feature is enabled, + otherwise ignored, ignored in PD + \nosubgrouping - ignored + \note - ignored in JD, translated to 'Note:' in PD + \overload - prints 'This is an overloaded member function, provided for + convenience. It differs from the above function only in what + argument(s) it accepts.' to the output in both JD and PD + \p - equivalent to \c + \package - is kept same in JD (it is already a JD tag), ignored in PD + \page - ignored + \par - translated to

    in JD, 'Title: ...' in PD + \paragraph - ignored + \param - equivalent to \arg + \post - ignored + \pre - ignored + \private - ignored + \privatesection - ignored + \property - ignored + \protected - ignored + \protectedsection - ignored + \protocol - ignored (Objective-C tag) + \public - ignored + \publicsection - ignored \ref - ignored, not supported by JD and PD - \related - \relates - \relatedalso - \relatesalso - \remark - \remarks - \result - \return - \returns - \retval - \rtfonly - \sa - \section - \see - \short - \showinitializer - \since - \skip - \skipline - \snippet - \struct - \subpage - \subsection - \subsubsection - \tableofcontents - \test - \throw - \throws - \todo - \tparam - \typedef - \union - \until - \var - \verbatim - \verbinclude - \version - \warning - \weakgroup - \xmlonly - \xrefitem - \$ + \related - ignored + \relates - ignored + \relatedalso - ignored + \relatesalso - ignored + \remark - translated to 'Remarks:' in both JD and PD + \remarks - equivalent to remark + \result - translated to @return in JD, 'Return:' in PD + \return - equivalent to result + \returns - equivalent to result + \retval - ignored + \rtfonly - ignored + \sa - translated to @see in JD, 'See also:' in PD + \section - not supported + \see - equivalent to \sa + \short - equivalent to \brief + \showinitializer - not supported + \since - translated to @since in JD, 'Since:' in PD + \skip - not supported + \skipline - not supported + \snippet - not supported + \struct - ignored (structural command) + \subpage - not supported + \subsection - not supported + \subsubsection - not supported + \tableofcontents - not supported + \test - ignored + \throw - translated to @throws in JD, 'Throws:' in PD + \throws - equivalent to \throw + \todo - translated to 'TODO:' in both JD and PD + \tparam - similar to \arg + \typedef - ignored (structural command) + \union - ignored (structural command) + \until - not supported + \var - ignored (structural command) + \verbatim - translated to {@literal ...} in JD, ignored in PD + \verbinclude - ignored + \version - translated to @version in JD, 'Version:' in PD + \warning - translated to 'Warning:' in both JD and PD + \weakgroup - not supported + \xmlonly - ignored + \xrefitem - ignored + \$ - this and all the others below: these commands insert single char, + it is escaped as HTML char in JD, kept as-is in PD \@ \\ \& From 32166f96f4b44d18d823a208ebf5b732f8e02041 Mon Sep 17 00:00:00 2001 From: Dmitry Kabak Date: Mon, 9 Jul 2012 11:08:56 +0000 Subject: [PATCH 073/314] New fixes for the project plan git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2012-doxygen@13273 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Doc/Devel/plan-gsoc-2012.txt | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/Doc/Devel/plan-gsoc-2012.txt b/Doc/Devel/plan-gsoc-2012.txt index faf9359f9..570457e1a 100644 --- a/Doc/Devel/plan-gsoc-2012.txt +++ b/Doc/Devel/plan-gsoc-2012.txt @@ -23,6 +23,10 @@ There will also be a possiblity to add untranslated comments to Java and Python code (## comments, see Doxygen manual), if the user will prefer to use Doxygen on the generated code. +Note: +time format below is HH:MM. '--Done' tick means that the item is +implemented, commited and working. + Abbreviations: JD - JavaDoc PD - PyDoc @@ -41,6 +45,7 @@ Functionality 1. Only JavaDoc (/** */) and Qt (/*! */) styles of comment blocks will be supported by SWIG translator. + --Done 2. The following doc after members will be supported: @@ -50,11 +55,14 @@ Functionality int var; //!< Brief description after the member int var; ///< Brief description after the member + + --Done 3. Only comments before or after declaration/definition will be supported. Comments with structural commands will be ignored (warning will be written). (What about writing them to 'package.info.java' for JD?) + --Done Tags @@ -63,10 +71,8 @@ Functionality This section contains all doxygen tags taken from http://www.stack.nl/~dimitri/doxygen/commands.html. If a tag is marked as 'ignored', then the tag is ignored, but the text is copied - to the destination documentation. - Not all of the tags are currently implemented. The status of - implementation and time estimation for every tag may be seen in - plan-gsoc-2012-timings.txt + to the destination documentation. 'Not implemented' means that the + tag with it's contents is stripped out of the output. Doxygen tags: @@ -97,8 +103,8 @@ Functionality performing copy \copyright - replaced with text 'Copyright' in PD and PD \date - ignored - \def - \defgroup + \def - ignored (structural command) + \defgroup - not supported \deprecated - translated to @deprecated in JD, 'Deprecated:' in PD \details - ignored \dir - not supported @@ -128,13 +134,14 @@ Functionality \example - translated to 'Example:' in JD and PD \exception - equivalent to throws, but translates to @exception in JD \extends - not supported - \f$ - \f[ - \f] - \f{ - \f} - \file - \fn + \f$ - not supported. Later swig may call LATeX to produce bitmaps with formulas + to include in JD and PD + \f[ - see note for \f$ + \f] - see note for \f$ + \f{ - see note for \f$ + \f} - see note for \f$ + \file - ignored (structural command) + \fn - ignored (structural command) \headerfile - not supported \hideinitializer - not supported \htmlinclude - not supported From 3a3c2b8063154316a51c4fa3f22bfd1382366ae4 Mon Sep 17 00:00:00 2001 From: Dmitry Kabak Date: Mon, 9 Jul 2012 13:56:45 +0000 Subject: [PATCH 074/314] Extended commentParser.java to the standalone java app to print parsed comments git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2012-doxygen@13274 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Examples/test-suite/java/commentParser.java | 24 +++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/Examples/test-suite/java/commentParser.java b/Examples/test-suite/java/commentParser.java index 1b167cfcd..93785669e 100644 --- a/Examples/test-suite/java/commentParser.java +++ b/Examples/test-suite/java/commentParser.java @@ -58,4 +58,28 @@ public class commentParser { return errorCount; } + + public static void printCommentListForJavaSource() { + Iterator< Entry > it = parsedComments.entrySet().iterator(); + while (it.hasNext()) + { + Entry e = (Entry) it.next(); + System.out.format("wantedComments.put(\"%s\", \"%s\");\n", e.getKey(), e.getValue()); + } + } + + public static void main(String argv[]) { + + if (argv.length<1) { + System.out.format("Usage:\n\tcommentParsing \n"); + System.exit(1); + } + + com.sun.tools.javadoc.Main.execute("The comment parser program", + "commentParser", new String[]{"-quiet", argv[0]}); + + // if we are run as standalone app, print the list of found comments as it would appear in java source + + printCommentListForJavaSource(); + } } \ No newline at end of file From dc432411301cd18f5591cebe70e4f660c496f649 Mon Sep 17 00:00:00 2001 From: Dmitry Kabak Date: Mon, 9 Jul 2012 14:02:23 +0000 Subject: [PATCH 075/314] Rewritten doxygen_parsing.cpptest according to the project plan git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2012-doxygen@13275 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Examples/test-suite/doxygen_parsing.i | 152 +++++++++++------- Examples/test-suite/doxygen_parsing_enums.i | 36 ++++- .../doxygen_parsing_enums_proper_runme.java | 12 +- .../doxygen_parsing_enums_simple_runme.java | 9 +- .../doxygen_parsing_enums_typesafe_runme.java | 12 +- ...oxygen_parsing_enums_typeunsafe_runme.java | 12 +- .../java/doxygen_parsing_runme.java | 44 ++--- .../python/doxygen_parsing_runme.py | 37 +++-- 8 files changed, 207 insertions(+), 107 deletions(-) diff --git a/Examples/test-suite/doxygen_parsing.i b/Examples/test-suite/doxygen_parsing.i index a83cd77ed..b4579c886 100644 --- a/Examples/test-suite/doxygen_parsing.i +++ b/Examples/test-suite/doxygen_parsing.i @@ -3,77 +3,119 @@ %inline %{ /** - * This is simple comment for a var + * The class comment */ -int simpleVar=42; -/*! - * This is another type of comment for a var - */ -int simpleVarTwo=42; - -/// This is again another type of comment for a var -int simpleVarThree=42; -//! This is the last type of comment for a var -int simpleVarFour=42; - -int simpleVarFive=42; -///< This is a post comment - -/* - We assume that all this comment types are ok, - and later we only use the first-type comments. -*/ - +class SomeClass +{ +}; /** - * This is simple comment for a function + * The function comment */ -void simpleFunction(int arg) +void someFunction() { } /** - * This is simple comment for a class + * The enum comment */ -class CSimpleClass +enum SomeEnum { -private: - /** Some member var */ - int simpleVar; - -public: - /** - * Simple method - */ - void simpleMethod(int asd) - { - } - /** - * Simple method with parameter - */ - void simpleMethodWithParameter( - int param, /**< Some test param */ - int argument /**< Some test argument */ - ) - { - } + SOME_ENUM_ITEM }; /** - * Comment for template class + * The struct comment */ -template -class CTemplateClass +struct SomeStruct +{ +}; + +/** + * The var comment + */ +int someVar=42; + +class SomeAnotherClass { public: - /** - * Template method - */ - void templateMethod(T arg) - { - } + + /** + * The class attribute comment + */ + int classAttr; + + int classAttr2; ///< The class attribute post-comment + + int classAttr3; ///< The class attribute post-comment + //!< with details + + /** + * The class method comment + */ + void classMethod() + { + } + + /** + * The class method with parameter + */ + void classMethodExtended( + int a, ///< Parameter a + int b ///< Parameter b + ) + { + } + + /** + * The class method with parameter + * + * @param a Parameter a + * @param b Parameter b + */ + void classMethodExtended2(int a, int b) + { + } +}; + +struct SomeAnotherStruct +{ + /** + * The struct attribute comment + */ + int structAttr; + + int structAttr2; ///< The struct attribute post-comment + + int structAttr3; ///< The struct attribute post-comment + //!< with details + + /** + * The struct method comment + */ + void structMethod() + { + } + + /** + * The struct method with parameter + */ + void structMethodExtended( + int a, ///< Parameter a + int b ///< Parameter b + ) + { + } + + /** + * The struct method with parameter + * + * @param a Parameter a + * @param b Parameter b + */ + void structMethodExtended2(int a, int b) + { + } }; %} - -%template(CTemplateClassInt) CTemplateClass; \ No newline at end of file diff --git a/Examples/test-suite/doxygen_parsing_enums.i b/Examples/test-suite/doxygen_parsing_enums.i index 222356510..5c48f4801 100644 --- a/Examples/test-suite/doxygen_parsing_enums.i +++ b/Examples/test-suite/doxygen_parsing_enums.i @@ -3,13 +3,33 @@ %inline %{ -/** Test enumeration */ -enum E_TEST -{ - /** the first item */ - E_TEST_ONE, - E_TEST_TWO = 2, /**< the second */ - E_TEST_THREE = 2+1 /**< the last item */ -}; + /** + * Testing comments before enum items + */ + enum SomeAnotherEnum + { + /** + * The comment for the first item + */ + SOME_ITEM_1, + /** + * The comment for the second item + */ + SOME_ITEM_2, + /** + * The comment for the third item + */ + SOME_ITEM_3 + }; + + /** + * Testing comments after enum items + */ + enum SomeAnotherEnum2 + { + SOME_ITEM_10, ///< Post comment for the first item + SOME_ITEM_20, ///< Post comment for the second item + SOME_ITEM_30 ///< Post comment for the third item + }; %} diff --git a/Examples/test-suite/java/doxygen_parsing_enums_proper_runme.java b/Examples/test-suite/java/doxygen_parsing_enums_proper_runme.java index d3993f201..4531ada51 100644 --- a/Examples/test-suite/java/doxygen_parsing_enums_proper_runme.java +++ b/Examples/test-suite/java/doxygen_parsing_enums_proper_runme.java @@ -25,10 +25,14 @@ public class doxygen_parsing_enums_proper_runme { HashMap wantedComments = new HashMap(); - wantedComments.put("E_TEST", " Test enumeration \n"); - wantedComments.put("E_TEST_ONE", " the first item \n"); - wantedComments.put("E_TEST_TWO", " the second \n"); - wantedComments.put("E_TEST_THREE", " the last item \n"); + wantedComments.put("SomeAnotherEnum", " Testing comments before enum items \n"); + wantedComments.put("SOME_ITEM_1", " The comment for the first item \n"); + wantedComments.put("SOME_ITEM_2", " The comment for the second item \n"); + wantedComments.put("SOME_ITEM_3", " The comment for the third item \n"); + wantedComments.put("SomeAnotherEnum2", " Testing comments after enum items \n"); + wantedComments.put("SOME_ITEM_10", " Post comment for the first item \n"); + wantedComments.put("SOME_ITEM_20", " Post comment for the second item \n"); + wantedComments.put("SOME_ITEM_30", " Post comment for the third item \n"); // and ask the parser to check comments for us System.exit(parser.check(wantedComments)); diff --git a/Examples/test-suite/java/doxygen_parsing_enums_simple_runme.java b/Examples/test-suite/java/doxygen_parsing_enums_simple_runme.java index 1dffe4466..7fba76d5c 100644 --- a/Examples/test-suite/java/doxygen_parsing_enums_simple_runme.java +++ b/Examples/test-suite/java/doxygen_parsing_enums_simple_runme.java @@ -25,9 +25,12 @@ public class doxygen_parsing_enums_simple_runme { HashMap wantedComments = new HashMap(); - wantedComments.put("E_TEST_ONE", " the first item \n"); - wantedComments.put("E_TEST_TWO", " the second \n"); - wantedComments.put("E_TEST_THREE", " the last item \n"); + wantedComments.put("SOME_ITEM_1", " The comment for the first item \n"); + wantedComments.put("SOME_ITEM_2", " The comment for the second item \n"); + wantedComments.put("SOME_ITEM_3", " The comment for the third item \n"); + wantedComments.put("SOME_ITEM_10", " Post comment for the first item \n"); + wantedComments.put("SOME_ITEM_20", " Post comment for the second item \n"); + wantedComments.put("SOME_ITEM_30", " Post comment for the third item \n"); // and ask the parser to check comments for us System.exit(parser.check(wantedComments)); diff --git a/Examples/test-suite/java/doxygen_parsing_enums_typesafe_runme.java b/Examples/test-suite/java/doxygen_parsing_enums_typesafe_runme.java index 5aed9327e..f853ffb3b 100644 --- a/Examples/test-suite/java/doxygen_parsing_enums_typesafe_runme.java +++ b/Examples/test-suite/java/doxygen_parsing_enums_typesafe_runme.java @@ -25,10 +25,14 @@ public class doxygen_parsing_enums_typesafe_runme { HashMap wantedComments = new HashMap(); - wantedComments.put("E_TEST", " Test enumeration \n"); - wantedComments.put("E_TEST_ONE", " the first item \n"); - wantedComments.put("E_TEST_TWO", " the second \n"); - wantedComments.put("E_TEST_THREE", " the last item \n"); + wantedComments.put("SomeAnotherEnum", " Testing comments before enum items \n"); + wantedComments.put("SOME_ITEM_1", " The comment for the first item \n"); + wantedComments.put("SOME_ITEM_2", " The comment for the second item \n"); + wantedComments.put("SOME_ITEM_3", " The comment for the third item \n"); + wantedComments.put("SomeAnotherEnum2", " Testing comments after enum items \n"); + wantedComments.put("SOME_ITEM_10", " Post comment for the first item \n"); + wantedComments.put("SOME_ITEM_20", " Post comment for the second item \n"); + wantedComments.put("SOME_ITEM_30", " Post comment for the third item \n"); // and ask the parser to check comments for us System.exit(parser.check(wantedComments)); diff --git a/Examples/test-suite/java/doxygen_parsing_enums_typeunsafe_runme.java b/Examples/test-suite/java/doxygen_parsing_enums_typeunsafe_runme.java index 44405f837..9788ae1d3 100644 --- a/Examples/test-suite/java/doxygen_parsing_enums_typeunsafe_runme.java +++ b/Examples/test-suite/java/doxygen_parsing_enums_typeunsafe_runme.java @@ -25,10 +25,14 @@ public class doxygen_parsing_enums_typeunsafe_runme { HashMap wantedComments = new HashMap(); - wantedComments.put("E_TEST", " Test enumeration \n"); - wantedComments.put("E_TEST_ONE", " the first item \n"); - wantedComments.put("E_TEST_TWO", " the second \n"); - wantedComments.put("E_TEST_THREE", " the last item \n"); + wantedComments.put("SomeAnotherEnum", " Testing comments before enum items \n"); + wantedComments.put("SOME_ITEM_1", " The comment for the first item \n"); + wantedComments.put("SOME_ITEM_2", " The comment for the second item \n"); + wantedComments.put("SOME_ITEM_3", " The comment for the third item \n"); + wantedComments.put("SomeAnotherEnum2", " Testing comments after enum items \n"); + wantedComments.put("SOME_ITEM_10", " Post comment for the first item \n"); + wantedComments.put("SOME_ITEM_20", " Post comment for the second item \n"); + wantedComments.put("SOME_ITEM_30", " Post comment for the third item \n"); // and ask the parser to check comments for us System.exit(parser.check(wantedComments)); diff --git a/Examples/test-suite/java/doxygen_parsing_runme.java b/Examples/test-suite/java/doxygen_parsing_runme.java index ae426da58..e0719c586 100644 --- a/Examples/test-suite/java/doxygen_parsing_runme.java +++ b/Examples/test-suite/java/doxygen_parsing_runme.java @@ -25,26 +25,30 @@ public class doxygen_parsing_runme { HashMap wantedComments = new HashMap(); - wantedComments.put("simpleFunction", " This is simple comment for a function \n"); - - wantedComments.put("CSimpleClass", " This is simple comment for a class \n"); - wantedComments.put("simpleMethod", " Simple method \n"); - wantedComments.put("simpleMethodWithParameter", " Simple method with parameter \n" + - " @param\tparam Some test param \n" + - " @param\targument Some test argument \n"); - wantedComments.put("CTemplateClassInt", " Comment for template class \n"); - wantedComments.put("templateMethod", " Template method \n"); - - wantedComments.put("setSimpleVar", " This is simple comment for a var \n"); - wantedComments.put("getSimpleVar", " This is simple comment for a var \n"); - wantedComments.put("setSimpleVarTwo", " This is another type of comment for a var \n"); - wantedComments.put("getSimpleVarTwo", " This is another type of comment for a var \n"); - wantedComments.put("setSimpleVarThree", " This is again another type of comment for a var \n"); - wantedComments.put("getSimpleVarThree", " This is again another type of comment for a var \n"); - wantedComments.put("setSimpleVarFour", " This is the last type of comment for a var \n"); - wantedComments.put("getSimpleVarFour", " This is the last type of comment for a var \n"); - wantedComments.put("setSimpleVarFive", " This is a post comment \n"); - wantedComments.put("getSimpleVarFive", " This is a post comment \n"); + wantedComments.put("someFunction", " The function comment \n"); + wantedComments.put("SomeEnum", " The enum comment \n"); + wantedComments.put("setSomeVar", " The var comment \n"); + wantedComments.put("getSomeVar", " The var comment \n"); + wantedComments.put("SomeClass", " The class comment \n"); + wantedComments.put("setClassAttr", " The class attribute comment \n"); + wantedComments.put("getClassAttr", " The class attribute comment \n"); + wantedComments.put("setClassAttr2", " The class attribute post-comment \n"); + wantedComments.put("getClassAttr2", " The class attribute post-comment \n"); + wantedComments.put("setClassAttr3", " The class attribute post-comment with details \n"); + wantedComments.put("getClassAttr3", " The class attribute post-comment with details \n"); + wantedComments.put("classMethod", " The class method comment \n"); + wantedComments.put("classMethodExtended", " The class method with parameter \n @param a Parameter a \n @param b Parameter b \n"); + wantedComments.put("classMethodExtended2", " The class method with parameter \n @param a Parameter a \n @param b Parameter b \n"); + wantedComments.put("SomeStruct", " The struct comment \n"); + wantedComments.put("setStructAttr", " The struct attribute comment \n"); + wantedComments.put("getStructAttr", " The struct attribute comment \n"); + wantedComments.put("setStructAttr2", " The struct attribute post-comment \n"); + wantedComments.put("getStructAttr2", " The struct attribute post-comment \n"); + wantedComments.put("setStructAttr3", " The struct attribute post-comment with details \n"); + wantedComments.put("getStructAttr3", " The struct attribute post-comment with details \n"); + wantedComments.put("structMethod", " The struct method comment \n"); + wantedComments.put("structMethodExtended", " The struct method with parameter \n @param a Parameter a \n @param b Parameter b \n"); + wantedComments.put("structMethodExtended2", " The struct method with parameter \n @param a Parameter a \n @param b Parameter b \n"); // and ask the parser to check comments for us System.exit(parser.check(wantedComments)); diff --git a/Examples/test-suite/python/doxygen_parsing_runme.py b/Examples/test-suite/python/doxygen_parsing_runme.py index 097c18f8c..b814a68ed 100644 --- a/Examples/test-suite/python/doxygen_parsing_runme.py +++ b/Examples/test-suite/python/doxygen_parsing_runme.py @@ -8,13 +8,32 @@ def check(got, expected): if not re.match(str(expected), str(got)): raise RuntimeError("\n" + "Expected: [" + str(expected) + "]\n" + "Got : [" + str(got) + "]") -check(doxygen_parsing.simpleFunction.__doc__, '\s+This is simple comment for a function\s+') -check(doxygen_parsing.CSimpleClass.__doc__, '\s+This is simple comment for a class\s+') -check(doxygen_parsing.CSimpleClass.simpleMethod.__doc__, '\s+Simple method\s+') -check(doxygen_parsing.CSimpleClass.simpleMethodWithParameter.__doc__, '' -'\s+Simple method with parameter' -'\s+Arguments:\s+param \(int\)\s+-- Some test param\s+' -'argument \(int\)\s+-- Some test argument\s+' +check(doxygen_parsing.someFunction.__doc__, '\s+The function comment\s+') +check(doxygen_parsing.SomeClass.__doc__, '\s+The class comment\s+') +check(doxygen_parsing.SomeStruct.__doc__, '\s+The struct comment\s+') +check(doxygen_parsing.SomeAnotherClass.classMethod.__doc__, '\s+The class method comment\s+') +check(doxygen_parsing.SomeAnotherClass.classMethodExtended.__doc__, '' +'\s+The class method with parameter' +'\s+Arguments:\s+' +'a \(int\)\s+-- Parameter a\s+' +'b \(int\)\s+-- Parameter b\s+' ) -check(doxygen_parsing.CTemplateClassInt.__doc__, '\s+Comment for template class\s+') -check(doxygen_parsing.CTemplateClassInt.templateMethod.__doc__, '\s+Template method\s+') \ No newline at end of file +check(doxygen_parsing.SomeAnotherClass.classMethodExtended2.__doc__, '' +'\s+The class method with parameter' +'\s+Arguments:\s+' +'a \(int\)\s+-- Parameter a\s+' +'b \(int\)\s+-- Parameter b\s+' +) +check(doxygen_parsing.SomeAnotherStruct.structMethod.__doc__, '\s+The struct method comment\s+') +check(doxygen_parsing.SomeAnotherStruct.structMethodExtended.__doc__, '' +'\s+The struct method with parameter' +'\s+Arguments:\s+' +'a \(int\)\s+-- Parameter a\s+' +'b \(int\)\s+-- Parameter b\s+' +) +check(doxygen_parsing.SomeAnotherStruct.structMethodExtended2.__doc__, '' +'\s+The struct method with parameter' +'\s+Arguments:\s+' +'a \(int\)\s+-- Parameter a\s+' +'b \(int\)\s+-- Parameter b\s+' +) \ No newline at end of file From 9404bb442cf333b11603c6409871c93cdf16a631 Mon Sep 17 00:00:00 2001 From: Dmitry Kabak Date: Mon, 9 Jul 2012 21:30:11 +0000 Subject: [PATCH 076/314] Added optional functionality section to the project plan. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2012-doxygen@13309 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Doc/Devel/plan-gsoc-2012.txt | 61 +++++++++++++++++++++++------------- 1 file changed, 40 insertions(+), 21 deletions(-) diff --git a/Doc/Devel/plan-gsoc-2012.txt b/Doc/Devel/plan-gsoc-2012.txt index 570457e1a..f9b6849c5 100644 --- a/Doc/Devel/plan-gsoc-2012.txt +++ b/Doc/Devel/plan-gsoc-2012.txt @@ -24,8 +24,8 @@ and Python code (## comments, see Doxygen manual), if the user will prefer to use Doxygen on the generated code. Note: -time format below is HH:MM. '--Done' tick means that the item is -implemented, commited and working. +'--Done' tick below means that the item is implemented, commited and +working. Abbreviations: JD - JavaDoc @@ -248,35 +248,54 @@ Functionality \. \:: - +Optional functionality +====================== + +That section describes some complex cases where the current code +not behaves really well. Like a short to-do list of special cases. + +- When translating functions with default parameters in swig to +java, it creates overloaded functions with all the parameters +except the default ones. We need to copy the doxygen comment to +such functions and correct the list of @param tags. + +- In doxygen there is a special tags (and even a special option) +to create links to some code members from the current comment. +Sometimes it needs a type of parameters specified because of the +overloaded functions. And the same linking tags are supported in JD, +but it has a completely different typesystem, so we need to translate +the types of function parameters in comments also. For example: + + Tests ===== The following test cases will be implemented: -- Class comments, JD and Qt style. -- Class comments, JD and Qt style. +- Class comments. --Done -- Struct comments, JD and Qt style. -- Enum comments, JD and Qt style. +- Struct comments. --Done +- Enum comments. --Done +- Function comments. --Done +- Var comments. --Done -- Class attributes, JD and Qt style, comment before and after declaration. -- Class methods, JD and Qt style, comment of parameters in function - comment. -- Class methods, JD and Qt style, comment of parameters - after parameter declaration. +- Class attributes, comment before and after declaration. --Done +- Class methods, comment of parameters in function + comment. --Done +- Class methods, comment of parameters + after parameter declaration. --Done -- Struct attributes, JD and Qt style, comment before and after declaration. -- Struct methods, JD and Qt style, comment of parameters in function - comment. -- Struct methods, JD and Qt style, comment of parameters - after parameter declaration. +- Struct attributes, comment before and after declaration. --Done +- Struct methods, comment of parameters in function + comment. --Done +- Struct methods, comment of parameters + after parameter declaration. --Done -- Enum items JD and Qt style, comment before items -- Enum items JD and Qt style, comment after items +- Enum items JD and Qt style, comment before items --Done +- Enum items JD and Qt style, comment after items --Done -- Class comment, JD and Qt style, with all supported tags. -- Class comment, JD and Qt style, with all doxygen tags, including +- Class comment, with all supported tags. +- Class comment, with all doxygen tags, including ignored ones. From ed1bd4fbb98662886ccd493a58891dcb65a4428b Mon Sep 17 00:00:00 2001 From: Dmitry Kabak Date: Tue, 10 Jul 2012 17:17:51 +0000 Subject: [PATCH 077/314] Implemented nice error output, with filename and line number information. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2012-doxygen@13313 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Source/CParse/cscanner.c | 4 ++ .../DoxygenTranslator/src/DoxygenParser.cpp | 37 +++++++++--------- Source/DoxygenTranslator/src/DoxygenParser.h | 2 +- .../src/JavaDocConverter.cpp | 6 ++- .../DoxygenTranslator/src/PyDocConverter.cpp | 4 +- Source/DoxygenTranslator/src/TokenList.cpp | 39 ++++++------------- Source/DoxygenTranslator/src/TokenList.h | 6 ++- 7 files changed, 46 insertions(+), 52 deletions(-) diff --git a/Source/CParse/cscanner.c b/Source/CParse/cscanner.c index 44af1069b..e15201b93 100644 --- a/Source/CParse/cscanner.c +++ b/Source/CParse/cscanner.c @@ -344,11 +344,15 @@ static int yylook(void) { if (strncmp(loc, "/**<", 4) == 0 || strncmp(loc, "///<", 4) == 0||strncmp(loc, "/*!<", 4) == 0||strncmp(loc, "//!<", 4) == 0) { /* printf("Doxygen Post Comment: %s lines %d-%d [%s]\n", Char(Scanner_file(scan)), Scanner_start_line(scan), Scanner_line(scan), loc); */ yylval.str = NewString(loc); + Setline(yylval.str, Scanner_start_line(scan)); + Setfile(yylval.str, Scanner_file(scan)); return DOXYGENPOSTSTRING; } if (strncmp(loc, "/**", 3) == 0 || strncmp(loc, "///", 3) == 0||strncmp(loc, "/*!", 3) == 0||strncmp(loc, "//!", 3) == 0) { /* printf("Doxygen Comment: %s lines %d-%d [%s]\n", Char(Scanner_file(scan)), Scanner_start_line(scan), Scanner_line(scan), loc); */ yylval.str = NewString(loc); + Setline(yylval.str, Scanner_start_line(scan)); + Setfile(yylval.str, Scanner_file(scan)); return DOXYGENSTRING; } } diff --git a/Source/DoxygenTranslator/src/DoxygenParser.cpp b/Source/DoxygenTranslator/src/DoxygenParser.cpp index 623d37658..4106cad44 100644 --- a/Source/DoxygenTranslator/src/DoxygenParser.cpp +++ b/Source/DoxygenTranslator/src/DoxygenParser.cpp @@ -156,19 +156,22 @@ std::string DoxygenParser::getStringTilEndCommand(std::string theCommand, TokenL std::string description; if (tokList.peek().tokenType == 0) return ""; - while (tokList.next().tokenString.compare(theCommand) != 0) { + while (tokList.current() != tokList.end()) { + //TODO: it won't output doxygen commands, need a way to fix it if (tokList.peek().tokenType == PLAINSTRING) description += tokList.peek().tokenString + " "; if (tokList.peek().tokenType == END_LINE) description += "\n"; - if (tokList.current() == tokList.end()) { - cout << "Error, @" << theCommand << " command expected." << endl; - break; + if (tokList.peek().tokenString.compare(theCommand) == 0) { + tokList.next(); + return description; } + + tokList.next(); } - tokList.next(); // eat the end command itself + tokList.printListError(theCommand + " command expected"); return description; } @@ -263,7 +266,7 @@ int DoxygenParser::addCommandWord(std::string theCommand, TokenList & tokList, s doxyList.push_back(DoxygenEntity(theCommand, name)); return 1; } else - cout << "No word followed " << theCommand << " command. Not added" << endl; + tokList.printListError("No word followed " + theCommand + " command. Not added"); return 0; } @@ -275,7 +278,7 @@ int DoxygenParser::ignoreCommandWord(std::string theCommand, TokenList & tokList if (!name.empty()) return 1; else - cout << "WARNING: No word followed " << theCommand << " command." << endl; + tokList.printListError("No word followed " + theCommand + " command."); return 0; } @@ -329,7 +332,7 @@ int DoxygenParser::addCommandWordParagraph(std::string theCommand, TokenList & t cout << "Parsing " << theCommand << endl; std::string name = getNextWord(tokList); if (name.empty()) { - cout << "No word followed " << theCommand << " command. Not added" << endl; + tokList.printListError("No word followed " + theCommand + " command. Not added"); return 0; } std::list < Token >::iterator endOfParagraph = getEndOfParagraph(tokList); @@ -345,7 +348,7 @@ int DoxygenParser::addCommandWordLine(std::string theCommand, TokenList & tokLis cout << "Parsing " << theCommand << endl; std::string name = getNextWord(tokList); if (name.empty()) { - cout << "No word followed " << theCommand << " command. Not added" << endl; + tokList.printListError("No word followed " + theCommand + " command. Not added"); return 0; } std::list < Token >::iterator endOfLine = getOneLine(tokList); @@ -362,7 +365,7 @@ int DoxygenParser::addCommandWordOWordOWord(std::string theCommand, TokenList & cout << "Parsing " << theCommand << endl; std::string name = getNextWord(tokList); if (name.empty()) { - cout << "No word followed " << theCommand << " command. Not added" << endl; + tokList.printListError("No word followed " + theCommand + " command. Not added"); return 0; } std::string headerfile = getNextWord(tokList); @@ -387,10 +390,8 @@ int DoxygenParser::addCommandOWord(std::string theCommand, TokenList & tokList, int DoxygenParser::addCommandErrorThrow(std::string theCommand, TokenList & tokList, std::list < DoxygenEntity > &doxyList) { #pragma unused(doxyList) - if (noisy) { - cout << "Encountered :" << theCommand << endl; - cout << "This command should not have been encountered. Behaviour past this may be unpredictable " << endl; - } + tokList.printListError("Encountered: " + theCommand + + "\nThis command should not have been encountered. Behaviour past this may be unpredictable"); std::list < Token >::iterator endOfLine = getOneLine(tokList); tokList.setIterator(endOfLine); return 0; @@ -464,7 +465,7 @@ int DoxygenParser::addCommandUnique(std::string theCommand, TokenList & tokList, cout << "Parsing " << theCommand << endl; std::string name = getNextWord(tokList); if (name.empty()) { - cout << "No word followed " << theCommand << " command. Not added" << endl; + tokList.printListError("No word followed " + theCommand + " command. Not added"); return 0; } std::list < DoxygenEntity > aNewList; @@ -509,7 +510,7 @@ int DoxygenParser::addCommandUnique(std::string theCommand, TokenList & tokList, cout << "Parsing " << theCommand << endl; std::string name = getNextWord(tokList); if (name.empty()) { - cout << "No word followed " << theCommand << " command. Not added" << endl; + tokList.printListError("No word followed " + theCommand + " command. Not added"); return 0; } std::list < DoxygenEntity > aNewList; @@ -611,8 +612,8 @@ std::list < DoxygenEntity > DoxygenParser::parse(std::list < Token >::iterator e return aNewList; } -std::list < DoxygenEntity > DoxygenParser::createTree(std::string doxygenBlob) { - TokenList tokList = TokenList(doxygenBlob); +std::list < DoxygenEntity > DoxygenParser::createTree(std::string doxygenBlob, std::string fileName, int lineNumber) { + TokenList tokList(doxygenBlob, fileName, lineNumber); if (noisy) { cout << "---TOKEN LIST---" << endl; tokList.printList(); diff --git a/Source/DoxygenTranslator/src/DoxygenParser.h b/Source/DoxygenTranslator/src/DoxygenParser.h index 8becdff02..c72ca6fed 100644 --- a/Source/DoxygenTranslator/src/DoxygenParser.h +++ b/Source/DoxygenTranslator/src/DoxygenParser.h @@ -21,7 +21,7 @@ class DoxygenParser { public: DoxygenParser(); virtual ~DoxygenParser(); - std::list < DoxygenEntity > createTree(std::string doxygen); + std::list < DoxygenEntity > createTree(std::string doxygen, std::string fileName, int lineNumber); private: /* diff --git a/Source/DoxygenTranslator/src/JavaDocConverter.cpp b/Source/DoxygenTranslator/src/JavaDocConverter.cpp index 7bdda082e..2bc3165f4 100644 --- a/Source/DoxygenTranslator/src/JavaDocConverter.cpp +++ b/Source/DoxygenTranslator/src/JavaDocConverter.cpp @@ -163,7 +163,9 @@ void JavaDocConverter::handleParagraph(JavaDocConverter* converter, DoxygenEntit translatedComment += converter->formatCommand(converter->translateSubtree(tag), 0); } void JavaDocConverter::handlePlainString(JavaDocConverter* converter, DoxygenEntity& tag, std::string& translatedComment) { - translatedComment += tag.data + " "; + translatedComment += tag.data; + if (tag.data.size() && tag.data[tag.data.size()-1] != ' ') + translatedComment += " "; } String *JavaDocConverter::makeDocumentation(Node *node) { @@ -174,7 +176,7 @@ String *JavaDocConverter::makeDocumentation(Node *node) { return NULL; } - std::list < DoxygenEntity > entityList = parser.createTree(Char(documentation)); + std::list < DoxygenEntity > entityList = parser.createTree(Char(documentation), Char(Getfile(documentation)), Getline(documentation)); // entityList.sort(CompareDoxygenEntities()); sorting currently not used, // see CompareDoxygenEntities::operator() in DoxygenEntity.cpp diff --git a/Source/DoxygenTranslator/src/PyDocConverter.cpp b/Source/DoxygenTranslator/src/PyDocConverter.cpp index b1e94a062..819c6bc6c 100644 --- a/Source/DoxygenTranslator/src/PyDocConverter.cpp +++ b/Source/DoxygenTranslator/src/PyDocConverter.cpp @@ -170,7 +170,7 @@ String *PyDocConverter::makeDocumentation(Node *n) { while (n) { documentation = getDoxygenComment(n); if (!Swig_is_generated_overload(n) && documentation) { - std::list < DoxygenEntity > entityList = DoxygenParser().createTree(Char(documentation)); + std::list < DoxygenEntity > entityList = parser.createTree(Char(documentation), Char(Getfile(documentation)), Getline(documentation)); allDocumentation.push_back(processEntityList(n, entityList)); } n = Getattr(n, "sym:nextSibling"); @@ -194,7 +194,7 @@ String *PyDocConverter::makeDocumentation(Node *n) { else { documentation = getDoxygenComment(n); if (documentation != NULL) { - std::list < DoxygenEntity > entityList = DoxygenParser().createTree(Char(documentation)); + std::list < DoxygenEntity > entityList = parser.createTree(Char(documentation), Char(Getfile(documentation)), Getline(documentation)); pyDocString = processEntityList(n, entityList); } } diff --git a/Source/DoxygenTranslator/src/TokenList.cpp b/Source/DoxygenTranslator/src/TokenList.cpp index 5e13fe164..8624fb4a2 100644 --- a/Source/DoxygenTranslator/src/TokenList.cpp +++ b/Source/DoxygenTranslator/src/TokenList.cpp @@ -14,6 +14,7 @@ #include #include #include +#include "swig.h" #include "Token.h" #include "DoxygenEntity.h" #define TOKENSPERLINE 8; //change this to change the printing behaviour of the token list @@ -22,37 +23,11 @@ using namespace std; int noisy2 = 0; /* The tokenizer*/ -TokenList::TokenList(const std::string & doxygenStringConst) { +TokenList::TokenList(const std::string & doxygenStringConst, const std::string fileName, int fileLine) + : fileName(fileName), fileLine(fileLine) { size_t commentPos; string doxygenString = doxygenStringConst; - /* Comment start tokens are replaced in parser.y, see doxygen_comment and - doxygen_post_comment_item - do { - commentPos = doxygenString.find("///<"); - if (commentPos != string::npos) { - doxygenString.replace(commentPos, 4, " "); - continue; - } - commentPos = doxygenString.find("/**<"); - if (commentPos != string::npos) { - doxygenString.replace(commentPos, 4, " "); - continue; - } - commentPos = doxygenString.find("/*!<"); - if (commentPos != string::npos) { - doxygenString.replace(commentPos, 4, " "); - continue; - } - commentPos = doxygenString.find("//!<"); - if (commentPos != string::npos) { - doxygenString.replace(commentPos, 4, " "); - continue; - } - break; - } while (true); - */ - size_t currentIndex = 0; size_t nextIndex = 0; @@ -174,3 +149,11 @@ void TokenList::printList() { i++; } } + +void TokenList::printListError(std::string message) { + int curLine = fileLine; + for (list< Token >::iterator it = m_tokenList.begin(); it != current(); it++) + if (it->tokenType == END_LINE) + curLine++; + Swig_error(fileName.c_str(), curLine, "Doxygen parser error: %s. \n", message.c_str()); +} diff --git a/Source/DoxygenTranslator/src/TokenList.h b/Source/DoxygenTranslator/src/TokenList.h index 057f67ed4..d38fec792 100644 --- a/Source/DoxygenTranslator/src/TokenList.h +++ b/Source/DoxygenTranslator/src/TokenList.h @@ -25,9 +25,12 @@ class TokenList { private: std::list < Token > m_tokenList; std::list < Token >::iterator m_tokenListIter; + // location info for error output + std::string fileName; + int fileLine; public: - TokenList(const std::string & doxygenString); /* constructor takes a blob of Doxygen comment */ + TokenList(const std::string & doxygenString, const std::string fileName, int fileLine); /* constructor takes a blob of Doxygen comment */ ~TokenList(); Token peek(); /* returns next token without advancing */ @@ -40,6 +43,7 @@ public: void setIterator(list < Token >::iterator newPosition); /*moves up the iterator */ void printList(); /* prints out the sequence of tokens */ + void printListError(std::string message); /* prints properly formatted error message */ }; #endif From be2116603477e83f708fd9151fac745eec6b41e0 Mon Sep 17 00:00:00 2001 From: Dmitry Kabak Date: Wed, 11 Jul 2012 22:24:36 +0000 Subject: [PATCH 078/314] Added parsing support for some new commands git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2012-doxygen@13314 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- .../DoxygenTranslator/src/DoxygenCommands.h | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/Source/DoxygenTranslator/src/DoxygenCommands.h b/Source/DoxygenTranslator/src/DoxygenCommands.h index e1eba33f4..93898193c 100644 --- a/Source/DoxygenTranslator/src/DoxygenCommands.h +++ b/Source/DoxygenTranslator/src/DoxygenCommands.h @@ -4,8 +4,8 @@ const char *commandArray[] = { "a", "addindex", "addtogroup", "anchor", "arg", "attention", - "author", "b", "brief", "bug", "c", "callgraph", "callergraph", "category", - "class", "code", "cond", "copybrief", "copydetails", "copydoc", "date", "def", + "author", "authors", "b", "brief", "bug", "c", "callgraph", "callergraph", "category", "cite", + "class", "code", "cond", "copybrief", "copydetails", "copydoc", "copyright", "date", "def", "defgroup", "deprecated", "details", "dir", "dontinclude", "dot", "dotfile", "e", "else", "elseif", "em", "endcode", "endcond", "enddot", "endhtmlonly", "endif", "endlatexonly", "endlink", "endmanonly", "endmsc", "endverbatim", "endxmlonly", @@ -15,21 +15,21 @@ const char *commandArray[] = { "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", + "public", "publicsection", "ref", "relates", "relatesalso", "remarks", "remark", "result", "return", "returns", "retval", "sa", "section", "see", "showinitializer", "since", "skip", "skipline", "struct", "subpage", "subsection", "subsubsection", "test", "throw", "throws", "todo", "tparam", "typedef", "union", "until", "var", "verbatim", "verbinclude", "version", "warning", "weakgroup", "xmlonly", "xrefitem", "$", "@", "\\", "&", "~", "<", ">", "#", "%"}; const char *sectionIndicators[] = { - "attention", "author", "brief", "bug", "cond", "date", "deprecated", "details", + "attention", "author", "authors", "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", "throws", "todo", "version", "warning", "xrefitem"}; + "tparam", "post", "pre", "remarks", "remark", "result", "return", "returns", "retval", "sa", "see", "since", "test", "throw", "throws", "todo", "version", "warning", "xrefitem"}; const int sectionIndicatorsSize = sizeof(sectionIndicators) / sizeof(*sectionIndicators); /* All of the doxygen commands divided up by how they are parsed */ const char *simpleCommands[] = { - "n", "$", "@", "\\", "&", "~", "<", ">", "#", "%"}; + "n", "$", "@", "\\", "&", "~", "<", ">", "#", "%", "\"", ".", "::", "endcond"}; const int simpleCommandsSize = sizeof(simpleCommands) / sizeof(*simpleCommands); const char *ignoredSimpleCommands[] = { @@ -37,7 +37,8 @@ const char *ignoredSimpleCommands[] = { const int ignoredSimpleCommandsSize = sizeof(ignoredSimpleCommands) / sizeof(*ignoredSimpleCommands); const char *commandWords[] = { - "a", "b", "c", "e", "em", "p", "def", "enum", "example", "package", "relates", "namespace", "relatesalso", "anchor", "dontinclude", "include", "includelineno"}; + "a", "b", "c", "e", "em", "p", "def", "enum", "example", "package", "relates", "namespace", "relatesalso", "anchor", "dontinclude", "include", + "includelineno"}; const int commandWordsSize = sizeof(commandWords) / sizeof(*commandWords); const char *ignoredCommandWords[] = { @@ -53,8 +54,9 @@ const char *ignoreCommandLines[] = { const int ignoreCommandLinesSize = sizeof(ignoreCommandLines) / sizeof(*ignoreCommandLines); const char *commandParagraph[] = { - "partofdescription", "return", "remarks", "since", "test", "sa", "see", "pre", "post", "details", "invariant", - "deprecated", "date", "note", "warning", "version", "todo", "bug", "attention", "brief", "author"}; + "partofdescription", "result", "return", "returns", "remarks", "remark", "since", "test", "sa", "see", "pre", "post", "details", "invariant", + "deprecated", "date", "note", "warning", "version", "todo", "bug", "attention", "brief", "author", "authors", "cite", + "copyright"}; const int commandParagraphSize = sizeof(commandParagraph) / sizeof(*commandParagraph); const char *ignoreCommandParagraphs[] = { @@ -62,7 +64,7 @@ const char *ignoreCommandParagraphs[] = { const int ignoreCommandParagraphsSize = sizeof(ignoreCommandParagraphs) / sizeof(*ignoreCommandParagraphs); const char *commandEndCommands[] = { - "code", "dot", "msc", "f$", "f[", "f{environment}{", "htmlonly", "latexonly", "manonly", "verbatim", "xmlonly", "cond", "if", "ifnot", "link"}; + "code", "dot", "msc", "f$", "f[", "f{environment}{", "htmlonly", "latexonly", "manonly", "verbatim", "xmlonly", "if", "ifnot", "link"}; const int commandEndCommandsSize = sizeof(commandEndCommands) / sizeof(*commandEndCommands); const char *commandWordParagraphs[] = { @@ -85,11 +87,11 @@ const char *commandErrorThrowings[] = { "annotatedclassstd::list", "classhierarchy", "define", "functionindex", "header", "headerfilestd::list", "inherit", "l", "postheader", "private", "privatesection", "protected", "protectedsection", "public", "publicsection", "endcode", "enddot", "endmsc", "endhtmlonly", - "endlatexonly", "endmanonly", "endlink", "endverbatim", "endxmlonly", "f]", "f}", "endcond", "endif"}; + "endlatexonly", "endmanonly", "endlink", "endverbatim", "endxmlonly", "f]", "f}", "endif"}; const int commandErrorThrowingsSize = sizeof(commandErrorThrowings) / sizeof(*commandErrorThrowings); const char *commandUniques[] = { "xrefitem", "arg", "ingroup", "par", "headerfile", "overload", "weakgroup", "ref", "subpage", "dotfile", "image", "addtogroup", "li"}; const int commandUniquesSize = sizeof(commandUniques) / sizeof(*commandUniques); -#endif \ No newline at end of file +#endif From c461f1110d9a4351913c37ee84e9d37a0c406118 Mon Sep 17 00:00:00 2001 From: Dmitry Kabak Date: Wed, 11 Jul 2012 22:25:34 +0000 Subject: [PATCH 079/314] Small fixes to the project plan git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2012-doxygen@13315 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Doc/Devel/plan-gsoc-2012.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Doc/Devel/plan-gsoc-2012.txt b/Doc/Devel/plan-gsoc-2012.txt index f9b6849c5..a32878375 100644 --- a/Doc/Devel/plan-gsoc-2012.txt +++ b/Doc/Devel/plan-gsoc-2012.txt @@ -80,7 +80,7 @@ Functionality \addindex - ignored \addtogroup - ignored \anchor - ignored, not supported by JD and PD - \arg - translated to @param in JD, special formatting in PD + \arg - equivalent to \li \attention - ignored \authors, \author - translated to @author in JD, 'Author:' in PD \b - in JD, surrounded with __ in PD @@ -134,7 +134,7 @@ Functionality \example - translated to 'Example:' in JD and PD \exception - equivalent to throws, but translates to @exception in JD \extends - not supported - \f$ - not supported. Later swig may call LATeX to produce bitmaps with formulas + \f$ - ignored. Later swig may call LATeX to produce bitmaps with formulas to include in JD and PD \f[ - see note for \f$ \f] - see note for \f$ @@ -145,7 +145,7 @@ Functionality \headerfile - not supported \hideinitializer - not supported \htmlinclude - not supported - \htmlonly - not supported + \htmlonly - ignored \if - see note for \cond \ifnot - see note for \cond \image - translated to in JD only when target=HTML, ignored in PD @@ -181,7 +181,7 @@ Functionality \page - ignored \par - translated to

    in JD, 'Title: ...' in PD \paragraph - ignored - \param - equivalent to \arg + \param - translated to @param in JD, special formatting in PD \post - ignored \pre - ignored \private - ignored From 5500046b09468d7b86e43c7f9f284969b8d754dc Mon Sep 17 00:00:00 2001 From: Dmitry Kabak Date: Wed, 11 Jul 2012 22:27:34 +0000 Subject: [PATCH 080/314] Added testcase with a set of all supported doxygen tags git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2012-doxygen@13316 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Examples/test-suite/doxygen_translate.i | 115 ++++++++++++++++++++++++ 1 file changed, 115 insertions(+) create mode 100644 Examples/test-suite/doxygen_translate.i diff --git a/Examples/test-suite/doxygen_translate.i b/Examples/test-suite/doxygen_translate.i new file mode 100644 index 000000000..5f3bd1b39 --- /dev/null +++ b/Examples/test-suite/doxygen_translate.i @@ -0,0 +1,115 @@ +%module doxygen_translate + +%inline %{ + +/** + * \a Hello + * + * \arg some list item + * + * \authors lots of them + * + * \author Zubr + * + * \b boldword + * + * \c codeword + * + * \cite citationword + * + * \code some test code \endcode + * + * \cond SOMECONDITION + * Some conditional comment + * \endcond + * + * \copyright some copyright + * + * \deprecated Now use another function + * + * \e italicword + * + * \if ANOTHERCONDITION + * First part of comment + * \else + * Second part of comment + * \endif + * + * \example someFile.txt + * Some details on using the example + * + * \exception SuperError + * + * \ifnot CONDITION + * Write something if not + * \endifnot + * + * \image html testImage.bmp + * + *
      + * + * \li Some unordered list + * \li With lots of items + * \li lots of lots of items + * + *
    + * + * \link someMember Some description follows \endlink + * + * \n \n \n + * + * \overload + * + * \p someword + * + * \package superPackage + * + * \par The paragraph title + * The paragraph text. + * Maybe even multiline + * + * \param a the first param + * + * \remark Some remark text + * + * \remarks Another remarks section + * + * \result Whatever + * + * \return it + * + * \returns may return + * + * \sa someOtherMethod + * + * \see function + * + * \since version 0.0.0.1 + * + * \throw superException + * + * \throws RuntimeError + * + * \todo Some very important task + * + * \tparam b B is mentioned again... + * + * \verbatim + * very long + * text with tags + * \endverbatim + * + * \version 0.0.0.2 + * + * \warning This is senseless! + * + * Here goes test of symbols: + * \$ \@ \\ \& \~ \< \> \# \% \" \. \:: + * + * And here goes simple text + */ +int function(int a, float b) +{ +} + +%} \ No newline at end of file From 6a54fe93ad625e0c41699837db7efe91ccf40949 Mon Sep 17 00:00:00 2001 From: Dmitry Kabak Date: Thu, 12 Jul 2012 17:02:04 +0000 Subject: [PATCH 081/314] Added support for parsing of nested conditional comments and extended the test git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2012-doxygen@13317 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Examples/test-suite/doxygen_translate.i | 28 +++++-- .../DoxygenTranslator/src/DoxygenCommands.h | 7 +- .../DoxygenTranslator/src/DoxygenParser.cpp | 84 +++++++++++++++---- 3 files changed, 91 insertions(+), 28 deletions(-) diff --git a/Examples/test-suite/doxygen_translate.i b/Examples/test-suite/doxygen_translate.i index 5f3bd1b39..04f70f014 100644 --- a/Examples/test-suite/doxygen_translate.i +++ b/Examples/test-suite/doxygen_translate.i @@ -29,20 +29,30 @@ * * \e italicword * - * \if ANOTHERCONDITION - * First part of comment - * \else - * Second part of comment - * \endif - * * \example someFile.txt * Some details on using the example * * \exception SuperError * - * \ifnot CONDITION - * Write something if not - * \endifnot + * \if ANOTHERCONDITION + * First part of comment + * \if SECONDCONDITION + * Nested condition text + * \elseif THIRDCONDITION + * The third condition text + * \else + * The last text block + * \endif + * \else + * Second part of comment + * \if CONDITION + * Second part extended + * \endif + * \endif + * + * \ifnot SOMECONDITION + * This is printed if not + * \endif * * \image html testImage.bmp * diff --git a/Source/DoxygenTranslator/src/DoxygenCommands.h b/Source/DoxygenTranslator/src/DoxygenCommands.h index 93898193c..8b933878b 100644 --- a/Source/DoxygenTranslator/src/DoxygenCommands.h +++ b/Source/DoxygenTranslator/src/DoxygenCommands.h @@ -64,7 +64,7 @@ const char *ignoreCommandParagraphs[] = { const int ignoreCommandParagraphsSize = sizeof(ignoreCommandParagraphs) / sizeof(*ignoreCommandParagraphs); const char *commandEndCommands[] = { - "code", "dot", "msc", "f$", "f[", "f{environment}{", "htmlonly", "latexonly", "manonly", "verbatim", "xmlonly", "if", "ifnot", "link"}; + "code", "dot", "msc", "f$", "f[", "f{environment}{", "htmlonly", "latexonly", "manonly", "verbatim", "xmlonly", "link"}; const int commandEndCommandsSize = sizeof(commandEndCommands) / sizeof(*commandEndCommands); const char *commandWordParagraphs[] = { @@ -87,11 +87,12 @@ const char *commandErrorThrowings[] = { "annotatedclassstd::list", "classhierarchy", "define", "functionindex", "header", "headerfilestd::list", "inherit", "l", "postheader", "private", "privatesection", "protected", "protectedsection", "public", "publicsection", "endcode", "enddot", "endmsc", "endhtmlonly", - "endlatexonly", "endmanonly", "endlink", "endverbatim", "endxmlonly", "f]", "f}", "endif"}; + "endlatexonly", "endmanonly", "endlink", "endverbatim", "endxmlonly", "f]", "f}", "endif", "else"}; const int commandErrorThrowingsSize = sizeof(commandErrorThrowings) / sizeof(*commandErrorThrowings); const char *commandUniques[] = { - "xrefitem", "arg", "ingroup", "par", "headerfile", "overload", "weakgroup", "ref", "subpage", "dotfile", "image", "addtogroup", "li"}; + "xrefitem", "arg", "ingroup", "par", "headerfile", "overload", "weakgroup", "ref", "subpage", "dotfile", "image", "addtogroup", "li", + "if", "ifnot", "elseif", "else"}; const int commandUniquesSize = sizeof(commandUniques) / sizeof(*commandUniques); #endif diff --git a/Source/DoxygenTranslator/src/DoxygenParser.cpp b/Source/DoxygenTranslator/src/DoxygenParser.cpp index 4106cad44..b47320268 100644 --- a/Source/DoxygenTranslator/src/DoxygenParser.cpp +++ b/Source/DoxygenTranslator/src/DoxygenParser.cpp @@ -164,7 +164,7 @@ std::string DoxygenParser::getStringTilEndCommand(std::string theCommand, TokenL if (tokList.peek().tokenType == END_LINE) description += "\n"; - if (tokList.peek().tokenString.compare(theCommand) == 0) { + if (tokList.peek().tokenString == theCommand) { tokList.next(); return description; } @@ -207,7 +207,7 @@ std::list < Token >::iterator DoxygenParser::getEndOfSection(std::string theComm std::list < Token >::iterator endOfParagraph = tokList.iteratorCopy(); while (endOfParagraph != tokList.end()) { if ((*endOfParagraph).tokenType == COMMAND) { - if (theCommand.compare((*endOfParagraph).tokenString) == 0) + if (theCommand == (*endOfParagraph).tokenString) return endOfParagraph; else endOfParagraph++; @@ -228,7 +228,7 @@ std::list < Token >::iterator DoxygenParser::getEndCommand(std::string theComman std::list < Token >::iterator endOfCommand = tokList.iteratorCopy(); while (endOfCommand != tokList.end()) { if ((*endOfCommand).tokenType == COMMAND) { - if (theCommand.compare((*endOfCommand).tokenString) == 0) { + if (theCommand == (*endOfCommand).tokenString) { return endOfCommand; } endOfCommand++; @@ -399,14 +399,14 @@ int DoxygenParser::addCommandErrorThrow(std::string theCommand, TokenList & tokL int DoxygenParser::addCommandUnique(std::string theCommand, TokenList & tokList, std::list < DoxygenEntity > &doxyList) { std::list < DoxygenEntity > aNewList; - if (theCommand.compare("arg") == 0 || theCommand.compare("li") == 0) { + if (theCommand == "arg" || theCommand == "li") { std::list < Token >::iterator endOfSection = getEndOfSection(theCommand, tokList); std::list < DoxygenEntity > aNewList; aNewList = parse(endOfSection, tokList); doxyList.push_back(DoxygenEntity(theCommand, aNewList)); } // \xrefitem "(heading)" "(std::list title)" {text} - else if (theCommand.compare("xrefitem") == 0) { + else if (theCommand == "xrefitem") { //TODO Implement xrefitem if (noisy) cout << "Not Adding " << theCommand << endl; @@ -415,7 +415,7 @@ int DoxygenParser::addCommandUnique(std::string theCommand, TokenList & tokList, return 1; } // \ingroup ( [ ]) - else if (theCommand.compare("ingroup") == 0) { + else if (theCommand == "ingroup") { std::string name = getNextWord(tokList); aNewList.push_back(DoxygenEntity("plainstd::string", name)); name = getNextWord(tokList); @@ -428,7 +428,7 @@ int DoxygenParser::addCommandUnique(std::string theCommand, TokenList & tokList, return 1; } // \par [(paragraph title)] { paragraph } - else if (theCommand.compare("par") == 0) { + else if (theCommand == "par") { std::list < Token >::iterator endOfLine = getOneLine(tokList); aNewList = parse(endOfLine, tokList); std::list < DoxygenEntity > aNewList2; @@ -438,7 +438,7 @@ int DoxygenParser::addCommandUnique(std::string theCommand, TokenList & tokList, return 1; } // \headerfile [] - else if (theCommand.compare("headerfile") == 0) { + else if (theCommand == "headerfile") { std::list < DoxygenEntity > aNewList; std::string name = getNextWord(tokList); aNewList.push_back(DoxygenEntity("plainstd::string", name)); @@ -449,7 +449,7 @@ int DoxygenParser::addCommandUnique(std::string theCommand, TokenList & tokList, return 1; } // \overload [(function declaration)] - else if (theCommand.compare("overload") == 0) { + else if (theCommand == "overload") { std::list < Token >::iterator endOfLine = getOneLine(tokList); if (endOfLine != tokList.current()) { std::list < DoxygenEntity > aNewList; @@ -460,7 +460,7 @@ int DoxygenParser::addCommandUnique(std::string theCommand, TokenList & tokList, return 1; } // \weakgroup [(title)] - else if (theCommand.compare("weakgroup") == 0) { + else if (theCommand == "weakgroup") { if (noisy) cout << "Parsing " << theCommand << endl; std::string name = getNextWord(tokList); @@ -477,7 +477,7 @@ int DoxygenParser::addCommandUnique(std::string theCommand, TokenList & tokList, doxyList.push_back(DoxygenEntity(theCommand, aNewList)); } // \ref ["(text)"] - else if (theCommand.compare("ref") == 0) { + else if (theCommand == "ref") { //TODO Implement ref if (noisy) cout << "Not Adding " << theCommand << endl; @@ -485,7 +485,7 @@ int DoxygenParser::addCommandUnique(std::string theCommand, TokenList & tokList, tokList.setIterator(endOfParagraph); } // \subpage ["(text)"] - else if (theCommand.compare("subpage") == 0) { + else if (theCommand == "subpage") { //TODO implement subpage if (noisy) cout << "Not Adding " << theCommand << endl; @@ -493,7 +493,7 @@ int DoxygenParser::addCommandUnique(std::string theCommand, TokenList & tokList, tokList.setIterator(endOfParagraph); } // \dotfile ["caption"] - else if (theCommand.compare("dotfile") == 0) { + else if (theCommand == "dotfile") { //TODO implement dotfile if (noisy) cout << "Not Adding " << theCommand << endl; @@ -501,11 +501,11 @@ int DoxygenParser::addCommandUnique(std::string theCommand, TokenList & tokList, tokList.setIterator(endOfParagraph); } // \image ["caption"] [=] - else if (theCommand.compare("image") == 0) { + else if (theCommand == "image") { //todo implement image } // \addtogroup [(title)] - else if (theCommand.compare("addtogroup") == 0) { + else if (theCommand == "addtogroup") { if (noisy) cout << "Parsing " << theCommand << endl; std::string name = getNextWord(tokList); @@ -521,12 +521,64 @@ int DoxygenParser::addCommandUnique(std::string theCommand, TokenList & tokList, aNewList.push_front(DoxygenEntity("plainstd::string", name)); doxyList.push_back(DoxygenEntity(theCommand, aNewList)); } + // \if [\else ...] [\elseif ...] \endif + else if (theCommand == "if" || theCommand == "ifnot" || + theCommand == "else" || theCommand == "elseif") { + if (noisy) + cout << "Parsing " << theCommand << endl; + + std::string cond; + bool skipEndif = false; // if true then we skip endif after parsing block of code + bool needsCond = (theCommand == "if" || theCommand == "ifnot" || theCommand == "elseif"); + if (needsCond) { + cond = getNextWord(tokList); + if (cond.empty()) { + tokList.printListError("No word followed " + theCommand + " command. Not added"); + return 0; + } + } + + int nestedCounter = 1; + std::list < Token >::iterator endCommand = tokList.end(); + // go through the commands and find closing endif or else or elseif + std::list < Token >::iterator it=tokList.iteratorCopy(); + for (; it!=tokList.end(); it++) { + if (it->tokenType == COMMAND) { + if (it->tokenString == "if" || it->tokenString == "ifnot") + nestedCounter++; + else if (it->tokenString == "endif") + nestedCounter--; + if (nestedCounter == 1 && (it->tokenString == "else" || it->tokenString == "elseif")) { // else found + endCommand = it; + break; + } + if (nestedCounter == 0) { // endif found + endCommand = it; + skipEndif = true; + break; + } + } + } + + if (endCommand == tokList.end()) { + tokList.printListError("No corresponding endif found"); + return 0; + } + + std::list < DoxygenEntity > aNewList; + aNewList = parse(endCommand, tokList); + if (skipEndif) + tokList.next(); + if (needsCond) + aNewList.push_front(DoxygenEntity("plainstd::string", cond)); + doxyList.push_back(DoxygenEntity(theCommand, aNewList)); + } return 0; } int DoxygenParser::addCommand(std::string commandString, TokenList & tokList, std::list < DoxygenEntity > &doxyList) { std::string theCommand = StringToLower(commandString); - if (theCommand.compare("plainstd::string") == 0) { + if (theCommand == "plainstd::string") { std::string nextPhrase = getStringTilCommand(tokList); if (noisy) cout << "Parsing plain std::string :" << nextPhrase << endl; From 6a7fe334beee85e9d169d7c3330e1d9756e2d105 Mon Sep 17 00:00:00 2001 From: Dmitry Kabak Date: Fri, 13 Jul 2012 10:46:59 +0000 Subject: [PATCH 082/314] Implemented parsing support for missing commands: \xrefitem, \ref, \subpage, \dotfile, \mscfile, \image, fixed \par git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2012-doxygen@13319 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- .../DoxygenTranslator/src/DoxygenCommands.h | 8 +- .../DoxygenTranslator/src/DoxygenParser.cpp | 98 +++++++++++++++---- 2 files changed, 84 insertions(+), 22 deletions(-) diff --git a/Source/DoxygenTranslator/src/DoxygenCommands.h b/Source/DoxygenTranslator/src/DoxygenCommands.h index 8b933878b..1b24eff33 100644 --- a/Source/DoxygenTranslator/src/DoxygenCommands.h +++ b/Source/DoxygenTranslator/src/DoxygenCommands.h @@ -12,7 +12,7 @@ const char *commandArray[] = { "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", + "line", "link", "mainpage", "manonly", "msc", "mscfile", "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", "remark", "result", "return", "returns", "retval", @@ -37,7 +37,7 @@ const char *ignoredSimpleCommands[] = { const int ignoredSimpleCommandsSize = sizeof(ignoredSimpleCommands) / sizeof(*ignoredSimpleCommands); const char *commandWords[] = { - "a", "b", "c", "e", "em", "p", "def", "enum", "example", "package", "relates", "namespace", "relatesalso", "anchor", "dontinclude", "include", + "a", "b", "c", "e", "em", "p", "def", "enum", "package", "relates", "namespace", "relatesalso", "anchor", "dontinclude", "include", "includelineno"}; const int commandWordsSize = sizeof(commandWords) / sizeof(*commandWords); @@ -68,7 +68,7 @@ const char *commandEndCommands[] = { const int commandEndCommandsSize = sizeof(commandEndCommands) / sizeof(*commandEndCommands); const char *commandWordParagraphs[] = { - "param", "tparam", "throw", "throws", "retval", "exception"}; + "param", "tparam", "throw", "throws", "retval", "exception", "example"}; const int commandWordParagraphsSize = sizeof(commandWordParagraphs) / sizeof(*commandWordParagraphs); const char *commandWordLines[] = { @@ -92,7 +92,7 @@ const int commandErrorThrowingsSize = sizeof(commandErrorThrowings) / sizeof(*co const char *commandUniques[] = { "xrefitem", "arg", "ingroup", "par", "headerfile", "overload", "weakgroup", "ref", "subpage", "dotfile", "image", "addtogroup", "li", - "if", "ifnot", "elseif", "else"}; + "if", "ifnot", "elseif", "else", "mscfile"}; const int commandUniquesSize = sizeof(commandUniques) / sizeof(*commandUniques); #endif diff --git a/Source/DoxygenTranslator/src/DoxygenParser.cpp b/Source/DoxygenTranslator/src/DoxygenParser.cpp index b47320268..4fee595a6 100644 --- a/Source/DoxygenTranslator/src/DoxygenParser.cpp +++ b/Source/DoxygenTranslator/src/DoxygenParser.cpp @@ -407,11 +407,28 @@ int DoxygenParser::addCommandUnique(std::string theCommand, TokenList & tokList, } // \xrefitem "(heading)" "(std::list title)" {text} else if (theCommand == "xrefitem") { - //TODO Implement xrefitem if (noisy) - cout << "Not Adding " << theCommand << endl; + cout << "Parsing " << theCommand << endl; + std::string key = getNextWord(tokList); + if (key.empty()) { + tokList.printListError("No key followed " + theCommand + " command. Not added"); + return 0; + } + std::string heading = getNextWord(tokList); + if (key.empty()) { + tokList.printListError("No heading followed " + theCommand + " command. Not added"); + return 0; + } + std::string title = getNextWord(tokList); + if (title.empty()) { + tokList.printListError("No title followed " + theCommand + " command. Not added"); + return 0; + } std::list < Token >::iterator endOfParagraph = getEndOfParagraph(tokList); - tokList.setIterator(endOfParagraph); + aNewList = parse(endOfParagraph, tokList); + aNewList.push_front(DoxygenEntity("plainstd::string", title)); + aNewList.push_front(DoxygenEntity("plainstd::string", heading)); + aNewList.push_front(DoxygenEntity("plainstd::string", key)); return 1; } // \ingroup ( [ ]) @@ -432,7 +449,8 @@ int DoxygenParser::addCommandUnique(std::string theCommand, TokenList & tokList, std::list < Token >::iterator endOfLine = getOneLine(tokList); aNewList = parse(endOfLine, tokList); std::list < DoxygenEntity > aNewList2; - aNewList2 = parse(endOfLine, tokList); + std::list < Token >::iterator endOfParagraph = getEndOfParagraph(tokList); + aNewList2 = parse(endOfParagraph, tokList); aNewList.splice(aNewList.end(), aNewList2); doxyList.push_back(DoxygenEntity(theCommand, aNewList)); return 1; @@ -478,31 +496,75 @@ int DoxygenParser::addCommandUnique(std::string theCommand, TokenList & tokList, } // \ref ["(text)"] else if (theCommand == "ref") { - //TODO Implement ref if (noisy) - cout << "Not Adding " << theCommand << endl; - std::list < Token >::iterator endOfParagraph = getEndOfParagraph(tokList); - tokList.setIterator(endOfParagraph); + cout << "Parsing " << theCommand << endl; + std::string name = getNextWord(tokList); + if (name.empty()) { + tokList.printListError("No key followed " + theCommand + " command. Not added"); + return 0; + } + std::string text = getNextWord(tokList); + aNewList.push_back(DoxygenEntity("plainstd::string", name)); + if (!text.empty()) + aNewList.push_back(DoxygenEntity("plainstd::string", text)); + doxyList.push_back(DoxygenEntity(theCommand, aNewList)); } // \subpage ["(text)"] else if (theCommand == "subpage") { - //TODO implement subpage if (noisy) - cout << "Not Adding " << theCommand << endl; - std::list < Token >::iterator endOfParagraph = getEndOfParagraph(tokList); - tokList.setIterator(endOfParagraph); + cout << "Parsing " << theCommand << endl; + std::string name = getNextWord(tokList); + if (name.empty()) { + tokList.printListError("No name followed " + theCommand + " command. Not added"); + return 0; + } + std::string text = getNextWord(tokList); + aNewList.push_back(DoxygenEntity("plainstd::string", name)); + if (!text.empty()) + aNewList.push_back(DoxygenEntity("plainstd::string", text)); + doxyList.push_back(DoxygenEntity(theCommand, aNewList)); } // \dotfile ["caption"] - else if (theCommand == "dotfile") { - //TODO implement dotfile + // \mscfile ["caption"] + else if (theCommand == "dotfile" || theCommand == "mscfile") { if (noisy) - cout << "Not Adding " << theCommand << endl; - std::list < Token >::iterator endOfParagraph = getEndOfParagraph(tokList); - tokList.setIterator(endOfParagraph); + cout << "Parsing " << theCommand << endl; + std::string file = getNextWord(tokList); + if (file.empty()) { + tokList.printListError("No file followed " + theCommand + " command. Not added"); + return 0; + } + std::string caption = getNextWord(tokList); + aNewList.push_back(DoxygenEntity("plainstd::string", file)); + if (!caption.empty()) + aNewList.push_back(DoxygenEntity("plainstd::string", caption)); + doxyList.push_back(DoxygenEntity(theCommand, aNewList)); } // \image ["caption"] [=] else if (theCommand == "image") { - //todo implement image + if (noisy) + cout << "Parsing " << theCommand << endl; + std::string format = getNextWord(tokList); + if (format.empty()) { + tokList.printListError("No format followed " + theCommand + " command. Not added"); + return 0; + } + std::string file = getNextWord(tokList); + if (file.empty()) { + tokList.printListError("No name followed " + theCommand + " command. Not added"); + return 0; + } + std::string caption = getNextWord(tokList); + std::string size = getNextWord(tokList); + + std::list < DoxygenEntity > aNewList; + aNewList.push_back(DoxygenEntity("plainstd::string", format)); + aNewList.push_back(DoxygenEntity("plainstd::string", file)); + if (!caption.empty()) + aNewList.push_back(DoxygenEntity("plainstd::string", caption)); + if (!size.empty()) + aNewList.push_back(DoxygenEntity("plainstd::string", size)); + doxyList.push_back(DoxygenEntity(theCommand, aNewList)); } // \addtogroup [(title)] else if (theCommand == "addtogroup") { From b99221e8af48dc9ece97a619934276bd64913a23 Mon Sep 17 00:00:00 2001 From: Dmitry Kabak Date: Fri, 13 Jul 2012 14:08:37 +0000 Subject: [PATCH 083/314] Refactored TokenList class git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2012-doxygen@13320 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- .../DoxygenTranslator/src/DoxygenParser.cpp | 2 +- Source/DoxygenTranslator/src/TokenList.cpp | 116 +++++++----------- Source/DoxygenTranslator/src/TokenList.h | 8 +- 3 files changed, 55 insertions(+), 71 deletions(-) diff --git a/Source/DoxygenTranslator/src/DoxygenParser.cpp b/Source/DoxygenTranslator/src/DoxygenParser.cpp index 4fee595a6..6161d00b9 100644 --- a/Source/DoxygenTranslator/src/DoxygenParser.cpp +++ b/Source/DoxygenTranslator/src/DoxygenParser.cpp @@ -727,7 +727,7 @@ std::list < DoxygenEntity > DoxygenParser::parse(std::list < Token >::iterator e } std::list < DoxygenEntity > DoxygenParser::createTree(std::string doxygenBlob, std::string fileName, int lineNumber) { - TokenList tokList(doxygenBlob, fileName, lineNumber); + TokenList tokList = TokenList::tokenizeDoxygenComment(doxygenBlob, fileName, lineNumber); if (noisy) { cout << "---TOKEN LIST---" << endl; tokList.printList(); diff --git a/Source/DoxygenTranslator/src/TokenList.cpp b/Source/DoxygenTranslator/src/TokenList.cpp index 8624fb4a2..6bb6c8cd4 100644 --- a/Source/DoxygenTranslator/src/TokenList.cpp +++ b/Source/DoxygenTranslator/src/TokenList.cpp @@ -21,75 +21,53 @@ using namespace std; -int noisy2 = 0; -/* The tokenizer*/ -TokenList::TokenList(const std::string & doxygenStringConst, const std::string fileName, int fileLine) - : fileName(fileName), fileLine(fileLine) { - size_t commentPos; - string doxygenString = doxygenStringConst; - - size_t currentIndex = 0; - size_t nextIndex = 0; +TokenList TokenList::tokenizeDoxygenComment(const std::string &doxygenComment, const std::string &fileName, int fileLine) { + TokenList tokList; + tokList.fileLine = fileLine; + tokList.fileName = fileName; + string::size_type pos, lastPos = 0; string currentWord; - - while (currentIndex < doxygenString.length()) { - - if (doxygenString[currentIndex] == '\n') { - m_tokenList.push_back(Token(END_LINE, currentWord)); - currentIndex++; - } - // skip WS, except \n - while (currentIndex < doxygenString.length() && (doxygenString[currentIndex] == ' ' || doxygenString[currentIndex] == '\t')) - currentIndex++; - - if (currentIndex < doxygenString.length()) { - - nextIndex = currentIndex; - - // skip non WS - while (nextIndex < doxygenString.length() && (doxygenString[nextIndex] != ' ' && doxygenString[nextIndex] != '\t' && doxygenString[nextIndex] != '\n')) - nextIndex++; - - // now we have a token - currentWord = doxygenString.substr(currentIndex, nextIndex - currentIndex); - - if (noisy2) - cout << "Current Word: " << currentWord << endl; - - if (currentWord[0] == '@' || currentWord[0] == '\\') { - // it is doxygen command - currentWord = currentWord.substr(1, currentWord.length() - 1); - m_tokenList.push_back(Token(COMMAND, currentWord)); - - } else if (currentWord[0] == '\n') { - - m_tokenList.push_back(Token(END_LINE, currentWord)); - - } else if (currentWord[0] == '*' || currentWord[0] == '/' || currentWord[0] == '!') { - - bool isPlainString = false; - - if (currentWord.length() > 1) { - - for (size_t i = 1; i < currentWord.length(); i++) { - if (currentWord[i] != '*' && currentWord[i] != '/' && currentWord[i] != '!') { - isPlainString = true; - break; - } - } - } - - if (isPlainString) - m_tokenList.push_back(Token(PLAINSTRING, currentWord)); - - } else if (!currentWord.empty()) { - m_tokenList.push_back(Token(PLAINSTRING, currentWord)); + while (true) { + pos = doxygenComment.find_first_of("\t\n ", lastPos); + if (pos == string::npos) + pos = doxygenComment.size(); + if (pos > lastPos) { + currentWord = doxygenComment.substr(lastPos, pos-lastPos); + if (currentWord[0] == '\\' || currentWord[0] == '@') { + // it's a doxygen command + currentWord = currentWord.substr(1, currentWord.length() - 1); + tokList.m_tokenList.push_back(Token(COMMAND, currentWord)); } - currentIndex = nextIndex; + else if (currentWord[0] == '!' || currentWord[0] == '*' || currentWord[0] == '/') { + // check if it's one of the '!!!', '***', '///' of any length + char c = currentWord[0]; + bool isPlainString = false; + for (int i=0; i= doxygenComment.size()) + break; + + if (doxygenComment[pos] == '\n') + tokList.m_tokenList.push_back(Token(END_LINE, "\n")); + } + tokList.m_tokenListIter = tokList.m_tokenList.begin(); + return tokList; +} + +TokenList::TokenList() +: fileName(""), fileLine(0) { m_tokenListIter = m_tokenList.begin(); } @@ -151,9 +129,9 @@ void TokenList::printList() { } void TokenList::printListError(std::string message) { - int curLine = fileLine; - for (list< Token >::iterator it = m_tokenList.begin(); it != current(); it++) - if (it->tokenType == END_LINE) - curLine++; - Swig_error(fileName.c_str(), curLine, "Doxygen parser error: %s. \n", message.c_str()); + int curLine = fileLine; + for (list< Token >::iterator it = m_tokenList.begin(); it != current(); it++) + if (it->tokenType == END_LINE) + curLine++; + Swig_error(fileName.c_str(), curLine, "Doxygen parser error: %s. \n", message.c_str()); } diff --git a/Source/DoxygenTranslator/src/TokenList.h b/Source/DoxygenTranslator/src/TokenList.h index d38fec792..ce9d14c45 100644 --- a/Source/DoxygenTranslator/src/TokenList.h +++ b/Source/DoxygenTranslator/src/TokenList.h @@ -30,7 +30,7 @@ private: int fileLine; public: - TokenList(const std::string & doxygenString, const std::string fileName, int fileLine); /* constructor takes a blob of Doxygen comment */ + TokenList(); // construct an empty TokenList ~TokenList(); Token peek(); /* returns next token without advancing */ @@ -44,6 +44,12 @@ public: void printList(); /* prints out the sequence of tokens */ void printListError(std::string message); /* prints properly formatted error message */ + + /* + * Create TokenList and populate it with tokens from + * a blob of Doxygen comment + */ + static TokenList tokenizeDoxygenComment(const std::string &doxygenComment, const std::string &fileName, int fileLine); }; #endif From 34dc515a4041c079db4d4c5b3bc241efa6d96d34 Mon Sep 17 00:00:00 2001 From: Dmitry Kabak Date: Fri, 13 Jul 2012 15:16:58 +0000 Subject: [PATCH 084/314] Fixed bug with quoted strings in doxygen comments git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2012-doxygen@13321 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Source/DoxygenTranslator/src/TokenList.cpp | 27 ++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/Source/DoxygenTranslator/src/TokenList.cpp b/Source/DoxygenTranslator/src/TokenList.cpp index 6bb6c8cd4..1ade6375e 100644 --- a/Source/DoxygenTranslator/src/TokenList.cpp +++ b/Source/DoxygenTranslator/src/TokenList.cpp @@ -26,6 +26,7 @@ TokenList TokenList::tokenizeDoxygenComment(const std::string &doxygenComment, c tokList.fileLine = fileLine; tokList.fileName = fileName; + bool isPlainString = false; string::size_type pos, lastPos = 0; string currentWord; while (true) { @@ -42,17 +43,35 @@ TokenList TokenList::tokenizeDoxygenComment(const std::string &doxygenComment, c else if (currentWord[0] == '!' || currentWord[0] == '*' || currentWord[0] == '/') { // check if it's one of the '!!!', '***', '///' of any length char c = currentWord[0]; - bool isPlainString = false; + isPlainString = false; for (int i=0; i Date: Sat, 14 Jul 2012 22:41:41 +0000 Subject: [PATCH 085/314] Added support for parsing of missing doxygen commands. Now parser produces correct parse tree for every doxygen tag, at least for those included in the testcase. Also added the test with all the tags, even those that will be ignored later. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2012-doxygen@13322 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- .../test-suite/doxygen_translate_all_tags.i | 338 ++++++++++++++++++ .../DoxygenTranslator/src/DoxygenCommands.h | 24 +- .../DoxygenTranslator/src/DoxygenParser.cpp | 51 ++- Source/DoxygenTranslator/src/TokenList.cpp | 5 +- 4 files changed, 401 insertions(+), 17 deletions(-) create mode 100644 Examples/test-suite/doxygen_translate_all_tags.i diff --git a/Examples/test-suite/doxygen_translate_all_tags.i b/Examples/test-suite/doxygen_translate_all_tags.i new file mode 100644 index 000000000..ae66cc5de --- /dev/null +++ b/Examples/test-suite/doxygen_translate_all_tags.i @@ -0,0 +1,338 @@ +%module doxygen_translate + +%inline %{ + +/** + * \a Hello + * + * \addindex SomeLatexIndex + * + * \addtogroup someGroup "Some title" + * + * \anchor theAnchor + * + * \arg some list item + * + * \attention This is attention! + * You were warned! + * + * \authors lots of them + * + * \author Zubr + * + * \b boldword + * + * \brief Some brief description, + * extended to many lines. + * + * \bug Not everything works right now... + * + * \c codeword + * + * \callgraph + * + * \callergraph + * + * \category someCategory headerFile.h headerName + * + * \cite citationword + * + * \class someClass headerFile.h headerName + * + * \code some test code \endcode + * + * \cond SOMECONDITION + * Some conditional comment + * \endcond + * + * \copybrief someClass::someMethod + * + * \copydetails someClass::someMethod2 + * + * \copydoc someClass::someMethod3 + * + * \copyright some copyright + * + * \date 1970 - 2012 + * + * \def someDefine + * + * \defgroup someGroup Some titles + * + * \deprecated Now use another function + * + * \details This is very large + * and detailed description of some thing + * + * \dir /somePath/someFolder + * + * \dontinclude someFile.h + * + * \dot + * digraph example { + * node [shape=record, fontname=Helvetica, fontsize=10]; + * b [ label="class B" URL="\ref B"]; + * c [ label="class C" URL="\ref C"]; + * b -> c [ arrowhead="open", style="dashed" ]; + * } + * \enddot + * + * \dotfile dotFile.dot "The caption" + * + * \e italicword + * + * \em emphazedWord + * + * \enum someEnum + * + * \example someFile.txt + * Some details on using the example + * + * \exception SuperError + * + * \extends someOtherFunction + * + * \f$ \sqrt{(x_2-x_1)^2+(y_2-y_1)^2} \f$ + * + * \f[ + * \sqrt{(x_2-x_1)^2+(y_2-y_1)^2} + * \f] + * + * \f{ + * \sqrt{(x_2-x_1)^2+(y_2-y_1)^2} + * \f} + * + * \file file.h + * + * \fn someFn + * + * \headerfile someHeader.h "Header name" + * + * \hideinitializer + * + * \htmlinclude htmlFile.htm + * + * \htmlonly + * This will only appear in hmtl + * \endhtmlonly + * + * \if ANOTHERCONDITION + * First part of comment + * \if SECONDCONDITION + * Nested condition text + * \elseif THIRDCONDITION + * The third condition text + * \else + * The last text block + * \endif + * \else + * Second part of comment + * \if CONDITION + * Second part extended + * \endif + * \endif + * + * \ifnot SOMECONDITION + * This is printed if not + * \endif + * + * \image html testImage.bmp "Hello, world!" asd=10qwe + * + * \implements someFunction + * + * \include header.h + * + * \includelineno header2.h + * + * \ingroup someGroup anotherGroup + * + * \internal + * + * \invariant Some text + * describing invariant. + * + * \interface someInterface someHeader.h "Header name" + * + * \latexonly + * This will only appear in LATeX + * \endlatexonly + * + *
      + * + * \li Some unordered list + * \li With lots of items + * \li lots of lots of items + * + *
    + * + * \line example + * + * \link someMember Some description follows \endlink + * + * \mainpage Some title + * + * \manonly + * This will only appear in man + * \endmanonly + * + * \memberof someThing + * + * \msc + * Sender,Receiver; + * Sender->Receiver [label="Command()", URL="\ref Receiver::Command()"]; + * Sender<-Receiver [label="Ack()", URL="\ref Ack()", ID="1"]; + * \endmsc + * + * \mscfile mscFile.msc "The caption" + * + * \n \n \n + * + * \name someHeader.h + * + * \namespace someNamespace + * + * \nosubgrouping + * + * \note Here + * is the note! + * + * \overload + * + * \p someword + * + * \package superPackage + * + * \page somePage The title + * + * \par The paragraph title + * The paragraph text. + * Maybe even multiline + * + * \paragraph someParagraph Paragraph title + * + * \param a the first param + * + * \post Some description + * + * \pre Some description + * + * \private + * + * \privatesection + * + * \property someVar + * + * \protected + * + * \protectedsection + * + * \protocol someProtocol header.h "Header name" + * + * \public + * + * \publicsection + * + * \ref someAnchor + * + * \related toSomething + * + * \relates toSomethingElse + * + * \relatedalso someName + * + * \relatesalso someName + * + * \remark Some remark text + * + * \remarks Another remarks section + * + * \result Whatever + * + * \return it + * + * \returns may return + * + * \retval someValue Some description + * + * \rtfonly + * This will only appear in RTF + * \endrtfonly + * + * \sa someOtherMethod + * + * \section someSection Some title + * + * \see function + * + * \short Same as + * brief description + * + * \showinitializer + * + * \since version 0.0.0.1 + * + * \skip somePattern + * + * \skipline someLine + * + * \snippet example.h Some snippet + * + * \struct someStruct + * + * \subpage someSubpage "Some description" + * + * \subsection someSubsection Some title + * + * \subsubsection someSubsection Some title + * + * \tableofcontents + * + * \test Some + * description of the + * test case + * + * \throw superException + * + * \throws RuntimeError + * + * \todo Some very important task + * + * \tparam b B is mentioned again... + * + * \typedef someTypedef + * + * \union someUnion + * + * \until somePattern + * + * \var someVar + * + * \verbatim + * very long + * text with tags + * \endverbatim + * + * \verbinclude someFile.h + * + * \version 0.0.0.2 + * + * \warning This is senseless! + * + * \weakgroup someGroup Some title + * + * \xmlonly + * This will only appear in XML + * \endxmlonly + * + * \xrefitem todo "Todo" "Todo List" + * + * Here goes test of symbols: + * \$ \@ \\ \& \~ \< \> \# \% \" \. \:: + * + * And here goes simple text + */ +int function(int a, float b) +{ +} + +%} diff --git a/Source/DoxygenTranslator/src/DoxygenCommands.h b/Source/DoxygenTranslator/src/DoxygenCommands.h index 1b24eff33..27611cdcb 100644 --- a/Source/DoxygenTranslator/src/DoxygenCommands.h +++ b/Source/DoxygenTranslator/src/DoxygenCommands.h @@ -29,7 +29,10 @@ const int sectionIndicatorsSize = sizeof(sectionIndicators) / sizeof(*sectionInd /* All of the doxygen commands divided up by how they are parsed */ const char *simpleCommands[] = { - "n", "$", "@", "\\", "&", "~", "<", ">", "#", "%", "\"", ".", "::", "endcond"}; + "n", "$", "@", "\\", "&", "~", "<", ">", "#", "%", "\"", ".", "::", "endcond", + "callgraph", "callergraph", "showinitializer", "hideinitializer", "internal", + "nosubgrouping", "public", "publicsection", "private", "privatesection", + "protected", "protectedsection", "tableofcontents"}; const int simpleCommandsSize = sizeof(simpleCommands) / sizeof(*simpleCommands); const char *ignoredSimpleCommands[] = { @@ -38,11 +41,12 @@ const int ignoredSimpleCommandsSize = sizeof(ignoredSimpleCommands) / sizeof(*ig const char *commandWords[] = { "a", "b", "c", "e", "em", "p", "def", "enum", "package", "relates", "namespace", "relatesalso", "anchor", "dontinclude", "include", - "includelineno"}; + "includelineno", "copydoc", "copybrief", "copydetails", "verbinclude", "htmlinclude", "extends", "implements", "memberof", "related", + "relatedalso"}; const int commandWordsSize = sizeof(commandWords) / sizeof(*commandWords); const char *ignoredCommandWords[] = { - "copydoc", "copybrief", "copydetails", "verbinclude", "htmlinclude"}; + "nothing at the moment"}; const int ignoredCommandWordsSize = sizeof(ignoredCommandWords) / sizeof(*ignoredCommandWords); const char *commandLines[] = { @@ -56,7 +60,7 @@ const int ignoreCommandLinesSize = sizeof(ignoreCommandLines) / sizeof(*ignoreCo const char *commandParagraph[] = { "partofdescription", "result", "return", "returns", "remarks", "remark", "since", "test", "sa", "see", "pre", "post", "details", "invariant", "deprecated", "date", "note", "warning", "version", "todo", "bug", "attention", "brief", "author", "authors", "cite", - "copyright"}; + "copyright", "short"}; const int commandParagraphSize = sizeof(commandParagraph) / sizeof(*commandParagraph); const char *ignoreCommandParagraphs[] = { @@ -64,7 +68,7 @@ const char *ignoreCommandParagraphs[] = { const int ignoreCommandParagraphsSize = sizeof(ignoreCommandParagraphs) / sizeof(*ignoreCommandParagraphs); const char *commandEndCommands[] = { - "code", "dot", "msc", "f$", "f[", "f{environment}{", "htmlonly", "latexonly", "manonly", "verbatim", "xmlonly", "link"}; + "htmlonly", "latexonly", "manonly", "xmlonly", "link", "rtfonly"}; const int commandEndCommandsSize = sizeof(commandEndCommands) / sizeof(*commandEndCommands); const char *commandWordParagraphs[] = { @@ -72,7 +76,7 @@ const char *commandWordParagraphs[] = { const int commandWordParagraphsSize = sizeof(commandWordParagraphs) / sizeof(*commandWordParagraphs); const char *commandWordLines[] = { - "page", "subsection", "subsubsection", "section", "paragraph", "defgroup"}; + "page", "subsection", "subsubsection", "section", "paragraph", "defgroup", "snippet", "mainpage"}; const int commandWordLinesSize = sizeof(commandWordLines) / sizeof(*commandWordLines); const char *commandWordOWordOWords[] = { @@ -85,14 +89,14 @@ const int commandOWordsSize = sizeof(commandOWords) / sizeof(*commandOWords); const char *commandErrorThrowings[] = { "annotatedclassstd::list", "classhierarchy", "define", "functionindex", "header", - "headerfilestd::list", "inherit", "l", "postheader", "private", "privatesection", "protected", - "protectedsection", "public", "publicsection", "endcode", "enddot", "endmsc", "endhtmlonly", - "endlatexonly", "endmanonly", "endlink", "endverbatim", "endxmlonly", "f]", "f}", "endif", "else"}; + "headerfilestd::list", "inherit", "l", "postheader", "endcode", "enddot", "endmsc", "endhtmlonly", + "endlatexonly", "endmanonly", "endlink", "endverbatim", "endxmlonly", "f]", "f}", "endif", "else", + "endrtfonly"}; const int commandErrorThrowingsSize = sizeof(commandErrorThrowings) / sizeof(*commandErrorThrowings); const char *commandUniques[] = { "xrefitem", "arg", "ingroup", "par", "headerfile", "overload", "weakgroup", "ref", "subpage", "dotfile", "image", "addtogroup", "li", - "if", "ifnot", "elseif", "else", "mscfile"}; + "if", "ifnot", "elseif", "else", "mscfile", "code", "verbatim", "f{", "f[", "f$", "dot", "msc"}; const int commandUniquesSize = sizeof(commandUniques) / sizeof(*commandUniques); #endif diff --git a/Source/DoxygenTranslator/src/DoxygenParser.cpp b/Source/DoxygenTranslator/src/DoxygenParser.cpp index 6161d00b9..3e94bd538 100644 --- a/Source/DoxygenTranslator/src/DoxygenParser.cpp +++ b/Source/DoxygenTranslator/src/DoxygenParser.cpp @@ -227,11 +227,11 @@ std::list < Token >::iterator DoxygenParser::getEndOfSection(std::string theComm std::list < Token >::iterator DoxygenParser::getEndCommand(std::string theCommand, TokenList & tokList) { std::list < Token >::iterator endOfCommand = tokList.iteratorCopy(); while (endOfCommand != tokList.end()) { + endOfCommand++; if ((*endOfCommand).tokenType == COMMAND) { if (theCommand == (*endOfCommand).tokenString) { return endOfCommand; } - endOfCommand++; } } //End command not found @@ -263,7 +263,9 @@ int DoxygenParser::addCommandWord(std::string theCommand, TokenList & tokList, s cout << "Parsing " << theCommand << endl; std::string name = getNextWord(tokList); if (!name.empty()) { - doxyList.push_back(DoxygenEntity(theCommand, name)); + std::list < DoxygenEntity > aNewList; + aNewList.push_back(DoxygenEntity("plainstd::string", name)); + doxyList.push_back(DoxygenEntity(theCommand, aNewList)); return 1; } else tokList.printListError("No word followed " + theCommand + " command. Not added"); @@ -322,8 +324,15 @@ int DoxygenParser::ignoreCommandParagraph(std::string theCommand, TokenList & to int DoxygenParser::addCommandEndCommand(std::string theCommand, TokenList & tokList, std::list < DoxygenEntity > &doxyList) { if (noisy) cout << "Parsing " << theCommand << endl; - std::string description = getStringTilEndCommand("end" + theCommand, tokList); - doxyList.push_back(DoxygenEntity(theCommand, description)); + std::list < Token >::iterator endCommand = getEndCommand("end" + theCommand, tokList); + if (endCommand == tokList.end()) { + tokList.printListError("Expected end" + theCommand); + return 0; + } + std::list < DoxygenEntity > aNewList; + aNewList = parse(endCommand, tokList); + tokList.next(); + doxyList.push_back(DoxygenEntity(theCommand, aNewList)); return 1; } @@ -398,6 +407,7 @@ int DoxygenParser::addCommandErrorThrow(std::string theCommand, TokenList & tokL } int DoxygenParser::addCommandUnique(std::string theCommand, TokenList & tokList, std::list < DoxygenEntity > &doxyList) { + static std::map endCommands; std::list < DoxygenEntity > aNewList; if (theCommand == "arg" || theCommand == "li") { std::list < Token >::iterator endOfSection = getEndOfSection(theCommand, tokList); @@ -524,6 +534,39 @@ int DoxygenParser::addCommandUnique(std::string theCommand, TokenList & tokList, aNewList.push_back(DoxygenEntity("plainstd::string", text)); doxyList.push_back(DoxygenEntity(theCommand, aNewList)); } + // \code ... \endcode + // \verbatim ... \endverbatim + // \dot dotcode \enddot + // \msc msccode \endmsc + // \f[ ... \f] + // \f{ ... \f} + // \f{env}{ ... \f} + // \f$ ... \f$ + else if (theCommand == "code" || theCommand == "verbatim" + || theCommand == "dot" || theCommand == "msc" + || theCommand == "f[" || theCommand == "f{" + || theCommand == "f$") { + if (!endCommands.size()) { + // fill in static table of end commands + endCommands["f["] = "f]"; + endCommands["f{"] = "f}"; + endCommands["f$"] = "f$"; + } + if (noisy) + cout << "Parsing " << theCommand << endl; + + std::string endCommand; + std::map ::iterator it; + it = endCommands.find(theCommand); + if (it != endCommands.end()) + endCommand = it->second; + else + endCommand = "end" + theCommand; + + std::string content = getStringTilEndCommand(endCommand, tokList); + aNewList.push_back(DoxygenEntity("plainstd::string", content)); + doxyList.push_back(DoxygenEntity(theCommand, aNewList)); + } // \dotfile ["caption"] // \mscfile ["caption"] else if (theCommand == "dotfile" || theCommand == "mscfile") { diff --git a/Source/DoxygenTranslator/src/TokenList.cpp b/Source/DoxygenTranslator/src/TokenList.cpp index 1ade6375e..62dbdc997 100644 --- a/Source/DoxygenTranslator/src/TokenList.cpp +++ b/Source/DoxygenTranslator/src/TokenList.cpp @@ -30,6 +30,7 @@ TokenList TokenList::tokenizeDoxygenComment(const std::string &doxygenComment, c string::size_type pos, lastPos = 0; string currentWord; while (true) { + isPlainString = false; pos = doxygenComment.find_first_of("\t\n ", lastPos); if (pos == string::npos) pos = doxygenComment.size(); @@ -55,9 +56,7 @@ TokenList TokenList::tokenizeDoxygenComment(const std::string &doxygenComment, c if (isPlainString) { // handle quoted words - string::size_type qPos = currentWord.find('"', 0); - if (qPos != string::npos) { - lastPos += qPos; + if (currentWord[0] == '"') { pos = doxygenComment.find_first_of("\"\n", lastPos + 1); if (pos == string::npos) pos = doxygenComment.size(); From f0aa6b750179663ffe8dc8b72cb13a0b2fb5a437 Mon Sep 17 00:00:00 2001 From: Dmitry Kabak Date: Mon, 16 Jul 2012 19:36:23 +0000 Subject: [PATCH 086/314] Fixed \cite doxygen command parsing git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2012-doxygen@13325 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Source/DoxygenTranslator/src/DoxygenCommands.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/DoxygenTranslator/src/DoxygenCommands.h b/Source/DoxygenTranslator/src/DoxygenCommands.h index 27611cdcb..96fde4a7c 100644 --- a/Source/DoxygenTranslator/src/DoxygenCommands.h +++ b/Source/DoxygenTranslator/src/DoxygenCommands.h @@ -42,7 +42,7 @@ const int ignoredSimpleCommandsSize = sizeof(ignoredSimpleCommands) / sizeof(*ig const char *commandWords[] = { "a", "b", "c", "e", "em", "p", "def", "enum", "package", "relates", "namespace", "relatesalso", "anchor", "dontinclude", "include", "includelineno", "copydoc", "copybrief", "copydetails", "verbinclude", "htmlinclude", "extends", "implements", "memberof", "related", - "relatedalso"}; + "relatedalso", "cite"}; const int commandWordsSize = sizeof(commandWords) / sizeof(*commandWords); const char *ignoredCommandWords[] = { @@ -59,7 +59,7 @@ const int ignoreCommandLinesSize = sizeof(ignoreCommandLines) / sizeof(*ignoreCo const char *commandParagraph[] = { "partofdescription", "result", "return", "returns", "remarks", "remark", "since", "test", "sa", "see", "pre", "post", "details", "invariant", - "deprecated", "date", "note", "warning", "version", "todo", "bug", "attention", "brief", "author", "authors", "cite", + "deprecated", "date", "note", "warning", "version", "todo", "bug", "attention", "brief", "author", "authors", "copyright", "short"}; const int commandParagraphSize = sizeof(commandParagraph) / sizeof(*commandParagraph); From 32154a91e4e3e32b80dde69bf112586e96534c21 Mon Sep 17 00:00:00 2001 From: Dmitry Kabak Date: Mon, 16 Jul 2012 19:37:05 +0000 Subject: [PATCH 087/314] Normalized parameters handling, included newlines to the parsed tree git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2012-doxygen@13326 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Source/DoxygenTranslator/src/DoxygenParser.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Source/DoxygenTranslator/src/DoxygenParser.cpp b/Source/DoxygenTranslator/src/DoxygenParser.cpp index 3e94bd538..a44b79abe 100644 --- a/Source/DoxygenTranslator/src/DoxygenParser.cpp +++ b/Source/DoxygenTranslator/src/DoxygenParser.cpp @@ -263,8 +263,8 @@ int DoxygenParser::addCommandWord(std::string theCommand, TokenList & tokList, s cout << "Parsing " << theCommand << endl; std::string name = getNextWord(tokList); if (!name.empty()) { - std::list < DoxygenEntity > aNewList; - aNewList.push_back(DoxygenEntity("plainstd::string", name)); + std::list < DoxygenEntity > aNewList; + aNewList.push_back(DoxygenEntity("plainstd::string", name)); doxyList.push_back(DoxygenEntity(theCommand, aNewList)); return 1; } else @@ -393,7 +393,9 @@ int DoxygenParser::addCommandOWord(std::string theCommand, TokenList & tokList, if (noisy) cout << "Parsing " << theCommand << endl; std::string name = getNextWord(tokList); - doxyList.push_back(DoxygenEntity(theCommand, name)); + std::list < DoxygenEntity > aNewList; + aNewList.push_back(DoxygenEntity("plainstd::string", name)); + doxyList.push_back(DoxygenEntity(theCommand, aNewList)); return 1; } @@ -750,6 +752,7 @@ std::list < DoxygenEntity > DoxygenParser::parse(std::list < Token >::iterator e if (noisy) cout << "Parsing for phrase starting in:" << currToken.toString() << endl; if (currToken.tokenType == END_LINE) { + aNewList.push_back(DoxygenEntity("plainstd::endl")); tokList.next(); } else if (currToken.tokenType == COMMAND) { currCommand = findCommand(currToken.tokenString); From db9659c286f57be807f181a72afde6f1b55e6dba Mon Sep 17 00:00:00 2001 From: Dmitry Kabak Date: Mon, 16 Jul 2012 19:42:30 +0000 Subject: [PATCH 088/314] Implemented most of non-ignored doxygen commands translating for java, fixed testcase. The output is not really nice right now, but almost all the commands mentioned in the project plan work ok git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2012-doxygen@13327 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Doc/Devel/plan-gsoc-2012.txt | 4 +- Examples/test-suite/common.mk | 2 +- Examples/test-suite/doxygen_translate.i | 7 +- .../src/JavaDocConverter.cpp | 229 ++++++++++++------ .../DoxygenTranslator/src/JavaDocConverter.h | 54 ++++- 5 files changed, 203 insertions(+), 93 deletions(-) diff --git a/Doc/Devel/plan-gsoc-2012.txt b/Doc/Devel/plan-gsoc-2012.txt index a32878375..3750a27ca 100644 --- a/Doc/Devel/plan-gsoc-2012.txt +++ b/Doc/Devel/plan-gsoc-2012.txt @@ -92,7 +92,7 @@ Functionality \category - ignored, used only in Objective C \cite - translated to in JD, single quotes in PD \class - ignored (structural command) - \code - translated to in JD, ignored in PD + \code - translated to {@code ...} in JD, ignored in PD \cond - translated to 'Conditional comment: '. Later SWIG may support definitions of conditions in config file. \copybrief - ignored. Later SWIG may support this command by @@ -172,7 +172,7 @@ Functionality \namespace - included in package-info.java if nspace feature is enabled, otherwise ignored, ignored in PD \nosubgrouping - ignored - \note - ignored in JD, translated to 'Note:' in PD + \note - translated to 'Note:' in both JD and PD \overload - prints 'This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.' to the output in both JD and PD diff --git a/Examples/test-suite/common.mk b/Examples/test-suite/common.mk index ed2d74cd9..9f91cec8c 100644 --- a/Examples/test-suite/common.mk +++ b/Examples/test-suite/common.mk @@ -188,7 +188,7 @@ CPP_TEST_CASES += \ director_wombat \ disown \ doxygen_parsing \ - doxygen_basic_translate \ + doxygen_translate \ dynamic_cast \ empty \ enum_rename \ diff --git a/Examples/test-suite/doxygen_translate.i b/Examples/test-suite/doxygen_translate.i index 04f70f014..8bfd3d250 100644 --- a/Examples/test-suite/doxygen_translate.i +++ b/Examples/test-suite/doxygen_translate.i @@ -54,7 +54,7 @@ * This is printed if not * \endif * - * \image html testImage.bmp + * \image html testImage.bmp "Hello, world!" asd=10qwe * *
      * @@ -68,6 +68,9 @@ * * \n \n \n * + * \note Here + * is the note! + * * \overload * * \p someword @@ -122,4 +125,4 @@ int function(int a, float b) { } -%} \ No newline at end of file +%} diff --git a/Source/DoxygenTranslator/src/JavaDocConverter.cpp b/Source/DoxygenTranslator/src/JavaDocConverter.cpp index 2bc3165f4..42b5fcb80 100644 --- a/Source/DoxygenTranslator/src/JavaDocConverter.cpp +++ b/Source/DoxygenTranslator/src/JavaDocConverter.cpp @@ -17,54 +17,82 @@ //TODO {@link} {@linkplain} {@docRoot}, and other useful doxy commands that are not a javadoc tag // define static tables, they are filled in JavaDocConverter's constructor -std::map JavaDocConverter::escapeTable; -std::map JavaDocConverter::tagHandlers; +std::map > JavaDocConverter::tagHandlers; void JavaDocConverter::fillStaticTables() { - if (escapeTable.size()) // fill only once - return; - - escapeTable["&"] = "&"; - escapeTable["\'"] = "&apos"; - escapeTable["\""] = """; - escapeTable["<"] = "<"; - escapeTable[">"] = ">"; + if (tagHandlers.size()) // fill only once // these commands insert HTML tags - tagHandlers["c"] = &handleTagC; - tagHandlers["b"] = &handleTagB; - // these commands insert just a single char, some of them need to be escaped - tagHandlers["$"] = &handleTagChar; - tagHandlers["@"] = &handleTagChar; - tagHandlers["\\"] = &handleTagChar; - tagHandlers["<"] = &handleTagChar; - tagHandlers[">"] = &handleTagChar; - tagHandlers["&"] = &handleTagChar; - tagHandlers["#"] = &handleTagChar; - tagHandlers["%"] = &handleTagChar; - tagHandlers["~"] = &handleTagChar; - tagHandlers["\""] = &handleTagChar; - tagHandlers["."] = &handleTagChar; - tagHandlers["::"] = &handleTagChar; - // these commands are stripped out - tagHandlers["brief"] = &handleParagraph; - tagHandlers["details"] = &handleParagraph; - tagHandlers["partofdescription"] = &handleParagraph; - // these commands are kept as-is, they are supported by JavaDoc - tagHandlers["sa"] = &handleTagSeeAll; - tagHandlers["see"] = &handleTagSame; - tagHandlers["param"] = &handleTagSame; - tagHandlers["return"] = &handleTagSame; - tagHandlers["throws"] = &handleTagSame; - tagHandlers["throw"] = &handleTagThrow; - tagHandlers["author"] = &handleTagSame; - tagHandlers["since"] = &handleTagSame; - tagHandlers["version"] = &handleTagSame; - tagHandlers["exception"] = &handleTagSame; - tagHandlers["deprecated"] = &handleTagSame; - // this command just prints it's contents - // (it is internal command of swig's parser, contains plain text) - tagHandlers["plainstd::string"] = &handlePlainString; + tagHandlers["a"] = make_pair(&JavaDocConverter::handleTagHtml, "i"); + tagHandlers["arg"] = make_pair(&JavaDocConverter::handleTagHtml, "li"); + tagHandlers["b"] = make_pair(&JavaDocConverter::handleTagHtml, "b"); + tagHandlers["c"] = make_pair(&JavaDocConverter::handleTagHtml, "code"); + tagHandlers["cite"] = make_pair(&JavaDocConverter::handleTagHtml, "i"); + tagHandlers["e"] = make_pair(&JavaDocConverter::handleTagHtml, "i"); + tagHandlers["li"] = make_pair(&JavaDocConverter::handleTagHtml, "li"); + tagHandlers["p"] = make_pair(&JavaDocConverter::handleTagHtml, "code"); + // these commands insert just a single char, some of them need to be escaped + tagHandlers["$"] = make_pair(&JavaDocConverter::handleTagChar, ""); + tagHandlers["@"] = make_pair(&JavaDocConverter::handleTagChar, ""); + tagHandlers["\\"] = make_pair(&JavaDocConverter::handleTagChar, ""); + tagHandlers["<"] = make_pair(&JavaDocConverter::handleTagChar, ""); + tagHandlers[">"] = make_pair(&JavaDocConverter::handleTagChar, ""); + tagHandlers["&"] = make_pair(&JavaDocConverter::handleTagChar, ""); + tagHandlers["#"] = make_pair(&JavaDocConverter::handleTagChar, ""); + tagHandlers["%"] = make_pair(&JavaDocConverter::handleTagChar, ""); + tagHandlers["~"] = make_pair(&JavaDocConverter::handleTagChar, ""); + tagHandlers["\""] = make_pair(&JavaDocConverter::handleTagChar, ""); + tagHandlers["."] = make_pair(&JavaDocConverter::handleTagChar, ""); + tagHandlers["::"] = make_pair(&JavaDocConverter::handleTagChar, ""); + // these commands are stripped out + tagHandlers["attention"] = make_pair(&JavaDocConverter::handleParagraph, ""); + tagHandlers["brief"] = make_pair(&JavaDocConverter::handleParagraph, ""); + tagHandlers["date"] = make_pair(&JavaDocConverter::handleParagraph, ""); + tagHandlers["details"] = make_pair(&JavaDocConverter::handleParagraph, ""); + tagHandlers["partofdescription"] = make_pair(&JavaDocConverter::handleParagraph, ""); + // these commands are kept as-is, they are supported by JavaDoc + tagHandlers["author"] = make_pair(&JavaDocConverter::handleTagSame, ""); + tagHandlers["authors"] = make_pair(&JavaDocConverter::handleTagSame, "author"); + tagHandlers["deprecated"] = make_pair(&JavaDocConverter::handleTagSame, ""); + tagHandlers["exception"] = make_pair(&JavaDocConverter::handleTagSame, ""); + tagHandlers["package"] = make_pair(&JavaDocConverter::handleTagSame, ""); + tagHandlers["param"] = make_pair(&JavaDocConverter::handleTagSame, ""); + tagHandlers["tparam"] = make_pair(&JavaDocConverter::handleTagSame, "param"); + tagHandlers["result"] = make_pair(&JavaDocConverter::handleTagSame, "return"); + tagHandlers["return"] = make_pair(&JavaDocConverter::handleTagSame, ""); + tagHandlers["returns"] = make_pair(&JavaDocConverter::handleTagSame, "return"); + tagHandlers["see"] = make_pair(&JavaDocConverter::handleTagSame, ""); + tagHandlers["sa"] = make_pair(&JavaDocConverter::handleTagSame, "see"); + tagHandlers["since"] = make_pair(&JavaDocConverter::handleTagSame, ""); + tagHandlers["throws"] = make_pair(&JavaDocConverter::handleTagSame, ""); + tagHandlers["throw"] = make_pair(&JavaDocConverter::handleTagSame, "throws"); + tagHandlers["version"] = make_pair(&JavaDocConverter::handleTagSame, ""); + // these commands have special handlers + tagHandlers["code"] = make_pair(&JavaDocConverter::handleTagExtended, "code"); + tagHandlers["cond"] = make_pair(&JavaDocConverter::handleTagMessage, "Conditional comment: "); + tagHandlers["copyright"] = make_pair(&JavaDocConverter::handleTagMessage, "Copyright: "); + tagHandlers["else"] = make_pair(&JavaDocConverter::handleTagIf, "Else: "); + tagHandlers["elseif"] = make_pair(&JavaDocConverter::handleTagIf, "Else if: "); + tagHandlers["endcond"] = make_pair(&JavaDocConverter::handleTagMessage, "End of conditional comment."); + tagHandlers["if"] = make_pair(&JavaDocConverter::handleTagIf, "If: "); + tagHandlers["ifnot"] = make_pair(&JavaDocConverter::handleTagIf, "If not: "); + tagHandlers["image"] = make_pair(&JavaDocConverter::handleTagImage, ""); + tagHandlers["link"] = make_pair(&JavaDocConverter::handleTagExtended, "link"); + tagHandlers["note"] = make_pair(&JavaDocConverter::handleTagMessage, "Note: "); + tagHandlers["overload"] = make_pair(&JavaDocConverter::handleTagMessage, "This is an overloaded member function, provided for" + " convenience. It differs from the above function only in what" + " argument(s) it accepts."); + tagHandlers["par"] = make_pair(&JavaDocConverter::handleTagPar, ""); + tagHandlers["remark"] = make_pair(&JavaDocConverter::handleTagMessage, "Remarks: "); + tagHandlers["remarks"] = make_pair(&JavaDocConverter::handleTagMessage, "Remarks: "); + tagHandlers["todo"] = make_pair(&JavaDocConverter::handleTagMessage, "TODO: "); + tagHandlers["verbatim"] = make_pair(&JavaDocConverter::handleTagExtended, "literal"); + tagHandlers["warning"] = make_pair(&JavaDocConverter::handleTagMessage, "Warning: "); + // this command just prints it's contents + // (it is internal command of swig's parser, contains plain text) + tagHandlers["plainstd::string"] = make_pair(&JavaDocConverter::handlePlainString, ""); + tagHandlers["plainstd::endl"] = make_pair(&JavaDocConverter::handleNewLine, ""); + tagHandlers["n"] = make_pair(&JavaDocConverter::handleNewLine, ""); } @@ -73,7 +101,7 @@ JavaDocConverter::JavaDocConverter() : debug(false) { } std::string JavaDocConverter::formatCommand(std::string unformattedLine, int indent) { - std::string formattedLines = "\n * "; + std::string formattedLines; int lastPosition = 0; int i = 0; int isFirstLine = 1; @@ -89,11 +117,11 @@ std::string JavaDocConverter::formatCommand(std::string unformattedLine, int ind if (i > 0 && i + 1 < (int) unformattedLine.length()) { if (!isFirstLine) - for (int j = 0; j < indent; j++) { - formattedLines.append("\t"); - } else { - isFirstLine = 0; - } + for (int j = 0; j < indent; j++) { + formattedLines.append("\t"); + } else { + isFirstLine = 0; + } formattedLines.append(unformattedLine.substr(lastPosition, i - lastPosition + 1)); formattedLines.append("\n *"); @@ -102,7 +130,7 @@ std::string JavaDocConverter::formatCommand(std::string unformattedLine, int ind if (lastPosition < (int) unformattedLine.length()) { if (!isFirstLine) { for (int j = 0; j < indent; j++) { - formattedLines.append("\t"); + formattedLines.append("\t"); } } formattedLines.append(unformattedLine.substr(lastPosition, unformattedLine.length() - lastPosition)); @@ -129,45 +157,96 @@ std::string JavaDocConverter::translateSubtree(DoxygenEntity & doxygenEntity) { void JavaDocConverter::translateEntity(DoxygenEntity& tag, std::string& translatedComment) { // check if we have needed handler and call it - std::map::iterator it; - it = tagHandlers.find(tag.typeOfEntity); + std::map >::iterator it; + it = tagHandlers.find(tag.typeOfEntity); if (it!=tagHandlers.end()) - (*it).second(this, tag, translatedComment); + (this->*(it->second.first))(tag, translatedComment, it->second.second); } -void JavaDocConverter::handleTagC(JavaDocConverter* converter, DoxygenEntity& tag, std::string& translatedComment) { - translatedComment += "" + tag.data + " "; +void JavaDocConverter::handleTagHtml(DoxygenEntity& tag, std::string& translatedComment, std::string &arg) { + if (tag.entityList.size()) // do not include empty tags + translatedComment += "<" + arg + ">" + translateSubtree(tag) + ""; } -void JavaDocConverter::handleTagB(JavaDocConverter* converter, DoxygenEntity& tag, std::string& translatedComment) { - translatedComment += "" + tag.data + " "; +void JavaDocConverter::handleNewLine(DoxygenEntity& tag, std::string& translatedComment, std::string &arg) { + translatedComment += "\n * "; } -void JavaDocConverter::handleTagThrow(JavaDocConverter* converter, DoxygenEntity& tag, std::string& translatedComment) { - tag.typeOfEntity = "throws"; - handleTagSame(converter, tag, translatedComment); -} -void JavaDocConverter::handleTagSeeAll(JavaDocConverter* converter, DoxygenEntity& tag, std::string& translatedComment) { - tag.typeOfEntity = "see"; - handleTagSame(converter, tag, translatedComment); -} -void JavaDocConverter::handleTagChar(JavaDocConverter* converter, DoxygenEntity& tag, std::string& translatedComment) { - // escape it if we can, else just print - if (escapeTable.find(tag.typeOfEntity)!=escapeTable.end()) - translatedComment += escapeTable[tag.typeOfEntity]; +void JavaDocConverter::handleTagChar(DoxygenEntity& tag, std::string& translatedComment, std::string &arg) { + // escape it if we need to, else just print + if (arg.size()) + translatedComment += arg; else translatedComment += tag.typeOfEntity; + translatedComment += " "; } -void JavaDocConverter::handleTagSame(JavaDocConverter* converter, DoxygenEntity& tag, std::string& translatedComment) { - translatedComment += converter->formatCommand(std::string("@" + tag.typeOfEntity + "\t" + converter->translateSubtree(tag)), 2); +void JavaDocConverter::handleTagSame(DoxygenEntity& tag, std::string& translatedComment, std::string &arg) { + if (arg.size()) + tag.typeOfEntity = arg; + translatedComment += formatCommand(std::string("@" + tag.typeOfEntity + " " + translateSubtree(tag)), 2); } -void JavaDocConverter::handleParagraph(JavaDocConverter* converter, DoxygenEntity& tag, std::string& translatedComment) { - translatedComment += converter->formatCommand(converter->translateSubtree(tag), 0); +void JavaDocConverter::handleParagraph(DoxygenEntity& tag, std::string& translatedComment, std::string &arg) { + translatedComment += formatCommand(translateSubtree(tag), 0); } -void JavaDocConverter::handlePlainString(JavaDocConverter* converter, DoxygenEntity& tag, std::string& translatedComment) { +void JavaDocConverter::handlePlainString(DoxygenEntity& tag, std::string& translatedComment, std::string &arg) { translatedComment += tag.data; if (tag.data.size() && tag.data[tag.data.size()-1] != ' ') translatedComment += " "; } +void JavaDocConverter::handleTagExtended(DoxygenEntity& tag, std::string& translatedComment, std::string &arg) { + std::string dummy; + translatedComment += "{@" + arg + " "; + handleParagraph(tag, translatedComment, dummy); + translatedComment += "}"; +} +void JavaDocConverter::handleTagIf(DoxygenEntity& tag, std::string& translatedComment, std::string &arg) { + std::string dummy; + translatedComment += arg; + if (tag.entityList.size()) { + translatedComment += tag.entityList.begin()->data; + //handleNewLine(tag, translatedComment, dummy); + tag.entityList.pop_front(); + translatedComment += " {" + translateSubtree(tag) + "}"; + } +} +void JavaDocConverter::handleTagMessage(DoxygenEntity& tag, std::string& translatedComment, std::string &arg) { + std::string dummy; + translatedComment += formatCommand(arg, 0); + handleParagraph(tag, translatedComment, dummy); +} +void JavaDocConverter::handleTagImage(DoxygenEntity& tag, std::string& translatedComment, std::string &arg) { + if (tag.entityList.size() < 2) + return; + + std::string file; + std::string title; + + std::list ::iterator it = tag.entityList.begin(); + if (it->data != "html") + return; + + it++; + file = it->data; + + it++; + if (it != tag.entityList.end()) + title = it->data; + + translatedComment += "\""data + "\""; + translatedComment += ">"; + tag.entityList.pop_front(); + handleParagraph(tag, translatedComment, dummy); + translatedComment += "

      "; +} + String *JavaDocConverter::makeDocumentation(Node *node) { String *documentation = getDoxygenComment(node); diff --git a/Source/DoxygenTranslator/src/JavaDocConverter.h b/Source/DoxygenTranslator/src/JavaDocConverter.h index 9776a17e0..cb876ed6b 100644 --- a/Source/DoxygenTranslator/src/JavaDocConverter.h +++ b/Source/DoxygenTranslator/src/JavaDocConverter.h @@ -27,42 +27,70 @@ public: protected: std::string formatCommand(std::string unformattedLine, int indent); - std::string javaDocFormat(DoxygenEntity & doxygenEntity); std::string translateSubtree(DoxygenEntity & doxygenEntity); void translateEntity(DoxygenEntity &tag, std::string &translatedComment); /* * Typedef for the function that handles one tag + * arg - some string argument to easily pass it through lookup table */ - typedef void (*tagHandler)(JavaDocConverter *converter, DoxygenEntity &tag, std::string &translatedComment); + typedef void (JavaDocConverter::*tagHandler)(DoxygenEntity &tag, + std::string &translatedComment, std::string &arg); /* - * Here comes various tag handlers + * Wrap the command data with the html tag + * arg - html tag, with no braces */ - static void handleTagC(JavaDocConverter *converter, DoxygenEntity &tag, std::string &translatedComment); - static void handleTagB(JavaDocConverter *converter, DoxygenEntity &tag, std::string &translatedComment); - static void handleTagThrow(JavaDocConverter *converter, DoxygenEntity &tag, std::string &translatedComment); - static void handleTagSeeAll(JavaDocConverter *converter, DoxygenEntity &tag, std::string &translatedComment); + void handleTagHtml(DoxygenEntity &tag, std::string &translatedComment, std::string &arg); + /* + * Just prints new line + */ + void handleNewLine(DoxygenEntity &tag, std::string &translatedComment, std::string &arg); /* * Print the name of tag to the output, used for escape-commands + * arg - html-escaped variant, if not provided the command data is used */ - static void handleTagChar(JavaDocConverter *converter, DoxygenEntity &tag, std::string &translatedComment); + void handleTagChar(DoxygenEntity &tag, std::string &translatedComment, std::string &arg); /* * Do not translate and print as-is + * arg - the new tag name, if it needs to be renamed */ - static void handleTagSame(JavaDocConverter *converter, DoxygenEntity &tag, std::string &translatedComment); + void handleTagSame(DoxygenEntity &tag, std::string &translatedComment, std::string &arg); /* * Print only the content and strip original tag */ - static void handleParagraph(JavaDocConverter *converter, DoxygenEntity &tag, std::string &translatedComment); + void handleParagraph(DoxygenEntity &tag, std::string &translatedComment, std::string &arg); /* * Print only data part of code */ - static void handlePlainString(JavaDocConverter *converter, DoxygenEntity &tag, std::string &translatedComment); + void handlePlainString(DoxygenEntity &tag, std::string &translatedComment, std::string &arg); + /* + * Print extended Javadoc command, like {@code ...} or {@literal ...} + * arg - command name + */ + void handleTagExtended(DoxygenEntity &tag, std::string &translatedComment, std::string &arg); + /* + * Print the if-elseif-else-endif section + */ + void handleTagIf(DoxygenEntity &tag, std::string &translatedComment, std::string &arg); + /* + * Prints the specified message, than the contents of the tag + * arg - message + */ + void handleTagMessage(DoxygenEntity &tag, std::string &translatedComment, std::string &arg); + /* + * Insert tag if the 'format' field is specified as 'html' + */ + void handleTagImage(DoxygenEntity &tag, std::string &translatedComment, std::string &arg); + /* + * Insert

      ...

      + */ + void handleTagPar(DoxygenEntity &tag, std::string &translatedComment, std::string &arg); + private: bool debug; - static std::map tagHandlers; - static std::map escapeTable; + // this contains the handler pointer and one string argument + static std::map > tagHandlers; void fillStaticTables(); }; From ff0ec620b2d5a73ccbdfea6ed53b7b89e8215570 Mon Sep 17 00:00:00 2001 From: Dmitry Kabak Date: Mon, 16 Jul 2012 19:51:43 +0000 Subject: [PATCH 089/314] Added runtime test git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2012-doxygen@13328 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- .../java/doxygen_translate_runme.java | 149 ++++++++++++++++++ 1 file changed, 149 insertions(+) create mode 100644 Examples/test-suite/java/doxygen_translate_runme.java diff --git a/Examples/test-suite/java/doxygen_translate_runme.java b/Examples/test-suite/java/doxygen_translate_runme.java new file mode 100644 index 000000000..6eec790e2 --- /dev/null +++ b/Examples/test-suite/java/doxygen_translate_runme.java @@ -0,0 +1,149 @@ + +import doxygen_translate.*; +import com.sun.javadoc.*; +import java.util.HashMap; + +public class doxygen_translate_runme { + static { + try { + System.loadLibrary("doxygen_translate"); + } catch (UnsatisfiedLinkError e) { + System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e); + System.exit(1); + } + } + + public static void main(String argv[]) + { + /* + Here we are using internal javadoc tool, it accepts the name of the class as paramterer, + and calls the start() method of that class with parsed information. + */ + commentParser parser = new commentParser(); + com.sun.tools.javadoc.Main.execute("doxygen_translate runtime test", + "commentParser", new String[]{"-quiet", "doxygen_translate"}); + + HashMap wantedComments = new HashMap(); + + wantedComments.put("function", " Hello \n" + + " \n" + + "
    • some list item \n" + + " \n" + + "
    • @author lots of them \n" + + " \n" + + " @author Zubr \n" + + " \n" + + " boldword \n" + + " \n" + + " codeword \n" + + " \n" + + " citationword \n" + + " \n" + + " {@code some test code }\n" + + " \n" + + " Conditional comment: SOMECONDITION \n" + + " Some conditional comment \n" + + " End of conditional comment.\n" + + " \n" + + " Copyright: some copyright \n" + + " \n" + + " @deprecated Now use another function \n" + + " \n" + + " italicword \n" + + " \n" + + " @exception SuperError \n" + + " \n" + + " If: ANOTHERCONDITION {\n" + + " First part of comment \n" + + " If: SECONDCONDITION {\n" + + " Nested condition text \n" + + " }Else if: THIRDCONDITION {\n" + + " The third condition text \n" + + " }Else: {The last text block \n" + + " }\n" + + " }Else: {Second part of comment \n" + + " If: CONDITION {\n" + + " Second part extended \n" + + " }\n" + + " }\n" + + " \n" + + " If not: SOMECONDITION {\n" + + " This is printed if not \n" + + " }\n" + + " \n" + + " \"Hello,\n" + + " \n" + + "
        \n" + + " \n" + + "
      • Some unordered list \n" + + "
      • With lots of items \n" + + "
      • lots of lots of items \n" + + " \n" + + "
      \n" + + " \n" + + " {@link someMember Some description follows }\n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " Note: Here \n" + + " is the note! \n" + + " \n" + + " This is an overloaded member function, provided for convenience. \n" + + " It differs from the above function only in what argument(s) it accepts.\n" + + " \n" + + " someword \n" + + " \n" + + " @package superPackage \n" + + " \n" + + "

      \n" + + " The paragraph text. \n" + + " Maybe even multiline \n" + + " \n" + + "

      @param a the first param \n" + + " \n" + + " Remarks: Some remark text \n" + + " \n" + + " Remarks: Another remarks section \n" + + " \n" + + " @return Whatever \n" + + " \n" + + " @return it \n" + + " \n" + + " @return may return \n" + + " \n" + + " @see someOtherMethod \n" + + " \n" + + " @see function \n" + + " \n" + + " @since version 0.0.0.1 \n" + + " \n" + + " @throws superException \n" + + " \n" + + " @throws RuntimeError \n" + + " \n" + + " TODO: Some very important task \n" + + " \n" + + " @param b B is mentioned again... \n" + + " \n" + + " {@literal \n" + + "very long \n" + + "text with tags \n" + + " }\n" + + " \n" + + " @version 0.0.0.2 \n" + + " \n" + + " Warning: This is senseless! \n" + + " \n" + + " Here goes test of symbols: \n" + + " $ @ \\ & ~ < > # % \" . :: \n" + + " \n" + + " And here goes simple text \n" + + " \n"); + + // and ask the parser to check comments for us + System.exit(parser.check(wantedComments)); + } +} \ No newline at end of file From 9e1e514fbcc161765e0e69336a8d0ab96803b4d8 Mon Sep 17 00:00:00 2001 From: Dmitry Kabak Date: Mon, 16 Jul 2012 19:57:28 +0000 Subject: [PATCH 090/314] Updated project plan git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2012-doxygen@13329 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Doc/Devel/plan-gsoc-2012.txt | 58 ++++++++++++++++++------------------ 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/Doc/Devel/plan-gsoc-2012.txt b/Doc/Devel/plan-gsoc-2012.txt index 3750a27ca..6566598fe 100644 --- a/Doc/Devel/plan-gsoc-2012.txt +++ b/Doc/Devel/plan-gsoc-2012.txt @@ -24,7 +24,7 @@ and Python code (## comments, see Doxygen manual), if the user will prefer to use Doxygen on the generated code. Note: -'--Done' tick below means that the item is implemented, commited and +'-OK-' tick below means that the item is implemented, commited and working. Abbreviations: @@ -43,11 +43,10 @@ Functionality the detailed description of Doxygen syntax and terms used in this section. - 1. Only JavaDoc (/** */) and Qt (/*! */) styles of comment blocks + 1. -OK- Only JavaDoc (/** */) and Qt (/*! */) styles of comment blocks will be supported by SWIG translator. - --Done - 2. The following doc after members will be supported: + 2. -OK- The following doc after members will be supported: int var; ///< Detailed description after the member //!< @@ -56,13 +55,11 @@ Functionality int var; ///< Brief description after the member - --Done - 3. Only comments before or after declaration/definition will be + 3. -OK- Only comments before or after declaration/definition will be supported. Comments with structural commands will be ignored (warning will be written). (What about writing them to 'package.info.java' for JD?) - --Done Tags @@ -265,6 +262,9 @@ Sometimes it needs a type of parameters specified because of the overloaded functions. And the same linking tags are supported in JD, but it has a completely different typesystem, so we need to translate the types of function parameters in comments also. For example: +{@link MyClass#doSomething(const std::string &)} +does not make sense in Java, so the type should be converted. +{@link MyClass#doSomething(String)} Tests @@ -272,30 +272,30 @@ Tests The following test cases will be implemented: -- Class comments. --Done +-OK- Class comments. -- Struct comments. --Done -- Enum comments. --Done -- Function comments. --Done -- Var comments. --Done +-OK- Struct comments. +-OK- Enum comments. +-OK- Function comments. +-OK- Var comments. -- Class attributes, comment before and after declaration. --Done -- Class methods, comment of parameters in function - comment. --Done -- Class methods, comment of parameters - after parameter declaration. --Done +-OK- Class attributes, comment before and after declaration. +-OK- Class methods, comment of parameters in function + comment. +-OK- Class methods, comment of parameters + after parameter declaration. -- Struct attributes, comment before and after declaration. --Done -- Struct methods, comment of parameters in function - comment. --Done -- Struct methods, comment of parameters - after parameter declaration. --Done +-OK- Struct attributes, comment before and after declaration. +-OK- Struct methods, comment of parameters in function + comment. +-OK- Struct methods, comment of parameters + after parameter declaration. -- Enum items JD and Qt style, comment before items --Done -- Enum items JD and Qt style, comment after items --Done +-OK- Enum items JD and Qt style, comment before items +-OK- Enum items JD and Qt style, comment after items -- Class comment, with all supported tags. -- Class comment, with all doxygen tags, including +-OK- Class comment, with all supported tags. +-OK- Class comment, with all doxygen tags, including ignored ones. @@ -303,9 +303,9 @@ Refactoring =========== All the code in directory _DoxygenTranslator_ should be refactored: -- all methods should be class members -- most static methods should be normal members -- replace C arrays of strings and sequential searches with STL data +-OK- all methods should be class members +-OK- most static methods should be normal members +-OK- replace C arrays of strings and sequential searches with STL data structures and algorithms. - use singletons instead of class instantiaion for each comment found. From 3d5d66dbd31963debd9fa94674d89757f9a81b57 Mon Sep 17 00:00:00 2001 From: Dmitry Kabak Date: Tue, 17 Jul 2012 23:17:17 +0000 Subject: [PATCH 091/314] Fixed a bug with freezing on commands like \code, \link and others git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2012-doxygen@13330 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Source/DoxygenTranslator/src/DoxygenParser.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Source/DoxygenTranslator/src/DoxygenParser.cpp b/Source/DoxygenTranslator/src/DoxygenParser.cpp index a44b79abe..80ded041a 100644 --- a/Source/DoxygenTranslator/src/DoxygenParser.cpp +++ b/Source/DoxygenTranslator/src/DoxygenParser.cpp @@ -331,7 +331,7 @@ int DoxygenParser::addCommandEndCommand(std::string theCommand, TokenList & tokL } std::list < DoxygenEntity > aNewList; aNewList = parse(endCommand, tokList); - tokList.next(); + tokList.next(); doxyList.push_back(DoxygenEntity(theCommand, aNewList)); return 1; } @@ -768,6 +768,12 @@ std::list < DoxygenEntity > DoxygenParser::parse(std::list < Token >::iterator e } else if (currToken.tokenType == PLAINSTRING) { addCommand(currPlainstringCommandType, tokList, aNewList); } + + if (endParsingIndex != tokList.end() && tokList.current() == tokList.end()) { + // this could happen if we cant reach the original endParsingIndex + tokList.printListError("Unexpected end of comment encountered"); + break; + } } return aNewList; } From d9e8d140e76d6eaf498230efd66a9c7bce0955d8 Mon Sep 17 00:00:00 2001 From: Dmitry Kabak Date: Wed, 18 Jul 2012 22:05:19 +0000 Subject: [PATCH 092/314] Refactored PyDocConverter class, implemented some commands git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2012-doxygen@13331 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- .../DoxygenTranslator/src/PyDocConverter.cpp | 200 +++++++++++------- Source/DoxygenTranslator/src/PyDocConverter.h | 63 +++++- 2 files changed, 183 insertions(+), 80 deletions(-) diff --git a/Source/DoxygenTranslator/src/PyDocConverter.cpp b/Source/DoxygenTranslator/src/PyDocConverter.cpp index 819c6bc6c..3dd42677e 100644 --- a/Source/DoxygenTranslator/src/PyDocConverter.cpp +++ b/Source/DoxygenTranslator/src/PyDocConverter.cpp @@ -17,9 +17,74 @@ #include #include -//TODO {@link} {@linkplain} {@docRoot}, and other useful doxy commands that are not a pydoc tag -PyDocConverter::PyDocConverter() { - debug = 0; +// define static tables, they are filled in PyDocConverter's constructor +std::map > PyDocConverter::tagHandlers; +std::map PyDocConverter::sectionTitles; + +void PyDocConverter::fillStaticTables() { + if (tagHandlers.size()) // fill only once + return; + + sectionTitles["author"] = "Authors:"; + sectionTitles["authors"] = "Authors:"; + sectionTitles["copyright"] = "Copyright:"; + sectionTitles["deprecated"] = "Deprecated:"; + sectionTitles["param"] = "Arguments:"; + sectionTitles["tparam"] = "Arguments:"; + sectionTitles["note"] = "Notes:"; + sectionTitles["remark"] = "Remarks:"; + sectionTitles["remarks"] = "Remarks:"; + sectionTitles["warning"] = "Warning:"; + sectionTitles["result"] = "Return:"; + sectionTitles["return"] = "Return:"; + sectionTitles["returns"] = "Return:"; + + // these commands insert HTML tags + tagHandlers["a"] = make_pair(&PyDocConverter::handleTagWrap, "_"); + tagHandlers["b"] = make_pair(&PyDocConverter::handleTagWrap, "__"); + tagHandlers["cite"] = make_pair(&PyDocConverter::handleTagWrap, "'"); + tagHandlers["e"] = make_pair(&PyDocConverter::handleTagWrap, "_"); + // these commands insert just a single char, some of them need to be escaped + tagHandlers["$"] = make_pair(&PyDocConverter::handleTagChar, ""); + tagHandlers["@"] = make_pair(&PyDocConverter::handleTagChar, ""); + tagHandlers["\\"] = make_pair(&PyDocConverter::handleTagChar, ""); + tagHandlers["<"] = make_pair(&PyDocConverter::handleTagChar, ""); + tagHandlers[">"] = make_pair(&PyDocConverter::handleTagChar, ""); + tagHandlers["&"] = make_pair(&PyDocConverter::handleTagChar, ""); + tagHandlers["#"] = make_pair(&PyDocConverter::handleTagChar, ""); + tagHandlers["%"] = make_pair(&PyDocConverter::handleTagChar, ""); + tagHandlers["~"] = make_pair(&PyDocConverter::handleTagChar, ""); + tagHandlers["\""] = make_pair(&PyDocConverter::handleTagChar, ""); + tagHandlers["."] = make_pair(&PyDocConverter::handleTagChar, ""); + tagHandlers["::"] = make_pair(&PyDocConverter::handleTagChar, ""); + // these commands are stripped out + tagHandlers["attention"] = make_pair(&PyDocConverter::handleParagraph, ""); + tagHandlers["author"] = make_pair(&PyDocConverter::handleParagraph, ""); + tagHandlers["authors"] = make_pair(&PyDocConverter::handleParagraph, ""); + tagHandlers["brief"] = make_pair(&PyDocConverter::handleParagraph, ""); + tagHandlers["c"] = make_pair(&PyDocConverter::handleParagraph, ""); + tagHandlers["code"] = make_pair(&PyDocConverter::handleParagraph, ""); + tagHandlers["copyright"] = make_pair(&PyDocConverter::handleParagraph, ""); + tagHandlers["date"] = make_pair(&PyDocConverter::handleParagraph, ""); + tagHandlers["deprecated"] = make_pair(&PyDocConverter::handleParagraph, ""); + tagHandlers["details"] = make_pair(&PyDocConverter::handleParagraph, ""); + tagHandlers["note"] = make_pair(&PyDocConverter::handleParagraph, ""); + tagHandlers["partofdescription"] = make_pair(&PyDocConverter::handleParagraph, ""); + tagHandlers["remark"] = make_pair(&PyDocConverter::handleParagraph, ""); + tagHandlers["remarks"] = make_pair(&PyDocConverter::handleParagraph, ""); + tagHandlers["warning"] = make_pair(&PyDocConverter::handleParagraph, ""); + // these commands have special handlers + tagHandlers["cond"] = make_pair(&PyDocConverter::handleTagMessage, "Conditional comment: "); + tagHandlers["endcond"] = make_pair(&PyDocConverter::handleTagMessage, "End of conditional comment."); + // this command just prints it's contents + // (it is internal command of swig's parser, contains plain text) + tagHandlers["plainstd::string"] = make_pair(&PyDocConverter::handlePlainString, ""); + tagHandlers["plainstd::endl"] = make_pair(&PyDocConverter::handleNewLine, ""); + tagHandlers["n"] = make_pair(&PyDocConverter::handleNewLine, ""); +} + +PyDocConverter::PyDocConverter() : debug(false) { + fillStaticTables(); } std::string PyDocConverter::formatParam(Node *n, DoxygenEntity & doxygenEntity) { @@ -27,6 +92,7 @@ std::string PyDocConverter::formatParam(Node *n, DoxygenEntity & doxygenEntity) if (doxygenEntity.entityList.size() < 2) { /* if 'paramDescriptionEntity' is not there, ignore param. Better than crash! TODO: log error! */ + return ""; } @@ -91,67 +157,60 @@ std::string PyDocConverter::justifyString(std::string documentString, int indent } std::string PyDocConverter::translateSubtree(DoxygenEntity & doxygenEntity) { - std::string returnedString; + std::string translatedComment; + if (doxygenEntity.isLeaf) - return doxygenEntity.data + " "; - else { - returnedString += doxygenEntity.data; - std::list < DoxygenEntity >::iterator p = doxygenEntity.entityList.begin(); - while (p != doxygenEntity.entityList.end()) { - returnedString += translateSubtree(*p); - p++; + return translatedComment; + + std::string currentSection; + std::list < DoxygenEntity >::iterator p = doxygenEntity.entityList.begin(); + while (p != doxygenEntity.entityList.end()) { + std::map::iterator it; + it = sectionTitles.find(p->typeOfEntity); + if (it != sectionTitles.end()) { + if (it->second != currentSection) { + currentSection = it->second; + translatedComment += currentSection + "\n"; + } } - } - return returnedString; -} - -std::string PyDocConverter::translateEntity(Node *n, DoxygenEntity & doxyEntity) { - if (doxyEntity.typeOfEntity.compare("partofdescription") == 0) - return justifyString(std::string(translateSubtree(doxyEntity)), 0); - - if ((doxyEntity.typeOfEntity.compare("brief") == 0) - || (doxyEntity.typeOfEntity.compare("details") == 0)) - return justifyString(std::string(translateSubtree(doxyEntity)), 0) + "\n"; - - if (doxyEntity.typeOfEntity.compare("plainstd::string") == 0 - || doxyEntity.typeOfEntity.compare("deprecated") == 0 - || doxyEntity.typeOfEntity.compare("brief") == 0) - return justifyString(doxyEntity.data, 0) + "\n"; - - if (doxyEntity.typeOfEntity.compare("param") == 0) - return formatParam(n, doxyEntity); - - if (doxyEntity.typeOfEntity.compare("return") == 0) - return formatReturnDescription(n, doxyEntity); - - if (doxyEntity.typeOfEntity.compare("author") == 0 - || doxyEntity.typeOfEntity.compare("param") == 0 - || doxyEntity.typeOfEntity.compare("since") == 0 - || doxyEntity.typeOfEntity.compare("version") == 0 - || doxyEntity.typeOfEntity.compare("exception") == 0 - || doxyEntity.typeOfEntity.compare("deprecated") == 0 - || doxyEntity.typeOfEntity.compare("sa") == 0) - return ""; - - return justifyString(doxyEntity.data); -} - -std::string PyDocConverter::processEntityList(Node *n, std::list < DoxygenEntity > &entityList) { - std::string result; - bool inParamsSection = false; - - for (std::list < DoxygenEntity >::iterator entityIterator = entityList.begin(); entityIterator != entityList.end();) { - if (entityIterator->typeOfEntity.compare("param") == 0 && !inParamsSection) { - inParamsSection = true; - result += "\nArguments:\n"; - } else if (entityIterator->typeOfEntity.compare("param") != 0 && inParamsSection) - inParamsSection = false; - - result += translateEntity(n, *entityIterator); - entityIterator++; + translateEntity(*p, translatedComment); + translateSubtree(*p); + p++; } - return result; + return translatedComment; +} + +void PyDocConverter::translateEntity(DoxygenEntity & doxyEntity, std::string &translatedComment) { + // check if we have needed handler and call it + std::map >::iterator it; + it = tagHandlers.find(doxyEntity.typeOfEntity); + if (it!=tagHandlers.end()) + (this->*(it->second.first))(doxyEntity, translatedComment, it->second.second); +} + +void PyDocConverter::handleParagraph(DoxygenEntity& tag, std::string& translatedComment, std::string &arg) { + translatedComment += translateSubtree(tag); +} +void PyDocConverter::handlePlainString(DoxygenEntity& tag, std::string& translatedComment, std::string &arg) { + translatedComment += tag.data; + if (tag.data.size() && tag.data[tag.data.size()-1] != ' ') + translatedComment += ""; +} +void PyDocConverter::handleTagMessage(DoxygenEntity& tag, std::string& translatedComment, std::string &arg) { + std::string dummy; + translatedComment += arg; + handleParagraph(tag, translatedComment, dummy); +} +void PyDocConverter::handleTagChar(DoxygenEntity& tag, std::string& translatedComment, std::string &arg) { + translatedComment += tag.typeOfEntity; +} +void PyDocConverter::handleTagWrap(DoxygenEntity& tag, std::string& translatedComment, std::string &arg) { + if (tag.entityList.size()) // do not include empty tags + translatedComment += arg + translateSubtree(tag) + arg; +} +void PyDocConverter::handleNewLine(DoxygenEntity& tag, std::string& translatedComment, std::string &arg) { + translatedComment += "\n"; } String *PyDocConverter::makeDocumentation(Node *n) { @@ -171,7 +230,8 @@ String *PyDocConverter::makeDocumentation(Node *n) { documentation = getDoxygenComment(n); if (!Swig_is_generated_overload(n) && documentation) { std::list < DoxygenEntity > entityList = parser.createTree(Char(documentation), Char(Getfile(documentation)), Getline(documentation)); - allDocumentation.push_back(processEntityList(n, entityList)); + DoxygenEntity root("root", entityList); + allDocumentation.push_back(translateSubtree(root)); } n = Getattr(n, "sym:nextSibling"); } @@ -180,10 +240,10 @@ String *PyDocConverter::makeDocumentation(Node *n) { if (allDocumentation.size() > 1) { std::ostringstream concatDocString; for (int realOverloadCount = 0; realOverloadCount < (int) allDocumentation.size(); realOverloadCount++) { - concatDocString << generateDivider(); - concatDocString << "Overload " << (realOverloadCount + 1) << ":" << std::endl; - concatDocString << generateDivider(); - concatDocString << allDocumentation[realOverloadCount] << std::endl; + concatDocString << generateDivider(); + concatDocString << "Overload " << (realOverloadCount + 1) << ":" << std::endl; + concatDocString << generateDivider(); + concatDocString << allDocumentation[realOverloadCount] << std::endl; } pyDocString = concatDocString.str(); } else if (allDocumentation.size() == 1) { @@ -195,7 +255,8 @@ String *PyDocConverter::makeDocumentation(Node *n) { documentation = getDoxygenComment(n); if (documentation != NULL) { std::list < DoxygenEntity > entityList = parser.createTree(Char(documentation), Char(Getfile(documentation)), Getline(documentation)); - pyDocString = processEntityList(n, entityList); + DoxygenEntity root("root", entityList); + pyDocString = translateSubtree(root); } } @@ -216,9 +277,6 @@ String *PyDocConverter::makeDocumentation(Node *n) { } std::string PyDocConverter::generateDivider() { - std::ostringstream dividerString; - for (int i = 0; i < DOC_STRING_LENGTH; i++) - dividerString << '-'; - dividerString << std::endl; - return dividerString.str(); + static string dividerString('-', DOC_STRING_LENGTH); + return dividerString; } diff --git a/Source/DoxygenTranslator/src/PyDocConverter.h b/Source/DoxygenTranslator/src/PyDocConverter.h index 2d910c8f9..319f62875 100644 --- a/Source/DoxygenTranslator/src/PyDocConverter.h +++ b/Source/DoxygenTranslator/src/PyDocConverter.h @@ -29,14 +29,6 @@ public: String *makeDocumentation(Node *node); protected: - - /* - * Process the contents of the entity list producing a documentation string. - * @param node The parse tree node that the entity list relates to. - * @param entityList The entity list to process - */ - std::string processEntityList(Node *node, std::list < DoxygenEntity > &entityList); - /* * Format the doxygen comment relating to a function or method parameter * @param node The parse tree node that the parameter relates to. @@ -61,7 +53,53 @@ protected: std::string justifyString(std::string unformattedLine, int indent = 0, int maxWidth = DOC_STRING_LENGTH); std::string translateSubtree(DoxygenEntity & doxygenEntity); - std::string translateEntity(Node *n, DoxygenEntity & doxyEntity); + void translateEntity(DoxygenEntity & doxyEntity, std::string &translatedComment); + + /* + * Typedef for the function that handles one tag + * arg - some string argument to easily pass it through lookup table + */ + typedef void (PyDocConverter::*tagHandler)(DoxygenEntity &tag, + std::string &translatedComment, std::string &arg); + + /* + * Wrap the command data with the some string + * arg - string to wrap with, like '_' or '*' + */ + void handleTagWrap(DoxygenEntity &tag, std::string &translatedComment, std::string &arg); + /* + * Just prints new line + */ + void handleNewLine(DoxygenEntity &tag, std::string &translatedComment, std::string &arg); + /* + * Print the name of tag to the output, used for escape-commands + */ + void handleTagChar(DoxygenEntity &tag, std::string &translatedComment, std::string &arg); + /* + * Print only the content and strip original tag + */ + void handleParagraph(DoxygenEntity &tag, std::string &translatedComment, std::string &arg); + /* + * Print only data part of code + */ + void handlePlainString(DoxygenEntity &tag, std::string &translatedComment, std::string &arg); + /* + * Print the if-elseif-else-endif section + */ + void handleTagIf(DoxygenEntity &tag, std::string &translatedComment, std::string &arg); + /* + * Prints the specified message, than the contents of the tag + * arg - message + */ + void handleTagMessage(DoxygenEntity &tag, std::string &translatedComment, std::string &arg); + /* + * Insert 'Image: ...' + */ + void handleTagImage(DoxygenEntity &tag, std::string &translatedComment, std::string &arg); + /* + * Insert 'Title: ...' + */ + void handleTagPar(DoxygenEntity &tag, std::string &translatedComment, std::string &arg); /* * Utility method to generate a diving line for a documentation string. @@ -70,6 +108,13 @@ protected: private: bool debug; + // temporary thing, should be refactored somehow + Node *currentNode; + // this contains the handler pointer and one string argument + static std::map > tagHandlers; + // this cointains the sectins titiles, like 'Arguments:' or 'Notes:', that are printed only once + static std::map sectionTitles; + void fillStaticTables(); }; #endif From b23cb40cf94ee6a5c1f2e818c30beb0ca9f3862b Mon Sep 17 00:00:00 2001 From: Dmitry Kabak Date: Thu, 19 Jul 2012 16:05:46 +0000 Subject: [PATCH 093/314] Added some doxygen tests, currently with no runtime parts git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2012-doxygen@13333 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Examples/test-suite/common.mk | 2 + Examples/test-suite/doxygen_basic_translate.i | 51 +++++++++++++++++++ .../test-suite/doxygen_translate_all_tags.i | 2 +- 3 files changed, 54 insertions(+), 1 deletion(-) diff --git a/Examples/test-suite/common.mk b/Examples/test-suite/common.mk index 9f91cec8c..eb8f7b03a 100644 --- a/Examples/test-suite/common.mk +++ b/Examples/test-suite/common.mk @@ -188,7 +188,9 @@ CPP_TEST_CASES += \ director_wombat \ disown \ doxygen_parsing \ + doxygen_basic_translate \ doxygen_translate \ + doxygen_translate_all_tags \ dynamic_cast \ empty \ enum_rename \ diff --git a/Examples/test-suite/doxygen_basic_translate.i b/Examples/test-suite/doxygen_basic_translate.i index af449eb49..c06cbddc9 100644 --- a/Examples/test-suite/doxygen_basic_translate.i +++ b/Examples/test-suite/doxygen_basic_translate.i @@ -15,4 +15,55 @@ int function() { } +/** + * A test of a very very very very very very very very very very very very very very very very + * very very very very very long comment string. + */ +int function2() +{ +} + +/** + * A test for overloaded functions + * This is function \b one + */ +int function3(int a) +{ +} + +/** + * A test for overloaded functions + * This is function \b two + */ +int function3(int a, int b) +{ +} + +/** + * A test of some mixed tag usage + * \if CONDITION + * This \a code fragment shows us something \. + * \par Minuses: + * \arg it's senseless + * \arg it's stupid + * \arg it's null + * + * \warning This may not work as expected + * + * \code + * int main() { while(true); } + * \endcode + * \endif + */ +int function4() +{ +} + +/** + * Test for default args + */ +int function5(int a=42) +{ +} + %} diff --git a/Examples/test-suite/doxygen_translate_all_tags.i b/Examples/test-suite/doxygen_translate_all_tags.i index ae66cc5de..cb3332179 100644 --- a/Examples/test-suite/doxygen_translate_all_tags.i +++ b/Examples/test-suite/doxygen_translate_all_tags.i @@ -1,4 +1,4 @@ -%module doxygen_translate +%module doxygen_translate_all_tags %inline %{ From 2ae18d9a0fe1e5a37684a0338580dd6f7f59cc62 Mon Sep 17 00:00:00 2001 From: Dmitry Kabak Date: Thu, 19 Jul 2012 16:06:48 +0000 Subject: [PATCH 094/314] Some test fixes to the java comment translator git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2012-doxygen@13334 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Source/DoxygenTranslator/src/JavaDocConverter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/DoxygenTranslator/src/JavaDocConverter.cpp b/Source/DoxygenTranslator/src/JavaDocConverter.cpp index 42b5fcb80..62b9762f4 100644 --- a/Source/DoxygenTranslator/src/JavaDocConverter.cpp +++ b/Source/DoxygenTranslator/src/JavaDocConverter.cpp @@ -102,6 +102,7 @@ JavaDocConverter::JavaDocConverter() : debug(false) { std::string JavaDocConverter::formatCommand(std::string unformattedLine, int indent) { std::string formattedLines; + return unformattedLine; int lastPosition = 0; int i = 0; int isFirstLine = 1; @@ -203,7 +204,6 @@ void JavaDocConverter::handleTagIf(DoxygenEntity& tag, std::string& translatedCo translatedComment += arg; if (tag.entityList.size()) { translatedComment += tag.entityList.begin()->data; - //handleNewLine(tag, translatedComment, dummy); tag.entityList.pop_front(); translatedComment += " {" + translateSubtree(tag) + "}"; } From c56d5fcf90a1ddbc6e27c0c0c8631b8208578da7 Mon Sep 17 00:00:00 2001 From: Dmitry Kabak Date: Thu, 19 Jul 2012 16:08:11 +0000 Subject: [PATCH 095/314] Some code refactoring and all of the doxy commands are working for the python comment translator git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2012-doxygen@13335 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- .../DoxygenTranslator/src/PyDocConverter.cpp | 143 ++++++++++-------- Source/DoxygenTranslator/src/PyDocConverter.h | 39 ++--- 2 files changed, 103 insertions(+), 79 deletions(-) diff --git a/Source/DoxygenTranslator/src/PyDocConverter.cpp b/Source/DoxygenTranslator/src/PyDocConverter.cpp index 3dd42677e..5b6f39adf 100644 --- a/Source/DoxygenTranslator/src/PyDocConverter.cpp +++ b/Source/DoxygenTranslator/src/PyDocConverter.cpp @@ -25,10 +25,14 @@ void PyDocConverter::fillStaticTables() { if (tagHandlers.size()) // fill only once return; + // table of section titles, they are printed only once + // for each group of specified doxygen commands sectionTitles["author"] = "Authors:"; sectionTitles["authors"] = "Authors:"; sectionTitles["copyright"] = "Copyright:"; sectionTitles["deprecated"] = "Deprecated:"; + sectionTitles["example"] = "Example:"; + sectionTitles["exception"] = "Throws:"; sectionTitles["param"] = "Arguments:"; sectionTitles["tparam"] = "Arguments:"; sectionTitles["note"] = "Notes:"; @@ -38,6 +42,13 @@ void PyDocConverter::fillStaticTables() { sectionTitles["result"] = "Return:"; sectionTitles["return"] = "Return:"; sectionTitles["returns"] = "Return:"; + sectionTitles["sa"] = "See also:"; + sectionTitles["see"] = "See also:"; + sectionTitles["since"] = "Since:"; + sectionTitles["throw"] = "Throws:"; + sectionTitles["throws"] = "Throws:"; + sectionTitles["todo"] = "TODO:"; + sectionTitles["version"] = "Version:"; // these commands insert HTML tags tagHandlers["a"] = make_pair(&PyDocConverter::handleTagWrap, "_"); @@ -57,25 +68,22 @@ void PyDocConverter::fillStaticTables() { tagHandlers["\""] = make_pair(&PyDocConverter::handleTagChar, ""); tagHandlers["."] = make_pair(&PyDocConverter::handleTagChar, ""); tagHandlers["::"] = make_pair(&PyDocConverter::handleTagChar, ""); - // these commands are stripped out - tagHandlers["attention"] = make_pair(&PyDocConverter::handleParagraph, ""); - tagHandlers["author"] = make_pair(&PyDocConverter::handleParagraph, ""); - tagHandlers["authors"] = make_pair(&PyDocConverter::handleParagraph, ""); - tagHandlers["brief"] = make_pair(&PyDocConverter::handleParagraph, ""); - tagHandlers["c"] = make_pair(&PyDocConverter::handleParagraph, ""); - tagHandlers["code"] = make_pair(&PyDocConverter::handleParagraph, ""); - tagHandlers["copyright"] = make_pair(&PyDocConverter::handleParagraph, ""); - tagHandlers["date"] = make_pair(&PyDocConverter::handleParagraph, ""); - tagHandlers["deprecated"] = make_pair(&PyDocConverter::handleParagraph, ""); - tagHandlers["details"] = make_pair(&PyDocConverter::handleParagraph, ""); - tagHandlers["note"] = make_pair(&PyDocConverter::handleParagraph, ""); - tagHandlers["partofdescription"] = make_pair(&PyDocConverter::handleParagraph, ""); - tagHandlers["remark"] = make_pair(&PyDocConverter::handleParagraph, ""); - tagHandlers["remarks"] = make_pair(&PyDocConverter::handleParagraph, ""); - tagHandlers["warning"] = make_pair(&PyDocConverter::handleParagraph, ""); // these commands have special handlers + tagHandlers["arg"] = make_pair(&PyDocConverter::handleTagMessage, " -"); tagHandlers["cond"] = make_pair(&PyDocConverter::handleTagMessage, "Conditional comment: "); + tagHandlers["else"] = make_pair(&PyDocConverter::handleTagIf, "Else: "); + tagHandlers["elseif"] = make_pair(&PyDocConverter::handleTagIf, "Else if: "); tagHandlers["endcond"] = make_pair(&PyDocConverter::handleTagMessage, "End of conditional comment."); + tagHandlers["if"] = make_pair(&PyDocConverter::handleTagIf, "If: "); + tagHandlers["ifnot"] = make_pair(&PyDocConverter::handleTagIf, "If not: "); + tagHandlers["image"] = make_pair(&PyDocConverter::handleTagMessage, "Image: "); + tagHandlers["li"] = make_pair(&PyDocConverter::handleTagMessage, " -"); + tagHandlers["overload"] = make_pair(&PyDocConverter::handleTagMessage, "This is an overloaded member function, provided for" + " convenience.\nIt differs from the above function only in what" + " argument(s) it accepts."); + tagHandlers["par"] = make_pair(&PyDocConverter::handleTagPar, ""); + tagHandlers["param"] = make_pair(&PyDocConverter::handleTagParam, ""); + tagHandlers["tparam"] = make_pair(&PyDocConverter::handleTagParam, ""); // this command just prints it's contents // (it is internal command of swig's parser, contains plain text) tagHandlers["plainstd::string"] = make_pair(&PyDocConverter::handlePlainString, ""); @@ -87,38 +95,13 @@ PyDocConverter::PyDocConverter() : debug(false) { fillStaticTables(); } -std::string PyDocConverter::formatParam(Node *n, DoxygenEntity & doxygenEntity) { - - if (doxygenEntity.entityList.size() < 2) { - /* if 'paramDescriptionEntity' is not there, ignore param. Better than crash! - TODO: log error! */ - - return ""; - } - - ParmList *plist = CopyParmList(Getattr(n, "parms")); +std::string PyDocConverter::getParamType(std::string param) { + ParmList *plist = CopyParmList(Getattr(currentNode, "parms")); Parm *p = NULL; - - DoxygenEntity & paramNameEntity = *doxygenEntity.entityList.begin(); - DoxygenEntity & paramDescriptionEntity = *(++doxygenEntity.entityList.begin()); - - std::string result; - std::string paramDescription = justifyString(paramDescriptionEntity.data, DOC_PARAM_STRING_LENGTH); - for (p = plist; p;) { - - //Swig_print(p, 1); - if (Char(Getattr(p, "name")) == paramNameEntity.data) { - std::string name = Char(Swig_name_make(n, 0, Getattr(p, "name"), 0, 0)); - std::string type = Char(Swig_name_make(n, 0, Getattr(p, "type"), 0, 0)); - - result = name + " (" + type + ") "; - if (result.size() < (DOC_PARAM_STRING_LENGTH - 3)) { - /* do not cut info away - it is better to have not so nice output than type information missing. */ - result.resize(DOC_PARAM_STRING_LENGTH - 3, ' '); - } - result += "-- " + paramDescription.substr(DOC_PARAM_STRING_LENGTH); - break; + if (Char(Getattr(p, "name")) == param) { + std::string type = Char(Swig_name_make(currentNode, 0, Getattr(p, "type"), 0, 0)); + return type; } /* * doesn't seem to work always: in some cases (especially for 'self' parameters) @@ -127,18 +110,12 @@ std::string PyDocConverter::formatParam(Node *n, DoxygenEntity & doxygenEntity) //p = Getattr(p, "tmap:in") ? Getattr(p, "tmap:in:next") : nextSibling(p); p = nextSibling(p); } - Delete(plist); - return result; -} - -std::string PyDocConverter::formatReturnDescription(Node *node, DoxygenEntity & doxygenEntity) { -#pragma unused(node) - return "\nResult:\n" + justifyString(translateSubtree(doxygenEntity)); + return ""; } std::string PyDocConverter::justifyString(std::string documentString, int indent, int maxWidth) { - std::ostringstream formattedString; + std::string formattedString; std::string currentLine; for (std::string::iterator stringPosition = documentString.begin(); stringPosition != documentString.end(); ++stringPosition) { @@ -147,13 +124,17 @@ std::string PyDocConverter::justifyString(std::string documentString, int indent currentLine += *stringPosition; - if (*stringPosition == ' ' && (int) currentLine.size() >= maxWidth || (stringPosition + 1) == documentString.end()) { - formattedString << currentLine << std::endl; + if (iswspace(*stringPosition) && (int) currentLine.size() >= maxWidth || (stringPosition + 1) == documentString.end()) { + formattedString += currentLine + "\n"; currentLine = ""; } } - return formattedString.str(); + // strip the last endl + if (formattedString.size()) + formattedString = formattedString.substr(0, formattedString.size() - 1); + + return formattedString; } std::string PyDocConverter::translateSubtree(DoxygenEntity & doxygenEntity) { @@ -183,14 +164,17 @@ std::string PyDocConverter::translateSubtree(DoxygenEntity & doxygenEntity) { void PyDocConverter::translateEntity(DoxygenEntity & doxyEntity, std::string &translatedComment) { // check if we have needed handler and call it + std::string dummy; std::map >::iterator it; it = tagHandlers.find(doxyEntity.typeOfEntity); if (it!=tagHandlers.end()) (this->*(it->second.first))(doxyEntity, translatedComment, it->second.second); + else + handleParagraph(doxyEntity, translatedComment, dummy); } void PyDocConverter::handleParagraph(DoxygenEntity& tag, std::string& translatedComment, std::string &arg) { - translatedComment += translateSubtree(tag); + translatedComment += justifyString(translateSubtree(tag), 0); } void PyDocConverter::handlePlainString(DoxygenEntity& tag, std::string& translatedComment, std::string &arg) { translatedComment += tag.data; @@ -205,6 +189,42 @@ void PyDocConverter::handleTagMessage(DoxygenEntity& tag, std::string& translate void PyDocConverter::handleTagChar(DoxygenEntity& tag, std::string& translatedComment, std::string &arg) { translatedComment += tag.typeOfEntity; } +void PyDocConverter::handleTagIf(DoxygenEntity& tag, std::string& translatedComment, std::string &arg) { + std::string dummy; + translatedComment += arg; + if (tag.entityList.size()) { + translatedComment += tag.entityList.begin()->data; + tag.entityList.pop_front(); + translatedComment += " {" + translateSubtree(tag) + "}"; + } +} +void PyDocConverter::handleTagPar(DoxygenEntity& tag, std::string& translatedComment, std::string &arg) { + std::string dummy; + translatedComment += "Title: "; + if (tag.entityList.size()) + translatedComment += tag.entityList.begin()->data; + tag.entityList.pop_front(); + handleParagraph(tag, translatedComment, dummy); +} +void PyDocConverter::handleTagParam(DoxygenEntity& tag, std::string& translatedComment, std::string &arg) { + std::string dummy; + if (tag.entityList.size() < 2) { + // TODO: log error + return; + } + DoxygenEntity paramNameEntity = *tag.entityList.begin(); + std::string paramDescription = "-- "; + + tag.entityList.pop_front(); + handleParagraph(tag, paramDescription, dummy); + paramDescription = justifyString(paramDescription, DOC_PARAM_STRING_LENGTH); + + std::string paramType = getParamType(paramNameEntity.data); + if (!paramType.size()) + paramType = "none"; + + translatedComment += paramNameEntity.data + " (" + paramType + ")" + paramDescription; +} void PyDocConverter::handleTagWrap(DoxygenEntity& tag, std::string& translatedComment, std::string &arg) { if (tag.entityList.size()) // do not include empty tags translatedComment += arg + translateSubtree(tag) + arg; @@ -217,6 +237,9 @@ String *PyDocConverter::makeDocumentation(Node *n) { String *documentation; std::string pyDocString, result; + // store the node, we may need it later + currentNode = n; + // for overloaded functions we must concat documentation for underlying overloads if (Checkattr(n, "kind", "function") && Getattr(n, "sym:overloaded")) { // rewind to the first overload @@ -240,7 +263,7 @@ String *PyDocConverter::makeDocumentation(Node *n) { if (allDocumentation.size() > 1) { std::ostringstream concatDocString; for (int realOverloadCount = 0; realOverloadCount < (int) allDocumentation.size(); realOverloadCount++) { - concatDocString << generateDivider(); + concatDocString << generateDivider() << std::endl; concatDocString << "Overload " << (realOverloadCount + 1) << ":" << std::endl; concatDocString << generateDivider(); concatDocString << allDocumentation[realOverloadCount] << std::endl; @@ -277,6 +300,6 @@ String *PyDocConverter::makeDocumentation(Node *n) { } std::string PyDocConverter::generateDivider() { - static string dividerString('-', DOC_STRING_LENGTH); + static string dividerString(DOC_STRING_LENGTH, '-'); return dividerString; } diff --git a/Source/DoxygenTranslator/src/PyDocConverter.h b/Source/DoxygenTranslator/src/PyDocConverter.h index 319f62875..f14a130ac 100644 --- a/Source/DoxygenTranslator/src/PyDocConverter.h +++ b/Source/DoxygenTranslator/src/PyDocConverter.h @@ -29,20 +29,6 @@ public: String *makeDocumentation(Node *node); protected: - /* - * Format the doxygen comment relating to a function or method parameter - * @param node The parse tree node that the parameter relates to. - * @param doxygenEntity The doxygen entity relating to the parameter docstring. - */ - std::string formatParam(Node *node, DoxygenEntity & doxygenEntity); - - /* - * Format the doxygen comment relating to the return value for a method or function. - * @param node The parse tree node that the parameter relates to. - * @param doxygenEntity The doxygen entity relating to the parameter docstring. - */ - std::string formatReturnDescription(Node *node, DoxygenEntity & doxygenEntity); - /* * Format a string so it is justified and split over several lines * not exeeding a given length. @@ -51,8 +37,16 @@ protected: * @param maxWidth The approximate maximum line width. */ std::string justifyString(std::string unformattedLine, int indent = 0, int maxWidth = DOC_STRING_LENGTH); - + /* + * Translate every entity in a tree, also manages sections + * display. Prints title for every group of tags that have + * a section title associated with them + */ std::string translateSubtree(DoxygenEntity & doxygenEntity); + /* + * Translate one entity with the appropriate handler, acording + * to the tagHandlers + */ void translateEntity(DoxygenEntity & doxyEntity, std::string &translatedComment); /* @@ -92,20 +86,27 @@ protected: * arg - message */ void handleTagMessage(DoxygenEntity &tag, std::string &translatedComment, std::string &arg); - /* - * Insert 'Image: ...' - */ - void handleTagImage(DoxygenEntity &tag, std::string &translatedComment, std::string &arg); /* * Insert 'Title: ...' */ void handleTagPar(DoxygenEntity &tag, std::string &translatedComment, std::string &arg); + /* + * Format nice param description with type information + */ + void handleTagParam(DoxygenEntity &tag, std::string &translatedComment, std::string &arg); /* * Utility method to generate a diving line for a documentation string. */ std::string generateDivider(); + /* + * Simple helper function that calculates correct parameter type + * of the node stored in 'currentNode' + * If param with specified name is not found, empty string is returned + */ + std::string getParamType(std::string name); + private: bool debug; // temporary thing, should be refactored somehow From 791ea1ba3a5a6f697fc873de7e9d1a15eb9cdab0 Mon Sep 17 00:00:00 2001 From: Dmitry Kabak Date: Mon, 23 Jul 2012 10:52:59 +0000 Subject: [PATCH 096/314] Enhanced commentParser.java, improved string comparison (now ignoring whitespaces), improved comments text output git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2012-doxygen@13342 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Examples/test-suite/java/commentParser.java | 30 ++++++++++++++++----- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/Examples/test-suite/java/commentParser.java b/Examples/test-suite/java/commentParser.java index 93785669e..94beb8c2f 100644 --- a/Examples/test-suite/java/commentParser.java +++ b/Examples/test-suite/java/commentParser.java @@ -17,19 +17,19 @@ public class commentParser { for (ClassDoc classDoc : root.classes()) { if (classDoc.getRawCommentText().length() > 0) - parsedComments.put(classDoc.name(), classDoc.getRawCommentText()); + parsedComments.put(classDoc.qualifiedName(), classDoc.getRawCommentText()); for (FieldDoc f : classDoc.enumConstants()) { if (f.getRawCommentText().length() > 0) - parsedComments.put(f.name(), f.getRawCommentText()); + parsedComments.put(f.qualifiedName(), f.getRawCommentText()); } for (FieldDoc f : classDoc.fields()) { if (f.getRawCommentText().length() > 0) - parsedComments.put(f.name(), f.getRawCommentText()); + parsedComments.put(f.qualifiedName(), f.getRawCommentText()); } for (MethodDoc m : classDoc.methods()) { if (m.getRawCommentText().length() > 0) - parsedComments.put(m.name(), m.getRawCommentText()); + parsedComments.put(m.toString(), m.getRawCommentText()); } } return true; @@ -42,9 +42,21 @@ public class commentParser { while (it.hasNext()) { Entry e = (Entry) it.next(); + String actualStr = e.getValue(); + String wantedStr = wantedComments.get(e.getKey()); + // this may be weird, but I don't know any more effective solution + actualStr = actualStr.replace(" ", ""); + actualStr = actualStr.replace("\n", ""); + actualStr = actualStr.replace("\t", ""); + if (wantedStr != null) { + wantedStr = wantedStr.replace(" ", ""); + wantedStr = wantedStr.replace("\n", ""); + wantedStr = wantedStr.replace("\t", ""); + } - if (!e.getValue().equals(wantedComments.get(e.getKey()))) { + if (!actualStr.equals(wantedStr)) { System.out.println("Documentation comments for " + e.getKey() + " does not match: "); + // here we print original strings, for nicer output System.out.println("\texpected:"+wantedComments.get(e.getKey())); System.out.println("\tgot:\t"+e.getValue()); errorCount++; @@ -64,7 +76,11 @@ public class commentParser { while (it.hasNext()) { Entry e = (Entry) it.next(); - System.out.format("wantedComments.put(\"%s\", \"%s\");\n", e.getKey(), e.getValue()); + String commentText = e.getValue(); + commentText = commentText.replace("\\", "\\\\"); + commentText = commentText.replace("\"", "\\\""); + commentText = commentText.replace("\n", "\\n\" +\n\t\t\""); + System.out.format("wantedComments.put(\"%s\",\n\t\t\"%s\");\n", e.getKey(), commentText); } } @@ -82,4 +98,4 @@ public class commentParser { printCommentListForJavaSource(); } -} \ No newline at end of file +} From 07552d3b094daed26ec520399d94690abf850a20 Mon Sep 17 00:00:00 2001 From: Dmitry Kabak Date: Mon, 23 Jul 2012 11:17:42 +0000 Subject: [PATCH 097/314] Fixed ignored commands in JavaDocConverter git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2012-doxygen@13343 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Source/DoxygenTranslator/src/JavaDocConverter.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Source/DoxygenTranslator/src/JavaDocConverter.cpp b/Source/DoxygenTranslator/src/JavaDocConverter.cpp index 62b9762f4..8f6725f5c 100644 --- a/Source/DoxygenTranslator/src/JavaDocConverter.cpp +++ b/Source/DoxygenTranslator/src/JavaDocConverter.cpp @@ -29,6 +29,7 @@ void JavaDocConverter::fillStaticTables() { tagHandlers["c"] = make_pair(&JavaDocConverter::handleTagHtml, "code"); tagHandlers["cite"] = make_pair(&JavaDocConverter::handleTagHtml, "i"); tagHandlers["e"] = make_pair(&JavaDocConverter::handleTagHtml, "i"); + tagHandlers["em"] = make_pair(&JavaDocConverter::handleTagHtml, "i"); tagHandlers["li"] = make_pair(&JavaDocConverter::handleTagHtml, "li"); tagHandlers["p"] = make_pair(&JavaDocConverter::handleTagHtml, "code"); // these commands insert just a single char, some of them need to be escaped @@ -47,9 +48,17 @@ void JavaDocConverter::fillStaticTables() { // these commands are stripped out tagHandlers["attention"] = make_pair(&JavaDocConverter::handleParagraph, ""); tagHandlers["brief"] = make_pair(&JavaDocConverter::handleParagraph, ""); + tagHandlers["bug"] = make_pair(&JavaDocConverter::handleParagraph, ""); tagHandlers["date"] = make_pair(&JavaDocConverter::handleParagraph, ""); tagHandlers["details"] = make_pair(&JavaDocConverter::handleParagraph, ""); + tagHandlers["htmlonly"] = make_pair(&JavaDocConverter::handleParagraph, ""); + tagHandlers["invariant"] = make_pair(&JavaDocConverter::handleParagraph, ""); + tagHandlers["latexonly"] = make_pair(&JavaDocConverter::handleParagraph, ""); + tagHandlers["manonly"] = make_pair(&JavaDocConverter::handleParagraph, ""); tagHandlers["partofdescription"] = make_pair(&JavaDocConverter::handleParagraph, ""); + tagHandlers["rtfonly"] = make_pair(&JavaDocConverter::handleParagraph, ""); + tagHandlers["short"] = make_pair(&JavaDocConverter::handleParagraph, ""); + tagHandlers["xmlonly"] = make_pair(&JavaDocConverter::handleParagraph, ""); // these commands are kept as-is, they are supported by JavaDoc tagHandlers["author"] = make_pair(&JavaDocConverter::handleTagSame, ""); tagHandlers["authors"] = make_pair(&JavaDocConverter::handleTagSame, "author"); From 32ac8c0be4c89606a13c997eb3fdd7d9741ebe3b Mon Sep 17 00:00:00 2001 From: Dmitry Kabak Date: Mon, 23 Jul 2012 11:19:04 +0000 Subject: [PATCH 098/314] Added doxygen_basic_translate runtime test for java git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2012-doxygen@13344 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- .../java/doxygen_basic_translate_runme.java | 50 +++++++++++++++++-- 1 file changed, 46 insertions(+), 4 deletions(-) diff --git a/Examples/test-suite/java/doxygen_basic_translate_runme.java b/Examples/test-suite/java/doxygen_basic_translate_runme.java index 34270de56..50d6cedda 100644 --- a/Examples/test-suite/java/doxygen_basic_translate_runme.java +++ b/Examples/test-suite/java/doxygen_basic_translate_runme.java @@ -25,10 +25,52 @@ public class doxygen_basic_translate_runme { HashMap wantedComments = new HashMap(); - wantedComments.put("function", " Brief description. \n The comment text \n" + - " @author\tSome author \n" + - " @return\tSome number \n" + - " @see\tfunction2 \n"); + wantedComments.put("doxygen_basic_translate.doxygen_basic_translate.function()", + " \n" + + " Brief description. \n" + + " \n" + + " The comment text \n" + + " @author Some author \n" + + " @return Some number \n" + + " @see function2 \n" + + " \n" + + ""); + wantedComments.put("doxygen_basic_translate.doxygen_basic_translate.function2()", + " A test of a very very very very very very very very very very very very very very very very \n" + + " very very very very very long comment string. \n" + + " \n" + + ""); + wantedComments.put("doxygen_basic_translate.doxygen_basic_translate.function4()", + " A test of some mixed tag usage \n" + + " If: CONDITION {\n" + + " This code fragment shows us something . \n" + + "

      \n" + + "

    • it's senseless \n" + + "
    • it's stupid \n" + + "
    • it's null \n" + + " \n" + + "
    • Warning: This may not work as expected \n" + + " \n" + + " {@code \n" + + "int main() { while(true); } \n" + + " }\n" + + " }\n" + + " \n" + + ""); + wantedComments.put("doxygen_basic_translate.doxygen_basic_translate.function3(int)", + " A test for overloaded functions \n" + + " This is function one \n" + + " \n" + + ""); + wantedComments.put("doxygen_basic_translate.doxygen_basic_translate.function5(int)", + " Test for default args \n" + + " \n" + + ""); + wantedComments.put("doxygen_basic_translate.doxygen_basic_translate.function3(int, int)", + " A test for overloaded functions \n" + + " This is function two \n" + + " \n" + + ""); // and ask the parser to check comments for us System.exit(parser.check(wantedComments)); From 4c293c828282c6b95639797a17d4455b97cc2915 Mon Sep 17 00:00:00 2001 From: Dmitry Kabak Date: Mon, 23 Jul 2012 11:23:47 +0000 Subject: [PATCH 099/314] Enhanced and unified all java doxygen tests git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2012-doxygen@13345 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- .../doxygen_parsing_enums_proper_runme.java | 37 ++++-- .../doxygen_parsing_enums_simple_runme.java | 27 +++- .../doxygen_parsing_enums_typesafe_runme.java | 38 ++++-- ...oxygen_parsing_enums_typeunsafe_runme.java | 37 ++++-- .../java/doxygen_parsing_runme.java | 124 ++++++++++++++---- .../doxygen_translate_all_tags_runme.java | 120 +++++++++++++++++ .../java/doxygen_translate_runme.java | 10 +- 7 files changed, 333 insertions(+), 60 deletions(-) create mode 100644 Examples/test-suite/java/doxygen_translate_all_tags_runme.java diff --git a/Examples/test-suite/java/doxygen_parsing_enums_proper_runme.java b/Examples/test-suite/java/doxygen_parsing_enums_proper_runme.java index 4531ada51..b96ee66ea 100644 --- a/Examples/test-suite/java/doxygen_parsing_enums_proper_runme.java +++ b/Examples/test-suite/java/doxygen_parsing_enums_proper_runme.java @@ -25,14 +25,35 @@ public class doxygen_parsing_enums_proper_runme { HashMap wantedComments = new HashMap(); - wantedComments.put("SomeAnotherEnum", " Testing comments before enum items \n"); - wantedComments.put("SOME_ITEM_1", " The comment for the first item \n"); - wantedComments.put("SOME_ITEM_2", " The comment for the second item \n"); - wantedComments.put("SOME_ITEM_3", " The comment for the third item \n"); - wantedComments.put("SomeAnotherEnum2", " Testing comments after enum items \n"); - wantedComments.put("SOME_ITEM_10", " Post comment for the first item \n"); - wantedComments.put("SOME_ITEM_20", " Post comment for the second item \n"); - wantedComments.put("SOME_ITEM_30", " Post comment for the third item \n"); + wantedComments.put("doxygen_parsing_enums_proper.SomeAnotherEnum2.SOME_ITEM_10", + "Post comment for the first item \n" + + ""); + wantedComments.put("doxygen_parsing_enums_proper.SomeAnotherEnum.SOME_ITEM_1", + " The comment for the first item \n" + + " \n" + + ""); + wantedComments.put("doxygen_parsing_enums_proper.SomeAnotherEnum", + " Testing comments before enum items \n" + + " \n" + + ""); + wantedComments.put("doxygen_parsing_enums_proper.SomeAnotherEnum2.SOME_ITEM_30", + "Post comment for the third item \n" + + ""); + wantedComments.put("doxygen_parsing_enums_proper.SomeAnotherEnum2", + " Testing comments after enum items \n" + + " \n" + + ""); + wantedComments.put("doxygen_parsing_enums_proper.SomeAnotherEnum.SOME_ITEM_3", + " The comment for the third item \n" + + " \n" + + ""); + wantedComments.put("doxygen_parsing_enums_proper.SomeAnotherEnum.SOME_ITEM_2", + " The comment for the second item \n" + + " \n" + + ""); + wantedComments.put("doxygen_parsing_enums_proper.SomeAnotherEnum2.SOME_ITEM_20", + "Post comment for the second item \n" + + ""); // and ask the parser to check comments for us System.exit(parser.check(wantedComments)); diff --git a/Examples/test-suite/java/doxygen_parsing_enums_simple_runme.java b/Examples/test-suite/java/doxygen_parsing_enums_simple_runme.java index 7fba76d5c..cd97c9a4f 100644 --- a/Examples/test-suite/java/doxygen_parsing_enums_simple_runme.java +++ b/Examples/test-suite/java/doxygen_parsing_enums_simple_runme.java @@ -25,12 +25,27 @@ public class doxygen_parsing_enums_simple_runme { HashMap wantedComments = new HashMap(); - wantedComments.put("SOME_ITEM_1", " The comment for the first item \n"); - wantedComments.put("SOME_ITEM_2", " The comment for the second item \n"); - wantedComments.put("SOME_ITEM_3", " The comment for the third item \n"); - wantedComments.put("SOME_ITEM_10", " Post comment for the first item \n"); - wantedComments.put("SOME_ITEM_20", " Post comment for the second item \n"); - wantedComments.put("SOME_ITEM_30", " Post comment for the third item \n"); + wantedComments.put("doxygen_parsing_enums_simple.doxygen_parsing_enums_simpleConstants.SOME_ITEM_30", + "Post comment for the third item \n" + + ""); + wantedComments.put("doxygen_parsing_enums_simple.doxygen_parsing_enums_simpleConstants.SOME_ITEM_3", + " The comment for the third item \n" + + " \n" + + ""); + wantedComments.put("doxygen_parsing_enums_simple.doxygen_parsing_enums_simpleConstants.SOME_ITEM_2", + " The comment for the second item \n" + + " \n" + + ""); + wantedComments.put("doxygen_parsing_enums_simple.doxygen_parsing_enums_simpleConstants.SOME_ITEM_10", + "Post comment for the first item \n" + + ""); + wantedComments.put("doxygen_parsing_enums_simple.doxygen_parsing_enums_simpleConstants.SOME_ITEM_20", + "Post comment for the second item \n" + + ""); + wantedComments.put("doxygen_parsing_enums_simple.doxygen_parsing_enums_simpleConstants.SOME_ITEM_1", + " The comment for the first item \n" + + " \n" + + ""); // and ask the parser to check comments for us System.exit(parser.check(wantedComments)); diff --git a/Examples/test-suite/java/doxygen_parsing_enums_typesafe_runme.java b/Examples/test-suite/java/doxygen_parsing_enums_typesafe_runme.java index f853ffb3b..85ac15fe8 100644 --- a/Examples/test-suite/java/doxygen_parsing_enums_typesafe_runme.java +++ b/Examples/test-suite/java/doxygen_parsing_enums_typesafe_runme.java @@ -25,14 +25,36 @@ public class doxygen_parsing_enums_typesafe_runme { HashMap wantedComments = new HashMap(); - wantedComments.put("SomeAnotherEnum", " Testing comments before enum items \n"); - wantedComments.put("SOME_ITEM_1", " The comment for the first item \n"); - wantedComments.put("SOME_ITEM_2", " The comment for the second item \n"); - wantedComments.put("SOME_ITEM_3", " The comment for the third item \n"); - wantedComments.put("SomeAnotherEnum2", " Testing comments after enum items \n"); - wantedComments.put("SOME_ITEM_10", " Post comment for the first item \n"); - wantedComments.put("SOME_ITEM_20", " Post comment for the second item \n"); - wantedComments.put("SOME_ITEM_30", " Post comment for the third item \n"); + wantedComments.put("doxygen_parsing_enums_typesafe.SomeAnotherEnum.SOME_ITEM_1", + " The comment for the first item \n" + + " \n" + + ""); + wantedComments.put("doxygen_parsing_enums_typesafe.SomeAnotherEnum2", + " Testing comments after enum items \n" + + " \n" + + ""); + wantedComments.put("doxygen_parsing_enums_typesafe.SomeAnotherEnum.SOME_ITEM_2", + " The comment for the second item \n" + + " \n" + + ""); + wantedComments.put("doxygen_parsing_enums_typesafe.SomeAnotherEnum2.SOME_ITEM_20", + "Post comment for the second item \n" + + ""); + wantedComments.put("doxygen_parsing_enums_typesafe.SomeAnotherEnum", + " Testing comments before enum items \n" + + " \n" + + ""); + wantedComments.put("doxygen_parsing_enums_typesafe.SomeAnotherEnum2.SOME_ITEM_10", + "Post comment for the first item \n" + + ""); + wantedComments.put("doxygen_parsing_enums_typesafe.SomeAnotherEnum.SOME_ITEM_3", + " The comment for the third item \n" + + " \n" + + ""); + wantedComments.put("doxygen_parsing_enums_typesafe.SomeAnotherEnum2.SOME_ITEM_30", + "Post comment for the third item \n" + + ""); + // and ask the parser to check comments for us System.exit(parser.check(wantedComments)); diff --git a/Examples/test-suite/java/doxygen_parsing_enums_typeunsafe_runme.java b/Examples/test-suite/java/doxygen_parsing_enums_typeunsafe_runme.java index 9788ae1d3..6f453060d 100644 --- a/Examples/test-suite/java/doxygen_parsing_enums_typeunsafe_runme.java +++ b/Examples/test-suite/java/doxygen_parsing_enums_typeunsafe_runme.java @@ -25,14 +25,35 @@ public class doxygen_parsing_enums_typeunsafe_runme { HashMap wantedComments = new HashMap(); - wantedComments.put("SomeAnotherEnum", " Testing comments before enum items \n"); - wantedComments.put("SOME_ITEM_1", " The comment for the first item \n"); - wantedComments.put("SOME_ITEM_2", " The comment for the second item \n"); - wantedComments.put("SOME_ITEM_3", " The comment for the third item \n"); - wantedComments.put("SomeAnotherEnum2", " Testing comments after enum items \n"); - wantedComments.put("SOME_ITEM_10", " Post comment for the first item \n"); - wantedComments.put("SOME_ITEM_20", " Post comment for the second item \n"); - wantedComments.put("SOME_ITEM_30", " Post comment for the third item \n"); + wantedComments.put("doxygen_parsing_enums_typeunsafe.SomeAnotherEnum.SOME_ITEM_2", + " The comment for the second item \n" + + " \n" + + ""); + wantedComments.put("doxygen_parsing_enums_typeunsafe.SomeAnotherEnum.SOME_ITEM_3", + " The comment for the third item \n" + + " \n" + + ""); + wantedComments.put("doxygen_parsing_enums_typeunsafe.SomeAnotherEnum.SOME_ITEM_1", + " The comment for the first item \n" + + " \n" + + ""); + wantedComments.put("doxygen_parsing_enums_typeunsafe.SomeAnotherEnum2.SOME_ITEM_20", + "Post comment for the second item \n" + + ""); + wantedComments.put("doxygen_parsing_enums_typeunsafe.SomeAnotherEnum", + " Testing comments before enum items \n" + + " \n" + + ""); + wantedComments.put("doxygen_parsing_enums_typeunsafe.SomeAnotherEnum2", + " Testing comments after enum items \n" + + " \n" + + ""); + wantedComments.put("doxygen_parsing_enums_typeunsafe.SomeAnotherEnum2.SOME_ITEM_30", + "Post comment for the third item \n" + + ""); + wantedComments.put("doxygen_parsing_enums_typeunsafe.SomeAnotherEnum2.SOME_ITEM_10", + "Post comment for the first item \n" + + ""); // and ask the parser to check comments for us System.exit(parser.check(wantedComments)); diff --git a/Examples/test-suite/java/doxygen_parsing_runme.java b/Examples/test-suite/java/doxygen_parsing_runme.java index e0719c586..322a4e42c 100644 --- a/Examples/test-suite/java/doxygen_parsing_runme.java +++ b/Examples/test-suite/java/doxygen_parsing_runme.java @@ -25,31 +25,105 @@ public class doxygen_parsing_runme { HashMap wantedComments = new HashMap(); - wantedComments.put("someFunction", " The function comment \n"); - wantedComments.put("SomeEnum", " The enum comment \n"); - wantedComments.put("setSomeVar", " The var comment \n"); - wantedComments.put("getSomeVar", " The var comment \n"); - wantedComments.put("SomeClass", " The class comment \n"); - wantedComments.put("setClassAttr", " The class attribute comment \n"); - wantedComments.put("getClassAttr", " The class attribute comment \n"); - wantedComments.put("setClassAttr2", " The class attribute post-comment \n"); - wantedComments.put("getClassAttr2", " The class attribute post-comment \n"); - wantedComments.put("setClassAttr3", " The class attribute post-comment with details \n"); - wantedComments.put("getClassAttr3", " The class attribute post-comment with details \n"); - wantedComments.put("classMethod", " The class method comment \n"); - wantedComments.put("classMethodExtended", " The class method with parameter \n @param a Parameter a \n @param b Parameter b \n"); - wantedComments.put("classMethodExtended2", " The class method with parameter \n @param a Parameter a \n @param b Parameter b \n"); - wantedComments.put("SomeStruct", " The struct comment \n"); - wantedComments.put("setStructAttr", " The struct attribute comment \n"); - wantedComments.put("getStructAttr", " The struct attribute comment \n"); - wantedComments.put("setStructAttr2", " The struct attribute post-comment \n"); - wantedComments.put("getStructAttr2", " The struct attribute post-comment \n"); - wantedComments.put("setStructAttr3", " The struct attribute post-comment with details \n"); - wantedComments.put("getStructAttr3", " The struct attribute post-comment with details \n"); - wantedComments.put("structMethod", " The struct method comment \n"); - wantedComments.put("structMethodExtended", " The struct method with parameter \n @param a Parameter a \n @param b Parameter b \n"); - wantedComments.put("structMethodExtended2", " The struct method with parameter \n @param a Parameter a \n @param b Parameter b \n"); - + wantedComments.put("doxygen_parsing.SomeAnotherClass.getClassAttr()", + " The class attribute comment \n" + + " \n" + + ""); + wantedComments.put("doxygen_parsing.SomeAnotherClass.setClassAttr3(int)", + "The class attribute post-comment with details \n" + + ""); + wantedComments.put("doxygen_parsing.SomeAnotherStruct.setStructAttr3(int)", + "The struct attribute post-comment with details \n" + + ""); + wantedComments.put("doxygen_parsing.SomeAnotherClass.classMethodExtended2(int, int)", + " The class method with parameter \n" + + " \n" + + " @param a Parameter a \n" + + " @param b Parameter b \n" + + " \n" + + ""); + wantedComments.put("doxygen_parsing.SomeStruct", + " The struct comment \n" + + " \n" + + ""); + wantedComments.put("doxygen_parsing.doxygen_parsing.setSomeVar(int)", + " The var comment \n" + + " \n" + + ""); + wantedComments.put("doxygen_parsing.SomeAnotherStruct.structMethod()", + " The struct method comment \n" + + " \n" + + ""); + wantedComments.put("doxygen_parsing.doxygen_parsing.someFunction()", + " The function comment \n" + + " \n" + + ""); + wantedComments.put("doxygen_parsing.SomeAnotherClass.classMethodExtended(int, int)", + " The class method with parameter \n" + + " \n" + + " @param a Parameter a \n" + + " @param b Parameter b \n" + + ""); + wantedComments.put("doxygen_parsing.SomeAnotherClass.setClassAttr(int)", + " The class attribute comment \n" + + " \n" + + ""); + wantedComments.put("doxygen_parsing.SomeAnotherStruct.structMethodExtended(int, int)", + " The struct method with parameter \n" + + " \n" + + " @param a Parameter a \n" + + " @param b Parameter b \n" + + ""); + wantedComments.put("doxygen_parsing.SomeAnotherStruct.getStructAttr()", + " The struct attribute comment \n" + + " \n" + + ""); + wantedComments.put("doxygen_parsing.SomeClass", + " The class comment \n" + + " \n" + + ""); + wantedComments.put("doxygen_parsing.SomeAnotherStruct.getStructAttr3()", + "The struct attribute post-comment with details \n" + + ""); + wantedComments.put("doxygen_parsing.doxygen_parsing.getSomeVar()", + " The var comment \n" + + " \n" + + ""); + wantedComments.put("doxygen_parsing.SomeAnotherStruct.setStructAttr2(int)", + "The struct attribute post-comment \n" + + ""); + wantedComments.put("doxygen_parsing.SomeAnotherClass.getClassAttr2()", + "The class attribute post-comment \n" + + ""); + wantedComments.put("doxygen_parsing.SomeAnotherStruct.getStructAttr2()", + "The struct attribute post-comment \n" + + ""); + wantedComments.put("doxygen_parsing.SomeAnotherStruct.setStructAttr(int)", + " The struct attribute comment \n" + + " \n" + + ""); + wantedComments.put("doxygen_parsing.SomeEnum", + " The enum comment \n" + + " \n" + + ""); + wantedComments.put("doxygen_parsing.SomeAnotherClass.getClassAttr3()", + "The class attribute post-comment with details \n" + + ""); + wantedComments.put("doxygen_parsing.SomeAnotherClass.classMethod()", + " The class method comment \n" + + " \n" + + ""); + wantedComments.put("doxygen_parsing.SomeAnotherStruct.structMethodExtended2(int, int)", + " The struct method with parameter \n" + + " \n" + + " @param a Parameter a \n" + + " @param b Parameter b \n" + + " \n" + + ""); + wantedComments.put("doxygen_parsing.SomeAnotherClass.setClassAttr2(int)", + "The class attribute post-comment \n" + + ""); + // and ask the parser to check comments for us System.exit(parser.check(wantedComments)); } diff --git a/Examples/test-suite/java/doxygen_translate_all_tags_runme.java b/Examples/test-suite/java/doxygen_translate_all_tags_runme.java new file mode 100644 index 000000000..065dfa27e --- /dev/null +++ b/Examples/test-suite/java/doxygen_translate_all_tags_runme.java @@ -0,0 +1,120 @@ + +import doxygen_translate_all_tags.*; +import com.sun.javadoc.*; +import java.util.HashMap; + +public class doxygen_translate_all_tags_runme { + static { + try { + System.loadLibrary("doxygen_translate_all_tags"); + } catch (UnsatisfiedLinkError e) { + System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e); + System.exit(1); + } + } + + public static void main(String argv[]) + { + /* + Here we are using internal javadoc tool, it accepts the name of the class as paramterer, + and calls the start() method of that class with parsed information. + */ + commentParser parser = new commentParser(); + com.sun.tools.javadoc.Main.execute("doxygen_translate_all_tags runtime test", + "commentParser", new String[]{"-quiet", "doxygen_translate_all_tags"}); + + HashMap wantedComments = new HashMap(); + + wantedComments.put("doxygen_translate_all_tags.doxygen_translate_all_tags.function(int, float)", + " Hello \n" + + "
    • some list item \n" + + "
    • This is attention! \n" + + " You were warned! \n" + + " @author lots of them \n" + + " @author Zubr \n" + + " boldword \n" + + " Some brief description, \n" + + " extended to many lines. \n" + + " Not everything works right now... \n" + + " codeword \n" + + " citationword \n" + + " {@code some test code }\n" + + " Conditional comment: SOMECONDITION \n" + + " Some conditional comment \n" + + " End of conditional comment.\n" + + " Copyright: some copyright \n" + + " 1970 - 2012 \n" + + " @deprecated Now use another function \n" + + " This is very large \n" + + " and detailed description of some thing \n" + + " italicword \n" + + " emphazedWord \n" + + " @exception SuperError \n" + + " This will only appear in hmtl \n" + + " If: ANOTHERCONDITION {\n" + + " First part of comment \n" + + " If: SECONDCONDITION {\n" + + " Nested condition text \n" + + " }Else if: THIRDCONDITION {\n" + + " The third condition text \n" + + " }Else: {The last text block \n" + + " }\n" + + " }Else: {Second part of comment \n" + + " If: CONDITION {\n" + + " Second part extended \n" + + " }\n" + + " }\n" + + " If not: SOMECONDITION {\n" + + " This is printed if not \n" + + " }\n" + + " \"Hello,\n" + + " Some text \n" + + " describing invariant. \n" + + " This will only appear in LATeX \n" + + "
        \n" + + "
      • Some unordered list \n" + + "
      • With lots of items \n" + + "
      • lots of lots of items \n" + + "
      \n" + + " {@link someMember Some description follows }\n" + + " This will only appear in man \n" + + " Note: Here \n" + + " is the note! \n" + + " This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.\n" + + " someword \n" + + " @package superPackage \n" + + "

      \n" + + " The paragraph text. \n" + + " Maybe even multiline \n" + + "

      \n" + + " @param a the first param \n" + + " Remarks: Some remark text \n" + + " Remarks: Another remarks section \n" + + " @return Whatever \n" + + " @return it \n" + + " @return may return \n" + + " This will only appear in RTF \n" + + " @see someOtherMethod \n" + + " @see function \n" + + " Same as \n" + + " brief description \n" + + " @since version 0.0.0.1 \n" + + " @throws superException \n" + + " @throws RuntimeError \n" + + " TODO: Some very important task \n" + + " @param b B is mentioned again... \n" + + " {@literal \n" + + "very long \n" + + "text with tags \n" + + " }\n" + + " @version 0.0.0.2 \n" + + " Warning: This is senseless! \n" + + " This will only appear in XML \n" + + " Here goes test of symbols: \n" + + " $ @ \\ & ~ < > # % \" . :: \n" + + " And here goes simple text \n" + + ""); + // and ask the parser to check comments for us + System.exit(parser.check(wantedComments)); + } +} \ No newline at end of file diff --git a/Examples/test-suite/java/doxygen_translate_runme.java b/Examples/test-suite/java/doxygen_translate_runme.java index 6eec790e2..cfd62d79c 100644 --- a/Examples/test-suite/java/doxygen_translate_runme.java +++ b/Examples/test-suite/java/doxygen_translate_runme.java @@ -25,7 +25,8 @@ public class doxygen_translate_runme { HashMap wantedComments = new HashMap(); - wantedComments.put("function", " Hello \n" + + wantedComments.put("doxygen_translate.doxygen_translate.function(int, float)", + " Hello \n" + " \n" + "
    • some list item \n" + " \n" + @@ -91,8 +92,7 @@ public class doxygen_translate_runme { " Note: Here \n" + " is the note! \n" + " \n" + - " This is an overloaded member function, provided for convenience. \n" + - " It differs from the above function only in what argument(s) it accepts.\n" + + " This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.\n" + " \n" + " someword \n" + " \n" + @@ -141,8 +141,8 @@ public class doxygen_translate_runme { " $ @ \\ & ~ < > # % \" . :: \n" + " \n" + " And here goes simple text \n" + - " \n"); - + " \n" + + ""); // and ask the parser to check comments for us System.exit(parser.check(wantedComments)); } From 8a683e42d0341388a46b964572d46ecf40a69796 Mon Sep 17 00:00:00 2001 From: Dmitry Kabak Date: Mon, 23 Jul 2012 13:50:27 +0000 Subject: [PATCH 100/314] Fixed and updated all doxygen python tests git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2012-doxygen@13346 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- .../python/doxygen_basic_translate_runme.py | 62 ++++ .../python/doxygen_parsing_runme.py | 56 +-- .../doxygen_translate_all_tags_runme.py | 320 ++++++++++++++++++ .../python/doxygen_translate_runme.py | 148 ++++++++ 4 files changed, 562 insertions(+), 24 deletions(-) create mode 100644 Examples/test-suite/python/doxygen_basic_translate_runme.py create mode 100644 Examples/test-suite/python/doxygen_translate_all_tags_runme.py create mode 100644 Examples/test-suite/python/doxygen_translate_runme.py diff --git a/Examples/test-suite/python/doxygen_basic_translate_runme.py b/Examples/test-suite/python/doxygen_basic_translate_runme.py new file mode 100644 index 000000000..95596c1f3 --- /dev/null +++ b/Examples/test-suite/python/doxygen_basic_translate_runme.py @@ -0,0 +1,62 @@ +#!/usr/bin/python + +import doxygen_basic_translate +import string +import sys + +def check(got, expected): + #if got is Null + # raise RuntimeError('Expected comment string\n') + gotStr = string.replace(got, ' ', '') + gotStr = string.replace(gotStr, '\n', '') + gotStr = string.replace(gotStr, '\t', '') + expectedStr = string.replace(expected, ' ', '') + expectedStr = string.replace(expectedStr, '\n', '') + expectedStr = string.replace(expectedStr, '\t', '') + if not gotStr == expectedStr: + raise RuntimeError("Expected: [" + str(expected) + "]\n" + "Got : [" + str(got) + "]\n") + +check(doxygen_basic_translate.function.__doc__, '' +' Brief description.\n' +' The comment text\n' +' Authors:\n' +' Some author\n' +' Return:\n' +' Some number\n' +' See also:\n' +' function2\n' +) +check(doxygen_basic_translate.function2.__doc__, '' +' A test of a very very very very very very very very very very very' +' very very very very very' +' very very very very very long comment' +' string.' +) +check(doxygen_basic_translate.function3.__doc__, '' +' ----------------------------------------------------------------\n' +' Overload 1:\n' +' ----------------------------------------------------------------\n' +' A test for overloaded functions\n' +' This is function __one__\n' +' ----------------------------------------------------------------\n' +' Overload 2:\n' +' ----------------------------------------------------------------\n' +' A test for overloaded functions\n' +' This is function __two__\n' +) +check(doxygen_basic_translate.function4.__doc__, '' +' A test of some mixed tag usage\n' +' If: CONDITION {\n' +' This _code_fragment shows us something .\n' +' Title: Minuses:\n' +' -it\'s senseless\n' +' -it\'s stupid\n' +' -it\'s null\n' +' Warning:\n' +' This may not work as expected\n' +' int main() { while(true); }\n' +' }' +) +check(doxygen_basic_translate.function5.__doc__, '' +' Test for default args' +) \ No newline at end of file diff --git a/Examples/test-suite/python/doxygen_parsing_runme.py b/Examples/test-suite/python/doxygen_parsing_runme.py index b814a68ed..cb22bb369 100644 --- a/Examples/test-suite/python/doxygen_parsing_runme.py +++ b/Examples/test-suite/python/doxygen_parsing_runme.py @@ -1,39 +1,47 @@ #!/usr/bin/python import doxygen_parsing +import string import sys -import re def check(got, expected): - if not re.match(str(expected), str(got)): - raise RuntimeError("\n" + "Expected: [" + str(expected) + "]\n" + "Got : [" + str(got) + "]") + #if got is Null + # raise RuntimeError('Expected comment string\n') + gotStr = string.replace(got, ' ', '') + gotStr = string.replace(gotStr, '\n', '') + gotStr = string.replace(gotStr, '\t', '') + expectedStr = string.replace(expected, ' ', '') + expectedStr = string.replace(expectedStr, '\n', '') + expectedStr = string.replace(expectedStr, '\t', '') + if not gotStr == expectedStr: + raise RuntimeError("Expected: [" + str(expected) + "]\n" + "Got : [" + str(got) + "]\n") -check(doxygen_parsing.someFunction.__doc__, '\s+The function comment\s+') -check(doxygen_parsing.SomeClass.__doc__, '\s+The class comment\s+') -check(doxygen_parsing.SomeStruct.__doc__, '\s+The struct comment\s+') -check(doxygen_parsing.SomeAnotherClass.classMethod.__doc__, '\s+The class method comment\s+') +check(doxygen_parsing.someFunction.__doc__, 'The function comment') +check(doxygen_parsing.SomeClass.__doc__, 'The class comment') +check(doxygen_parsing.SomeStruct.__doc__, 'The struct comment') +check(doxygen_parsing.SomeAnotherClass.classMethod.__doc__, 'The class method comment') check(doxygen_parsing.SomeAnotherClass.classMethodExtended.__doc__, '' -'\s+The class method with parameter' -'\s+Arguments:\s+' -'a \(int\)\s+-- Parameter a\s+' -'b \(int\)\s+-- Parameter b\s+' +'The class method with parameter\n' +'Arguments:\n' +'a (int) -- Parameter a\n' +'b (int) -- Parameter b\n' ) check(doxygen_parsing.SomeAnotherClass.classMethodExtended2.__doc__, '' -'\s+The class method with parameter' -'\s+Arguments:\s+' -'a \(int\)\s+-- Parameter a\s+' -'b \(int\)\s+-- Parameter b\s+' +'The class method with parameter\n' +'Arguments:\n' +'a (int)-- Parameter a\n' +'b (int)-- Parameter b\n' ) -check(doxygen_parsing.SomeAnotherStruct.structMethod.__doc__, '\s+The struct method comment\s+') +check(doxygen_parsing.SomeAnotherStruct.structMethod.__doc__, 'The struct method comment') check(doxygen_parsing.SomeAnotherStruct.structMethodExtended.__doc__, '' -'\s+The struct method with parameter' -'\s+Arguments:\s+' -'a \(int\)\s+-- Parameter a\s+' -'b \(int\)\s+-- Parameter b\s+' +'The struct method with parameter\n' +'Arguments:\n' +'a (int)-- Parameter a\n' +'b (int)-- Parameter b\n' ) check(doxygen_parsing.SomeAnotherStruct.structMethodExtended2.__doc__, '' -'\s+The struct method with parameter' -'\s+Arguments:\s+' -'a \(int\)\s+-- Parameter a\s+' -'b \(int\)\s+-- Parameter b\s+' +'The struct method with parameter\n' +'Arguments:\n' +'a (int)-- Parameter a\n' +'b (int)-- Parameter b\n' ) \ No newline at end of file diff --git a/Examples/test-suite/python/doxygen_translate_all_tags_runme.py b/Examples/test-suite/python/doxygen_translate_all_tags_runme.py new file mode 100644 index 000000000..768ccf1ba --- /dev/null +++ b/Examples/test-suite/python/doxygen_translate_all_tags_runme.py @@ -0,0 +1,320 @@ +#!/usr/bin/python + +import doxygen_translate_all_tags +import string +import sys + +def check(got, expected): + #if got is Null + # raise RuntimeError('Expected comment string\n') + gotStr = string.replace(got, ' ', '') + gotStr = string.replace(gotStr, '\n', '') + gotStr = string.replace(gotStr, '\t', '') + expectedStr = string.replace(expected, ' ', '') + expectedStr = string.replace(expectedStr, '\n', '') + expectedStr = string.replace(expectedStr, '\t', '') + if not gotStr == expectedStr: + raise RuntimeError("Expected: [" + str(expected) + "]\n" + "Got : [" + str(got) + "]\n") + +check(doxygen_translate_all_tags.function.__doc__, '' +' _Hello_' +'' +' SomeLatexIndex ' +'' +' someGroupSome title ' +'' +' theAnchor' +'' +' -some list item ' +'' +' This is attention! ' +' You were warned! ' +'' +' Authors:' +' lots of them ' +'' +' Zubr ' +'' +' __boldword__' +'' +' Some brief description, ' +' extended to many lines. ' +'' +' Not everything works right now... ' +'' +' codeword' +'' +' someCategoryheaderFile.hheaderName' +'' +' \'citationword\'' +'' +' someClassheaderFile.hheaderName' +'' +' some test code ' +'' +' Conditional comment: SOMECONDITION' +' Some conditional comment ' +' End of conditional comment.' +'' +' someClass::someMethod' +'' +' someClass::someMethod2' +'' +' someClass::someMethod3' +'' +' Copyright:' +' some copyright ' +'' +' 1970 - 2012 ' +'' +' someDefine' +'' +' someGroupSome titles ' +'' +' Deprecated:' +' Now use another function ' +'' +' This is very large ' +' and detailed description of some thing ' +'' +' /somePath/someFolder' +'' +' someFile.h' +'' +' digraph example { ' +' node [shape=record, fontname=Helvetica, fontsize=10]; ' +'' +' b [ label="class B" URL="\ref B"]; ' +' c [ label="class C" URL="\ref C"]; ' +' b -> c [ arrowhead="open", style="dashed" ]; ' +' } ' +'' +'' +' dotFile.dotThe caption' +'' +' _italicword_' +'' +' emphazedWord' +'' +' someEnum' +'' +' Example:' +' someFile.txt' +' Some details on using the example ' +'' +' Throws:' +' SuperError' +'' +' someOtherFunction' +'' +' file.h' +'' +' someFn ' +'' +' someHeader.hHeader name' +'' +' htmlFile.htm' +'' +' This will only appear in hmtl ' +'' +' If: ANOTHERCONDITION {' +' First part of comment ' +' If: SECONDCONDITION {' +' Nested condition text ' +' }Else if: THIRDCONDITION {' +' The third condition text ' +' }Else: {The last text block ' +' }' +' }Else: {Second part of comment ' +' If: CONDITION {' +' Second part extended ' +' }' +' }' +'' +' If not: SOMECONDITION {' +' This is printed if not ' +' }' +'' +' Image: htmltestImage.bmpHello, world!asd=10qwe' +'' +' someFunction' +'' +' header.h' +'' +' header2.h' +'' +' someGroupanotherGroup' +'' +' Some text ' +' describing invariant. ' +'' +' someInterfacesomeHeader.hHeader name' +'' +' This will only appear in LATeX ' +'' +'
        ' +'' +' -Some unordered list ' +' -With lots of items ' +' -lots of lots of items ' +'' +'
      ' +'' +' example ' +'' +' someMember Some description follows ' +'' +' Sometitle ' +'' +' This will only appear in man ' +'' +' someThing' +'' +' Sender,Receiver; ' +' Sender->Receiver [label="Command()", URL="\ref ' +' Receiver::Command()"]; ' +' Sender<-Receiver [label="Ack()", URL="\ref ' +' Ack()", ID="1"]; ' +'' +' mscFile.mscThe caption' +'' +' someHeader.h ' +'' +' someNamespace' +'' +' Notes:' +' Here ' +' is the note! ' +'' +' This is an overloaded member function, provided for convenience.' +' It differs from the above function only in what argument(s) it accepts.' +'' +' someword' +'' +' superPackage' +'' +' somePageThe title ' +'' +' Title: The paragraph title ' +' The paragraph text. ' +' Maybe even multiline ' +'' +' someParagraphParagraph title ' +'' +' Arguments:' +' a (int) -- the first param ' +'' +' Some description ' +'' +' Some description ' +'' +' someVar ' +'' +' someProtocolheader.hHeader name' +'' +' someAnchor' +'' +' toSomething' +'' +' toSomethingElse' +'' +' someName' +'' +' someName' +'' +' Remarks:' +' Some remark text ' +'' +' Another remarks section ' +'' +' Return:' +' Whatever ' +'' +' it ' +'' +' may return ' +'' +' someValueSome description ' +'' +'' +' This will only appear in RTF ' +'' +'' +' See also:' +' someOtherMethod ' +'' +' someSectionSome title ' +'' +' function ' +'' +' Same as ' +' brief description ' +'' +'' +'' +' Since:' +' version 0.0.0.1 ' +'' +' somePattern ' +'' +' someLine ' +'' +' example.hSome snippet ' +'' +' someStruct' +'' +' someSubpageSome description' +'' +' someSubsectionSome title ' +'' +' someSubsectionSome title ' +'' +'' +'' +' Some ' +' description of the ' +' test case ' +'' +' Throws:' +' superException' +'' +' RuntimeError' +'' +' TODO:' +' Some very important task ' +'' +' Arguments:' +' b (float) -- B is mentioned again... ' +'' +' someTypedef ' +'' +' someUnion' +'' +' somePattern ' +'' +' someVar ' +'' +'' +' very long ' +' text with tags ' +'' +'' +' someFile.h' +'' +' Version:' +' 0.0.0.2 ' +'' +' Warning:' +' This is senseless! ' +'' +' someGroupSome title ' +'' +'' +' This will only appear in XML ' +'' +'' +' Here goes test of symbols: ' +' $@\&~<>#%".::' +'' +' And here goes simple text ' +) \ No newline at end of file diff --git a/Examples/test-suite/python/doxygen_translate_runme.py b/Examples/test-suite/python/doxygen_translate_runme.py new file mode 100644 index 000000000..61e5f5398 --- /dev/null +++ b/Examples/test-suite/python/doxygen_translate_runme.py @@ -0,0 +1,148 @@ +#!/usr/bin/python + +import doxygen_translate +import string +import sys + +def check(got, expected): + #if got is Null + # raise RuntimeError('Expected comment string\n') + gotStr = string.replace(got, ' ', '') + gotStr = string.replace(gotStr, '\n', '') + gotStr = string.replace(gotStr, '\t', '') + expectedStr = string.replace(expected, ' ', '') + expectedStr = string.replace(expectedStr, '\n', '') + expectedStr = string.replace(expectedStr, '\t', '') + if not gotStr == expectedStr: + raise RuntimeError("Expected: [" + str(expected) + "]\n" + "Got : [" + str(got) + "]\n") + +check(doxygen_translate.function.__doc__, '' +' _Hello_' +'' +' -some list item ' +'' +' Authors:' +' lots of them ' +'' +' Zubr ' +'' +' __boldword__' +'' +' codeword' +'' +' \'citationword\'' +'' +' some test code ' +'' +' Conditional comment: SOMECONDITION' +' Some conditional comment ' +' End of conditional comment.' +'' +' Copyright:' +' some copyright ' +'' +' Deprecated:' +' Now use another function ' +'' +' _italicword_' +'' +' Example:' +' someFile.txt' +' Some details on using the example ' +'' +' Throws:' +' SuperError' +'' +' If: ANOTHERCONDITION {' +' First part of comment ' +' If: SECONDCONDITION {' +' Nested condition text ' +' }Else if: THIRDCONDITION {' +' The third condition text ' +' }Else: {The last text block ' +' }' +' }Else: {Second part of comment ' +' If: CONDITION {' +' Second part extended ' +' }' +' }' +'' +' If not: SOMECONDITION {' +' This is printed if not ' +' }' +'' +' Image: htmltestImage.bmpHello, world!asd=10qwe' +'' +'
        ' +'' +' -Some unordered list ' +' -With lots of items ' +' -lots of lots of items ' +'' +'
      ' +'' +' someMember Some description follows ' +'' +' Notes:' +' Here ' +' is the note! ' +'' +' This is an overloaded member function, provided for convenience.' +' It differs from the above function only in what argument(s) it accepts.' +'' +' someword' +'' +' superPackage' +'' +' Title: The paragraph title ' +' The paragraph text. ' +' Maybe even multiline ' +'' +' Arguments:' +' a (int) -- the first param ' +'' +' Remarks:' +' Some remark text ' +'' +' Another remarks section ' +'' +' Return:' +' Whatever ' +'' +' it ' +'' +' may return ' +'' +' See also:' +' someOtherMethod ' +'' +' function ' +'' +' Since:' +' version 0.0.0.1 ' +'' +' Throws:' +' superException' +'' +' RuntimeError' +'' +' TODO:' +' Some very important task ' +'' +' Arguments:' +' b (float) -- B is mentioned again... ' +'' +' very long ' +' text with tags ' +'' +' Version:' +' 0.0.0.2 ' +'' +' Warning:' +' This is senseless! ' +'' +' Here goes test of symbols: ' +' $@\&~<>#%".::' +'' +' And here goes simple text ' +) \ No newline at end of file From a7ae017d55078cf675d130c846ff05f78531d61c Mon Sep 17 00:00:00 2001 From: Dmitry Kabak Date: Wed, 25 Jul 2012 07:52:54 +0000 Subject: [PATCH 101/314] Fixed some spelling in project plan git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2012-doxygen@13396 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Doc/Devel/plan-gsoc-2012.txt | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/Doc/Devel/plan-gsoc-2012.txt b/Doc/Devel/plan-gsoc-2012.txt index 6566598fe..6f012cd4b 100644 --- a/Doc/Devel/plan-gsoc-2012.txt +++ b/Doc/Devel/plan-gsoc-2012.txt @@ -2,29 +2,35 @@ + Project Plan + ============ + SWIG Code Comments + Google Summer of Code 2012 + + This document describes goals for the Google Summer of Code 2012, SWIG code documentation project. -Author: Marko Klopcic +Author: Marko Klopcic, Dmitry Kabak Introduction ============ -The goal of this project is _not_ to translate _any_ possible doxygen +The goal of this project is _not_ to translate _any_ possible Doxygen formatted comment to JavaDoc or PyDoc, but to make it possible to translate a subset of comment types in C/C++ code to JavaDoc and PyDoc. Covering all the Doxygen functionality would be to -complex for the limited time. Hovewer, the code must be extendable so +complex for the limited time. However, the code must be flexible so that implementing missing features would not require redesign of the comment handling code in SWIG. -There will also be a possiblity to add untranslated comments to Java +There will also be a possibility to add untranslated comments to Java and Python code (## comments, see Doxygen manual), if the user will prefer to use Doxygen on the generated code. Note: -'-OK-' tick below means that the item is implemented, commited and +'-OK-' tick below means that the item is implemented, committed and working. Abbreviations: @@ -249,7 +255,7 @@ Optional functionality ====================== That section describes some complex cases where the current code -not behaves really well. Like a short to-do list of special cases. +does not behave really well. Like a short to-do list of special cases. - When translating functions with default parameters in swig to java, it creates overloaded functions with all the parameters From 0b7d1ffc454522da7eb7b761cece8217ddf98b2d Mon Sep 17 00:00:00 2001 From: Dmitry Kabak Date: Wed, 25 Jul 2012 12:11:28 +0000 Subject: [PATCH 102/314] Small fix to correctly generate overloaded method comments in python git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2012-doxygen@13400 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Source/DoxygenTranslator/src/PyDocConverter.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Source/DoxygenTranslator/src/PyDocConverter.cpp b/Source/DoxygenTranslator/src/PyDocConverter.cpp index 5b6f39adf..3ae018cf9 100644 --- a/Source/DoxygenTranslator/src/PyDocConverter.cpp +++ b/Source/DoxygenTranslator/src/PyDocConverter.cpp @@ -252,6 +252,7 @@ String *PyDocConverter::makeDocumentation(Node *n) { while (n) { documentation = getDoxygenComment(n); if (!Swig_is_generated_overload(n) && documentation) { + currentNode = n; std::list < DoxygenEntity > entityList = parser.createTree(Char(documentation), Char(Getfile(documentation)), Getline(documentation)); DoxygenEntity root("root", entityList); allDocumentation.push_back(translateSubtree(root)); From 4951d4a9007a0a64ed67b56e4d0d12a56097fe97 Mon Sep 17 00:00:00 2001 From: Dmitry Kabak Date: Sat, 28 Jul 2012 09:19:23 +0000 Subject: [PATCH 103/314] Got rid of 81 reduce/reduce warnings in parser.y git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2012-doxygen@13424 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Source/CParse/parser.y | 48 ++++++++++++++++-------------------------- 1 file changed, 18 insertions(+), 30 deletions(-) diff --git a/Source/CParse/parser.y b/Source/CParse/parser.y index 4bf63b40f..6aed8c3f9 100644 --- a/Source/CParse/parser.y +++ b/Source/CParse/parser.y @@ -1798,7 +1798,6 @@ static void tag_nodes(Node *n, const_String_or_char_ptr attrname, DOH *value) { %type featattr; %type doxygen_comment; %type doxygen_comment_item; -%type c_style_comment; %type doxygen_post_comment; %type doxygen_post_comment_item; %% @@ -1849,6 +1848,16 @@ interface : interface declaration { appendChild($1,$2); $$ = $1; } + | interface doxygen_comment declaration { + set_comment($3, $2); + appendChild($1, $3); + $$ = $1; + } + | interface declaration doxygen_post_comment { + set_comment($2, $3); + appendChild($1, $2); + $$ = $1; + } | empty { $$ = new_node("top"); } @@ -1857,7 +1866,6 @@ interface : interface declaration { declaration : swig_directive { $$ = $1; } | c_declaration { $$ = $1; } | cpp_declaration { $$ = $1; } - | c_style_comment { $$ = $1; } | SEMI { $$ = 0; } | error { $$ = 0; @@ -1880,15 +1888,6 @@ declaration : swig_directive { $$ = $1; } COPERATOR token---discarding the rest of the definition. Ugh. */ - - | doxygen_comment declaration { - $$ = $2; - set_comment($2, $1); - } - | declaration doxygen_post_comment { - $$ = $1; - set_comment($1, $2); - } | error COPERATOR { $$ = 0; skip_decl(); @@ -3470,15 +3469,14 @@ doxygen_comment_item : DOXYGENSTRING { else { $$ = $1; } - } - ; - -doxygen_comment : doxygen_comment doxygen_comment_item { + | doxygen_comment_item doxygen_comment_item { Append($1, $2); $$ = $1; } - | doxygen_comment_item { + ; + +doxygen_comment : doxygen_comment_item { $$ = $1; } ; @@ -3493,26 +3491,17 @@ doxygen_post_comment_item : DOXYGENPOSTSTRING { $$ = $1; } - ; - -doxygen_post_comment : doxygen_post_comment doxygen_post_comment_item { + | doxygen_post_comment_item doxygen_post_comment_item { Append($1, $2); $$ = $1; } - | doxygen_post_comment_item { + ; + +doxygen_post_comment : doxygen_post_comment_item { $$ = $1; } ; -c_style_comment : C_COMMENT_STRING { - if(currentCComment != 0){ - Append(currentCComment, $1); - } - else currentCComment = $1; - $$ = 0; - } - ; - /* ====================================================================== * C++ Support * ====================================================================== */ @@ -4489,7 +4478,6 @@ cpp_member : c_declaration { $$ = $1; } | storage_class idcolon SEMI { $$ = 0; } | cpp_using_decl { $$ = $1; } | cpp_template_decl { $$ = $1; } - | c_style_comment{ $$ = $1; } | cpp_catch_decl { $$ = 0; } | template_directive { $$ = $1; } | warn_directive { $$ = $1; } From 5fe88acdfb47b68e32e2323d004aefc115f998f0 Mon Sep 17 00:00:00 2001 From: Dmitry Kabak Date: Sun, 29 Jul 2012 11:37:38 +0000 Subject: [PATCH 104/314] Forgot to escape special HTML-chars in JavaDocConverter git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2012-doxygen@13425 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- .../test-suite/java/doxygen_translate_all_tags_runme.java | 4 ++-- Examples/test-suite/java/doxygen_translate_runme.java | 4 ++-- Source/DoxygenTranslator/src/JavaDocConverter.cpp | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Examples/test-suite/java/doxygen_translate_all_tags_runme.java b/Examples/test-suite/java/doxygen_translate_all_tags_runme.java index 065dfa27e..6db1f6686 100644 --- a/Examples/test-suite/java/doxygen_translate_all_tags_runme.java +++ b/Examples/test-suite/java/doxygen_translate_all_tags_runme.java @@ -111,10 +111,10 @@ public class doxygen_translate_all_tags_runme { " Warning: This is senseless! \n" + " This will only appear in XML \n" + " Here goes test of symbols: \n" + - " $ @ \\ & ~ < > # % \" . :: \n" + + " $ @ \\ & ~ < > # % " . :: \n" + " And here goes simple text \n" + ""); // and ask the parser to check comments for us System.exit(parser.check(wantedComments)); } -} \ No newline at end of file +} diff --git a/Examples/test-suite/java/doxygen_translate_runme.java b/Examples/test-suite/java/doxygen_translate_runme.java index cfd62d79c..8aa80a6ed 100644 --- a/Examples/test-suite/java/doxygen_translate_runme.java +++ b/Examples/test-suite/java/doxygen_translate_runme.java @@ -138,7 +138,7 @@ public class doxygen_translate_runme { " Warning: This is senseless! \n" + " \n" + " Here goes test of symbols: \n" + - " $ @ \\ & ~ < > # % \" . :: \n" + + " $ @ \\ & ~ < > # % " . :: \n" + " \n" + " And here goes simple text \n" + " \n" + @@ -146,4 +146,4 @@ public class doxygen_translate_runme { // and ask the parser to check comments for us System.exit(parser.check(wantedComments)); } -} \ No newline at end of file +} diff --git a/Source/DoxygenTranslator/src/JavaDocConverter.cpp b/Source/DoxygenTranslator/src/JavaDocConverter.cpp index 8f6725f5c..636d49ebf 100644 --- a/Source/DoxygenTranslator/src/JavaDocConverter.cpp +++ b/Source/DoxygenTranslator/src/JavaDocConverter.cpp @@ -36,13 +36,13 @@ void JavaDocConverter::fillStaticTables() { tagHandlers["$"] = make_pair(&JavaDocConverter::handleTagChar, ""); tagHandlers["@"] = make_pair(&JavaDocConverter::handleTagChar, ""); tagHandlers["\\"] = make_pair(&JavaDocConverter::handleTagChar, ""); - tagHandlers["<"] = make_pair(&JavaDocConverter::handleTagChar, ""); - tagHandlers[">"] = make_pair(&JavaDocConverter::handleTagChar, ""); - tagHandlers["&"] = make_pair(&JavaDocConverter::handleTagChar, ""); + tagHandlers["<"] = make_pair(&JavaDocConverter::handleTagChar, "<"); + tagHandlers[">"] = make_pair(&JavaDocConverter::handleTagChar, ">"); + tagHandlers["&"] = make_pair(&JavaDocConverter::handleTagChar, "&"); tagHandlers["#"] = make_pair(&JavaDocConverter::handleTagChar, ""); tagHandlers["%"] = make_pair(&JavaDocConverter::handleTagChar, ""); tagHandlers["~"] = make_pair(&JavaDocConverter::handleTagChar, ""); - tagHandlers["\""] = make_pair(&JavaDocConverter::handleTagChar, ""); + tagHandlers["\""] = make_pair(&JavaDocConverter::handleTagChar, """); tagHandlers["."] = make_pair(&JavaDocConverter::handleTagChar, ""); tagHandlers["::"] = make_pair(&JavaDocConverter::handleTagChar, ""); // these commands are stripped out From 03da0be1fafce6b67e1d8fef033a1a0dd02a3687 Mon Sep 17 00:00:00 2001 From: Dmitry Kabak Date: Sun, 29 Jul 2012 11:53:01 +0000 Subject: [PATCH 105/314] Fixed numerous 'unused argument' warnings git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2012-doxygen@13426 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Source/DoxygenTranslator/src/JavaDocConverter.cpp | 10 +++++----- Source/DoxygenTranslator/src/PyDocConverter.cpp | 14 +++++++------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Source/DoxygenTranslator/src/JavaDocConverter.cpp b/Source/DoxygenTranslator/src/JavaDocConverter.cpp index 636d49ebf..1f0ea9437 100644 --- a/Source/DoxygenTranslator/src/JavaDocConverter.cpp +++ b/Source/DoxygenTranslator/src/JavaDocConverter.cpp @@ -177,7 +177,7 @@ void JavaDocConverter::handleTagHtml(DoxygenEntity& tag, std::string& translated if (tag.entityList.size()) // do not include empty tags translatedComment += "<" + arg + ">" + translateSubtree(tag) + ""; } -void JavaDocConverter::handleNewLine(DoxygenEntity& tag, std::string& translatedComment, std::string &arg) { +void JavaDocConverter::handleNewLine(DoxygenEntity&, std::string& translatedComment, std::string&) { translatedComment += "\n * "; } void JavaDocConverter::handleTagChar(DoxygenEntity& tag, std::string& translatedComment, std::string &arg) { @@ -193,10 +193,10 @@ void JavaDocConverter::handleTagSame(DoxygenEntity& tag, std::string& translated tag.typeOfEntity = arg; translatedComment += formatCommand(std::string("@" + tag.typeOfEntity + " " + translateSubtree(tag)), 2); } -void JavaDocConverter::handleParagraph(DoxygenEntity& tag, std::string& translatedComment, std::string &arg) { +void JavaDocConverter::handleParagraph(DoxygenEntity& tag, std::string& translatedComment, std::string&) { translatedComment += formatCommand(translateSubtree(tag), 0); } -void JavaDocConverter::handlePlainString(DoxygenEntity& tag, std::string& translatedComment, std::string &arg) { +void JavaDocConverter::handlePlainString(DoxygenEntity& tag, std::string& translatedComment, std::string&) { translatedComment += tag.data; if (tag.data.size() && tag.data[tag.data.size()-1] != ' ') translatedComment += " "; @@ -222,7 +222,7 @@ void JavaDocConverter::handleTagMessage(DoxygenEntity& tag, std::string& transla translatedComment += formatCommand(arg, 0); handleParagraph(tag, translatedComment, dummy); } -void JavaDocConverter::handleTagImage(DoxygenEntity& tag, std::string& translatedComment, std::string &arg) { +void JavaDocConverter::handleTagImage(DoxygenEntity& tag, std::string& translatedComment, std::string&) { if (tag.entityList.size() < 2) return; @@ -245,7 +245,7 @@ void JavaDocConverter::handleTagImage(DoxygenEntity& tag, std::string& translate translatedComment += " alt=\"" + title +"\""; translatedComment += " />"; } -void JavaDocConverter::handleTagPar(DoxygenEntity& tag, std::string& translatedComment, std::string &arg) { +void JavaDocConverter::handleTagPar(DoxygenEntity& tag, std::string& translatedComment, std::string&) { std::string dummy; translatedComment += "= maxWidth || (stringPosition + 1) == documentString.end()) { + if ((iswspace(*stringPosition) && (int) currentLine.size() >= maxWidth) || (stringPosition + 1) == documentString.end()) { formattedString += currentLine + "\n"; currentLine = ""; } @@ -173,10 +173,10 @@ void PyDocConverter::translateEntity(DoxygenEntity & doxyEntity, std::string &tr handleParagraph(doxyEntity, translatedComment, dummy); } -void PyDocConverter::handleParagraph(DoxygenEntity& tag, std::string& translatedComment, std::string &arg) { +void PyDocConverter::handleParagraph(DoxygenEntity& tag, std::string& translatedComment, std::string&) { translatedComment += justifyString(translateSubtree(tag), 0); } -void PyDocConverter::handlePlainString(DoxygenEntity& tag, std::string& translatedComment, std::string &arg) { +void PyDocConverter::handlePlainString(DoxygenEntity& tag, std::string& translatedComment, std::string&) { translatedComment += tag.data; if (tag.data.size() && tag.data[tag.data.size()-1] != ' ') translatedComment += ""; @@ -186,7 +186,7 @@ void PyDocConverter::handleTagMessage(DoxygenEntity& tag, std::string& translate translatedComment += arg; handleParagraph(tag, translatedComment, dummy); } -void PyDocConverter::handleTagChar(DoxygenEntity& tag, std::string& translatedComment, std::string &arg) { +void PyDocConverter::handleTagChar(DoxygenEntity& tag, std::string& translatedComment, std::string&) { translatedComment += tag.typeOfEntity; } void PyDocConverter::handleTagIf(DoxygenEntity& tag, std::string& translatedComment, std::string &arg) { @@ -198,7 +198,7 @@ void PyDocConverter::handleTagIf(DoxygenEntity& tag, std::string& translatedComm translatedComment += " {" + translateSubtree(tag) + "}"; } } -void PyDocConverter::handleTagPar(DoxygenEntity& tag, std::string& translatedComment, std::string &arg) { +void PyDocConverter::handleTagPar(DoxygenEntity& tag, std::string& translatedComment, std::string&) { std::string dummy; translatedComment += "Title: "; if (tag.entityList.size()) @@ -206,7 +206,7 @@ void PyDocConverter::handleTagPar(DoxygenEntity& tag, std::string& translatedCom tag.entityList.pop_front(); handleParagraph(tag, translatedComment, dummy); } -void PyDocConverter::handleTagParam(DoxygenEntity& tag, std::string& translatedComment, std::string &arg) { +void PyDocConverter::handleTagParam(DoxygenEntity& tag, std::string& translatedComment, std::string&) { std::string dummy; if (tag.entityList.size() < 2) { // TODO: log error @@ -229,7 +229,7 @@ void PyDocConverter::handleTagWrap(DoxygenEntity& tag, std::string& translatedCo if (tag.entityList.size()) // do not include empty tags translatedComment += arg + translateSubtree(tag) + arg; } -void PyDocConverter::handleNewLine(DoxygenEntity& tag, std::string& translatedComment, std::string &arg) { +void PyDocConverter::handleNewLine(DoxygenEntity&, std::string& translatedComment, std::string&) { translatedComment += "\n"; } From 3fbe45f0c619e33f482782af2af8e2955860c2d1 Mon Sep 17 00:00:00 2001 From: Dmitry Kabak Date: Sun, 29 Jul 2012 13:48:03 +0000 Subject: [PATCH 106/314] Added nice doxygen debug switching (-debug-doxygen-parser and -debug-doxygen-translator) git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2012-doxygen@13427 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Source/DoxygenTranslator/src/DoxygenParser.cpp | 2 +- Source/DoxygenTranslator/src/DoxygenParser.h | 2 +- .../DoxygenTranslator/src/DoxygenTranslator.cpp | 3 ++- Source/DoxygenTranslator/src/DoxygenTranslator.h | 3 ++- .../DoxygenTranslator/src/JavaDocConverter.cpp | 4 +++- Source/DoxygenTranslator/src/JavaDocConverter.h | 3 +-- Source/DoxygenTranslator/src/PyDocConverter.cpp | 3 ++- Source/DoxygenTranslator/src/PyDocConverter.h | 3 +-- Source/Modules/java.cxx | 16 ++++++++++++---- Source/Modules/python.cxx | 13 ++++++++++++- 10 files changed, 37 insertions(+), 15 deletions(-) diff --git a/Source/DoxygenTranslator/src/DoxygenParser.cpp b/Source/DoxygenTranslator/src/DoxygenParser.cpp index 80ded041a..8ed186727 100644 --- a/Source/DoxygenTranslator/src/DoxygenParser.cpp +++ b/Source/DoxygenTranslator/src/DoxygenParser.cpp @@ -17,7 +17,7 @@ std::map DoxygenParser::doxygenCommands; std::set DoxygenParser::doxygenSectionIndicators; -DoxygenParser::DoxygenParser() : noisy(false) { +DoxygenParser::DoxygenParser(bool noisy) : noisy(noisy) { fillTables(); } diff --git a/Source/DoxygenTranslator/src/DoxygenParser.h b/Source/DoxygenTranslator/src/DoxygenParser.h index c72ca6fed..5f6432d87 100644 --- a/Source/DoxygenTranslator/src/DoxygenParser.h +++ b/Source/DoxygenTranslator/src/DoxygenParser.h @@ -19,7 +19,7 @@ #include "TokenList.h" class DoxygenParser { public: - DoxygenParser(); + DoxygenParser(bool noisy = false); virtual ~DoxygenParser(); std::list < DoxygenEntity > createTree(std::string doxygen, std::string fileName, int lineNumber); private: diff --git a/Source/DoxygenTranslator/src/DoxygenTranslator.cpp b/Source/DoxygenTranslator/src/DoxygenTranslator.cpp index 18cf24c85..10f6a4585 100644 --- a/Source/DoxygenTranslator/src/DoxygenTranslator.cpp +++ b/Source/DoxygenTranslator/src/DoxygenTranslator.cpp @@ -14,7 +14,8 @@ #include "DoxygenTranslator.h" -DoxygenTranslator::DoxygenTranslator() { +DoxygenTranslator::DoxygenTranslator(bool debugTranslator, bool debugParser) +: debug(debugTranslator), parser(debugParser) { } DoxygenTranslator::~DoxygenTranslator() { } diff --git a/Source/DoxygenTranslator/src/DoxygenTranslator.h b/Source/DoxygenTranslator/src/DoxygenTranslator.h index 637b30a9e..97be4ee35 100644 --- a/Source/DoxygenTranslator/src/DoxygenTranslator.h +++ b/Source/DoxygenTranslator/src/DoxygenTranslator.h @@ -30,7 +30,7 @@ public: /* * Constructor */ - DoxygenTranslator(); + DoxygenTranslator(bool debugTranslator = false, bool debugParser = false); /* * Virtual destructor. */ @@ -52,6 +52,7 @@ public: String *getDoxygenComment(Node *node); protected: + bool debug; /* * Overridden in subclasses to return the documentation formatted for a given * documentation system. diff --git a/Source/DoxygenTranslator/src/JavaDocConverter.cpp b/Source/DoxygenTranslator/src/JavaDocConverter.cpp index 1f0ea9437..165075708 100644 --- a/Source/DoxygenTranslator/src/JavaDocConverter.cpp +++ b/Source/DoxygenTranslator/src/JavaDocConverter.cpp @@ -21,6 +21,7 @@ std::map > Ja void JavaDocConverter::fillStaticTables() { if (tagHandlers.size()) // fill only once + return; // these commands insert HTML tags tagHandlers["a"] = make_pair(&JavaDocConverter::handleTagHtml, "i"); @@ -105,7 +106,8 @@ void JavaDocConverter::fillStaticTables() { } -JavaDocConverter::JavaDocConverter() : debug(false) { +JavaDocConverter::JavaDocConverter(bool debugTranslator, bool debugParser) +: DoxygenTranslator(debugTranslator, debugParser) { fillStaticTables(); } diff --git a/Source/DoxygenTranslator/src/JavaDocConverter.h b/Source/DoxygenTranslator/src/JavaDocConverter.h index cb876ed6b..1d51a8d7b 100644 --- a/Source/DoxygenTranslator/src/JavaDocConverter.h +++ b/Source/DoxygenTranslator/src/JavaDocConverter.h @@ -22,7 +22,7 @@ */ class JavaDocConverter : public DoxygenTranslator { public: - JavaDocConverter(); + JavaDocConverter(bool debugTranslator = false, bool debugParser = false); String *makeDocumentation(Node *node); protected: @@ -88,7 +88,6 @@ protected: private: - bool debug; // this contains the handler pointer and one string argument static std::map > tagHandlers; void fillStaticTables(); diff --git a/Source/DoxygenTranslator/src/PyDocConverter.cpp b/Source/DoxygenTranslator/src/PyDocConverter.cpp index 5dd622760..a873cfb16 100644 --- a/Source/DoxygenTranslator/src/PyDocConverter.cpp +++ b/Source/DoxygenTranslator/src/PyDocConverter.cpp @@ -91,7 +91,8 @@ void PyDocConverter::fillStaticTables() { tagHandlers["n"] = make_pair(&PyDocConverter::handleNewLine, ""); } -PyDocConverter::PyDocConverter() : debug(false) { +PyDocConverter::PyDocConverter(bool debugTranslator, bool debugParser) +: DoxygenTranslator(debugTranslator, debugParser) { fillStaticTables(); } diff --git a/Source/DoxygenTranslator/src/PyDocConverter.h b/Source/DoxygenTranslator/src/PyDocConverter.h index f14a130ac..9787891c8 100644 --- a/Source/DoxygenTranslator/src/PyDocConverter.h +++ b/Source/DoxygenTranslator/src/PyDocConverter.h @@ -25,7 +25,7 @@ class PyDocConverter : public DoxygenTranslator { public: - PyDocConverter(); + PyDocConverter(bool debugTranslator = false, bool debugParser = false); String *makeDocumentation(Node *node); protected: @@ -108,7 +108,6 @@ protected: std::string getParamType(std::string name); private: - bool debug; // temporary thing, should be refactored somehow Node *currentNode; // this contains the handler pointer and one string argument diff --git a/Source/Modules/java.cxx b/Source/Modules/java.cxx index 49a5e9901..c7174d0fc 100644 --- a/Source/Modules/java.cxx +++ b/Source/Modules/java.cxx @@ -163,9 +163,6 @@ public: should be easy to implement though */ director_multiple_inheritance = 0; director_language = 1; - - if (doxygen) - doxygenTranslator = new JavaDocConverter(); } ~JAVA() { @@ -242,6 +239,9 @@ public: SWIG_library_directory("java"); + bool debug_doxygen_translator = false; + bool debug_doxygen_parser = false; + // Look for certain command line options for (int i = 1; i < argc; i++) { if (argv[i]) { @@ -271,6 +271,12 @@ public: Swig_mark_arg(i); doxygen = false; scan_doxygen_comments = false; + } else if ((strcmp(argv[i], "-debug-doxygen-translator") == 0)) { + Swig_mark_arg(i); + debug_doxygen_translator = true; + } else if ((strcmp(argv[i], "-debug-doxygen-parser") == 0)) { + Swig_mark_arg(i); + debug_doxygen_parser = true; } else if ((strcmp(argv[i], "-noproxy") == 0)) { Swig_mark_arg(i); proxy_flag = false; @@ -296,7 +302,7 @@ public: } if (doxygen) - doxygenTranslator = new JavaDocConverter(); + doxygenTranslator = new JavaDocConverter(debug_doxygen_translator, debug_doxygen_parser); // Add a symbol to the parser for conditional compilation Preprocessor_define("SWIGJAVA 1", 0); @@ -4537,6 +4543,8 @@ const char *JAVA::usage = (char *) "\ Java Options (available with -java)\n\ -doxygen - Convert C++ doxygen comments to JavaDoc comments in proxy classes (default)\n\ -nodoxygen - Don't convert C++ doxygen comments to JavaDoc comments in proxy classes\n\ + -debug-doxygen-parser - Display doxygen parser module debugging information\n\ + -debug-doxygen-translator - Display doxygen translator module debugging information\n\ -nopgcpp - Suppress premature garbage collection prevention parameter\n\ -noproxy - Generate the low-level functional interface instead\n\ of proxy classes\n\ diff --git a/Source/Modules/python.cxx b/Source/Modules/python.cxx index 5d9a97952..f7c9c00c1 100644 --- a/Source/Modules/python.cxx +++ b/Source/Modules/python.cxx @@ -121,6 +121,8 @@ Python Options (available with -python)\n\ -cppcast - Enable C++ casting operators (default) \n\ -dirvtable - Generate a pseudo virtual table for directors for faster dispatch \n\ -doxygen - Convert C++ doxygen comments to pydoc comments in proxy classes (default) \n\ + -debug-doxygen-parser - Display doxygen parser module debugging information\n\ + -debug-doxygen-translator - Display doxygen translator module debugging information\n\ -extranative - Return extra native C++ wraps for std containers when possible \n\ -fastinit - Use fast init mechanism for classes (default)\n\ -fastunpack - Use fast unpack mechanism to parse the argument functions \n\ @@ -332,6 +334,9 @@ public: SWIG_library_directory("python"); + bool debug_doxygen_parser = false; + bool debug_doxygen_translator = false; + for (int i = 1; i < argc; i++) { if (argv[i]) { if (strcmp(argv[i], "-interface") == 0) { @@ -430,6 +435,12 @@ public: doxygen = 0; scan_doxygen_comments = 0; Swig_mark_arg(i); + } else if (strcmp(argv[i], "-debug-doxygen-translator") == 0) { + debug_doxygen_translator = true; + Swig_mark_arg(i); + } else if (strcmp(argv[i], "-debug-doxygen-parser") == 0) { + debug_doxygen_parser = true; + Swig_mark_arg(i); } else if (strcmp(argv[i], "-fastunpack") == 0) { fastunpack = 1; Swig_mark_arg(i); @@ -549,7 +560,7 @@ public: } if (doxygen) - doxygenTranslator = new PyDocConverter; + doxygenTranslator = new PyDocConverter(debug_doxygen_translator, debug_doxygen_parser); if (!global_name) global_name = NewString("cvar"); From 8260f4219f39abef61808211206db54b739664d4 Mon Sep 17 00:00:00 2001 From: Dmitry Kabak Date: Sun, 29 Jul 2012 22:26:31 +0000 Subject: [PATCH 107/314] Expanded the Doxygen docs git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2012-doxygen@13428 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Doc/Devel/plan-gsoc-2012.txt | 4 +- Doc/Manual/Contents.html | 32 +- Doc/Manual/Doxygen.html | 554 ++++++++++++++++++++++++++++++----- 3 files changed, 489 insertions(+), 101 deletions(-) diff --git a/Doc/Devel/plan-gsoc-2012.txt b/Doc/Devel/plan-gsoc-2012.txt index 6f012cd4b..a3bf2ca39 100644 --- a/Doc/Devel/plan-gsoc-2012.txt +++ b/Doc/Devel/plan-gsoc-2012.txt @@ -320,8 +320,8 @@ Documentation ============= SWIG documentation will contain: -- command line options -- list of implemented features (types and placements of comments) +-OK- command line options +-OK- list of implemented features (types and placements of comments) - list of unimplemented features (types and placements of comments) - list of tags and their translations (all Doxygen tags). diff --git a/Doc/Manual/Contents.html b/Doc/Manual/Contents.html index 7a05527c6..77518c268 100644 --- a/Doc/Manual/Contents.html +++ b/Doc/Manual/Contents.html @@ -524,32 +524,6 @@ -

      16 Using SWIG with ccache - ccache-swig(1) manpage

      - - - - -

      17 SWIG and Allegro Common Lisp

      @@ -1717,7 +1691,7 @@ -

      35 SWIG and Doxgeyn Translation

      +

      39 SWIG and Doxygen Translation

    • Developer Information
    • Extending to Other Languages
    diff --git a/Doc/Manual/Doxygen.html b/Doc/Manual/Doxygen.html index d0e837756..54fa1b6bf 100644 --- a/Doc/Manual/Doxygen.html +++ b/Doc/Manual/Doxygen.html @@ -5,7 +5,7 @@ -

    35 SWIG and Doxygen Translation

    +

    39 SWIG and Doxygen Translation

    @@ -39,7 +39,7 @@ This chapter describes SWIG's support for translating Doxygen comments found in Currently only JavaDoc and PythonDoc is supported.

    -

    35.1 Doxygen Translation Overview

    +

    39.1 Doxygen Translation Overview

    @@ -53,7 +53,7 @@ Questions about running SWIG are best answered in the S The behaviour of this functionality is wildly unpredictable if the interface file is not proper to begin with!

    -

    35.2 Preparations

    +

    39.2 Preparations

    @@ -61,6 +61,7 @@ To make use of the comment translation system, your documentation comments must It is advised that you are certain your comments compile properly with Doxygen before you try to translate them. Doxygen itself is a deeper tool and can provide you better feedback for correcting any syntax errors that may be present. Please look at Doxygen's Documenting the code for proper specificatons for comment format. +However, SWIG's Doxygen parser will still point you most of errors and warnings found in comments (like unterminated strings or missing ending tags).

    @@ -71,17 +72,63 @@ Please look at Doxygen's  Documenting the code)
    +Here they are:
    +
    +/**
    + * JavaDoc style comment, multiline
    + */
    +/*!
    + * QT-style comment, multiline
    + */
    +/**
    + Any of the above, but without intermediate *'s
    + */
    +/// Single-line comment
    +//! Another single-line comment
    +
    +

    + +

    +Also any of the above with '<' added after comment-starting symbol, like /**<, /*!<, ///<, or //!< +will be treated as post-comment and will be assigned to the node before the comment. +
    +Any number of '*' or '/' in doxygen comment is considered to be a separator and is not included in final comment, so you may safely use +comments like /*********/ or //////////. +

    +

    Please note, as SWIG parses input file by itself with strict grammar, there is only a limited support for various cases of comment placement in the file. -Comments can be placed between two C expressions on separate lines: +
    +Comments can be placed before C\C++ expressions on separate lines:

    +/**
    + * Some comment
    + */
     void someOtherFunction();
     /**
      * Some comment
      */
     void someFunction();
    +
    +class Shape {
    +  /*
    +   * Calculate the area in cm^2
    +   */
    +  int getArea();
    +}
    +
    + +

    +After C\C++ expressions at the end of the line: +

    + +
    +int someVariable = 9; ///< This is a var holding magic number 9
    +void doNothing(); ///< This does nothing, nop
     

    @@ -109,38 +156,37 @@ enum E_NUMBERS

    Just remember, if SWIG shows syntax error parsing the file because of your comment, try to move it in some other, 'safer' place as desribed above. +
    +Also, currently only the comments directly before or after the nodes are supported. Doxygen structural comments are stripped out and not assigned to anything.

    -

    35.2.1 Enabling Doxygen Translation

    +

    39.2.1 Enabling Doxygen Translation

    -There are switches like '-doxygen' and '-nodoxygen' in every module that supports converting -documentation comments. The first one is default, so that swig by default produces correct -proxy files with comments. Some comments in some target languages can be manually overriden by specific +There is a switch '-doxygen' in every module that supports converting +documentation comments. Some comments in some target languages can be manually overriden by specific swig's features, like feature:docstring or feature:autodoc, in this cases doxygen comments have lowest priority.

    -Switching off may be needed if swig cannot correctly parse your comments, for example showing Error: -Syntax error in input(1). message. Then it will just strip out every comment out of the code and -continue happily. +If doxygen parsing is switched off, then all the comments are stripped out in parser and all the resources used by comment parser and translator are freed.

    -

    35.2.2 Additional Commandline Options

    +

    39.2.2 Additional Commandline Options

    ALSO TO BE ADDED (JavaDoc Autobrief?)

    -

    35.3 Doxygen To JavaDoc

    +

    39.3 Doxygen To JavaDoc

    If translation is enabled, JavaDoc formatted comments should be automatically placed in the correct locations in the resulting module and proxy files.

    -

    35.3.1 Basic Example

    +

    39.3.1 Basic Example

    @@ -224,80 +270,436 @@ When the Doxygen Translator Module encounters a comment it finds nothing useful

    -

    35.3.2 JavaDoc Tags

    +

    39.3.2 JavaDoc Tags

    + + +

    +Here is the list of all doxygen tags and the description of how they are translated to JavaDoc +
    +Doxygen tags: +

    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    \awraped with <i> html tag
    \argwrapped with <li> html tag
    \authortranslated to @author
    \authorstranslated to @author
    \bwrapped with <b> html tag
    \cwrapped with <code> html tag
    \citewrapped with <i> html tag
    \codetranslated to {@code ...}
    \condtranslated to 'Conditional comment: <condition>'
    \copyrightreplaced with 'Copyrigth:'
    \deprecatedtranslated to @deprecated
    \ewraped with <i> html tag
    \elsereplaced with '}Else:{'
    \elseifreplaced with '}Else if: <condition>{'
    \emwraped with <i> html tag
    \endcodesee note for \code
    \endcondreplaced with 'End of conditional comment.'
    \endifreplaced with '}'
    \endlinksee note for \link
    \endverbatimsee note for \verbatim
    \exceptiontranslated to @exception
    \ifreplaced with 'If: <condition> {'
    \ifnotreplaced with 'If not: <condition> {'
    \imagetranslated to <img/> html tag only if target=HTML
    \liwraped with <li> html tag
    \linktranslated to {@link ...}
    \nreplaced with new line char
    \notereplaced with 'Note:'
    \overloadprints 'This is an overloaded ...' according to Doxygen docs
    \pwraped with <code> html tag
    \parreplaced with <p alt='title'>...</p>
    \paramtranslated to @param
    \remarkreplaced with 'Remarks:'
    \remarksreplaced with 'Remarks:'
    \resulttranslated to @return
    \returntranslated to @return
    \returnstranslated to @return
    \satranslated to @see
    \seetranslated to @see
    \sincetranslated to @since
    \throwtranslated to @throws
    \throwstranslated to @thtows
    \todoreplaced with 'TODO:'
    \tparamtranslated to @param
    \verbatimtranslated to {@literal ...}
    \versiontranslated to @version
    \warningtranslated to 'Warning:'
    \$prints $ char
    \@prints @ char
    \\prints \ char
    \&prints & char
    \~prints ~ char
    \<prints < char
    \>prints > char
    \#prints # char
    \%prints % char
    \"prints " char
    \.prints . char
    \::prints ::
    +
    + +

    39.3.3 Unsupported tags

    Doxygen has a wealth of tags such as @latexonly that have no equivalent in JavaDoc. -As a result several tags that have no translation (or particular use, such as some linking and section tags) are supressed. +As a result several tags that have no translation (or particular use, such as some linking and section tags) are supressed with their content just printed out (if it has any sense, typically text content). If you are interested in more of the specifics of JavaDoc, please visit How to Write Doc Comments for the Javadoc Tool. -

    - -

    -Doxygen and JavaDoc Equivalent Tags +
    +Here is the list of these tags:

    -* @param      
    -* @return      
    -* @exception   
    -* @author      
    -* @version     
    -* @see         
    -* @since       
    -* @serial      
    -* @deprecated  
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    \addindex\addtogroup\anchor\attention
    \brief\bug\callgraph\callergraph
    \class\copybrief\copydetails\copydoc
    \date\def\defgroup\details
    \dir\dontinclude\dot\dotfile
    \enddot\endhtmlonly\endinternal\endlatexonly
    \endmanonly\endmsc\endrtfonly\endxmlonly
    \enum\example\extends\f$
    \f[\f]\f{\f}
    \file\fn\headerfile\hideinitializer
    \htmlinclude\htmlonly\implements\include
    \includelineno\ingroup\internal\invariant
    \interface\latexonly\line\mainpage
    \manonly\memberof\msc\mscfile
    \name\namespace\nosubgrouping\package
    \page\paragraph\post\pre
    \private\privatesection\property\protected
    \protectedsection\protocol\public\publicsection
    \ref\related\relates\relatedalso
    \relatesalso\retval\rtfonly\section
    \short\showinitializer\skip\skipline
    \snippet\struct\subpage\subsection
    \subsubsection\tableofcontents\test\typedef
    \union\until\var\verbinclude
    \weakgroup\xmlonly\xrefitem\category
    -

    35.3.3 Other Tags

    - - -

    -Because there are no specific JavaDoc tags for some important information, some tags are given plain English descriptions of their presence, such as @bug. -This is a feature currently still being developed and it is likely that more information from the original Doxygen Comments will be reproduced as this module matures. -

    -

    35.3.4 Bad Behaviour

    - - -

    -There are some tags that the Doxygen Translator Module currently does not expect to encounter. -This includes the PHP-only Doxygen commands such as @publicsection: -

    - -

    - Completely Unsupported Tags -

    -
    -"annotatedclasslist", "classhierarchy", "define", "functionindex", 
    -"header", "headerfilelist", "inherit", "l", "postheader", "private",
    - "privatesection", "protected", "protectedsection", "public", "publicsection"
    -
    - -

    -The parsing behaviour will be unpredictable if any of these are encountered for now. -This should eventually be changed so that they are simply ignored. -

    -

    -In general parsing errors should not interfere with the operation of SWIG itself. -Blank comments or lack of comments could be an indication of either a parsing error or a lack of meaningful tags in a specific blob of doxygen. -

    - - -

    35.3.5 Further Details

    +

    39.3.4 Further Details

    TO BE ADDED.

    - -

    35.4 Developer Information

    +

    39.4 Developer Information

    Currently a good deal of this Module still needs some reworking, particularly on the side of the parser and JavaDoc producer.

    -

    35.4.1 Module Design

    +

    39.4.1 Module Design

    @@ -320,7 +722,19 @@ This module builds its own private parse tree and hands it to a separate class f For example, JavaDocConverter is the JavaDoc module class.

    -

    35.5 Extending to Other Languages

    +

    39.4.2 Debugging commands

    + + +

    +There are two handy command line switches, that enable lots of detailed debug information printing. +

    + +
    +  -debug-doxygen-parser     - Display doxygen parser module debugging information
    +  -debug-doxygen-translator - Display doxygen translator module debugging information
    +
    + +

    39.5 Extending to Other Languages

    From 64b5efc5d7d69b36a3c3b1d448edfa702e43cad1 Mon Sep 17 00:00:00 2001 From: Dmitry Kabak Date: Mon, 30 Jul 2012 08:07:15 +0000 Subject: [PATCH 108/314] Updated documentation, added description of PyDoc tags git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2012-doxygen@13429 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Doc/Devel/plan-gsoc-2012.txt | 4 +- Doc/Manual/Contents.html | 7 + Doc/Manual/Doxygen.html | 532 +++++++++++++++++++++++++++++++++-- 3 files changed, 519 insertions(+), 24 deletions(-) diff --git a/Doc/Devel/plan-gsoc-2012.txt b/Doc/Devel/plan-gsoc-2012.txt index a3bf2ca39..43fc1adc3 100644 --- a/Doc/Devel/plan-gsoc-2012.txt +++ b/Doc/Devel/plan-gsoc-2012.txt @@ -322,6 +322,6 @@ Documentation SWIG documentation will contain: -OK- command line options -OK- list of implemented features (types and placements of comments) -- list of unimplemented features (types and placements of comments) -- list of tags and their translations (all Doxygen tags). +-OK- list of unimplemented features (types and placements of comments) +-OK- list of tags and their translations (all Doxygen tags). diff --git a/Doc/Manual/Contents.html b/Doc/Manual/Contents.html index 77518c268..ca66d87cc 100644 --- a/Doc/Manual/Contents.html +++ b/Doc/Manual/Contents.html @@ -1709,6 +1709,13 @@

  • Unsupported tags
  • Further Details +
  • Doxygen To PythonDoc +
  • Developer Information
    • Module Design diff --git a/Doc/Manual/Doxygen.html b/Doc/Manual/Doxygen.html index 54fa1b6bf..77c00b40e 100644 --- a/Doc/Manual/Doxygen.html +++ b/Doc/Manual/Doxygen.html @@ -22,6 +22,13 @@
    • Unsupported tags
    • Further Details
    +
  • Doxygen To PythonDoc +
  • Developer Information
    • Module Design @@ -220,9 +227,9 @@ Simply running SWIG should result in the following code being present in Shapes.
       
       /**
      - * This is describing class Shape  
      + * This is describing class Shape 
      + * @author Bob 
        * 
      - * @author	Bob  
        */
       
       public class Shape {
      @@ -230,35 +237,40 @@ public class Shape {
       ...
       
       /**
      - * Important Variables  
      - * 
      + * Important Variables 
        */
         public void setX(double value) {
      -    exampleJNI.Shape_x_set(swigCPtr, this, value);
      +    ShapesJNI.Shape_x_set(swigCPtr, this, value);
         }
       
       /**
      - * Important variables  
      + * Important Variables 
        */
         public double getX() {
      -    return exampleJNI.Shape_x_get(swigCPtr, this);
      +    return ShapesJNI.Shape_x_get(swigCPtr, this);
         }
       
      -...
      +/**
      + * Moves the Shape 
      + */
      +  public void move(double dx, double dy) {
      +    ShapesJNI.Shape_move(swigCPtr, this, dx, dy);
      +  }
       
       /**
      - * @return	the area  
      + * @return the area 
        */
         public double area() {
      -    return exampleJNI.Shape_area(swigCPtr, this);
      +    return ShapesJNI.Shape_area(swigCPtr, this);
         }
       
       /**
      - * @return	the perimeter  
      + * @return the perimeter 
        */
         public double perimeter() {
      -    return exampleJNI.Shape_perimeter(swigCPtr, this);
      +    return ShapesJNI.Shape_perimeter(swigCPtr, this);
         }
      +}
       
       
      @@ -282,7 +294,7 @@ Here is the list of all doxygen tags and the description of how they are transla - + @@ -327,7 +339,7 @@ Here is the list of all doxygen tags and the description of how they are transla - + @@ -339,7 +351,7 @@ Here is the list of all doxygen tags and the description of how they are transla - + @@ -379,7 +391,7 @@ Here is the list of all doxygen tags and the description of how they are transla - + @@ -399,7 +411,7 @@ Here is the list of all doxygen tags and the description of how they are transla - + @@ -692,14 +704,490 @@ Here is the list of these tags: TO BE ADDED.

      -

      39.4 Developer Information

      +

      39.4 Doxygen To PythonDoc

      -Currently a good deal of this Module still needs some reworking, particularly on the side of the parser and JavaDoc producer. +If translation is enabled, PyDoc formatted comments should be automatically placed in the correct locations in the resulting module and proxy files. +The problem is that PyDoc has no tag mechanism like Doxygen or JavaDoc, so most of Doxygen commands are translated as English plaintext pieces.

      -

      39.4.1 Module Design

      +

      39.4.1 Basic Example

      + + +

      +Here is an example segment from an included header file +

      +
      +/*! This is describing class Shape
      + \author Bob
      + */
      +
      +class Shape {
      +public:
      +  Shape() {
      +    nshapes++;
      +  }
      +  virtual ~Shape() {
      +    nshapes--;
      +  };
      +  double  x, y; /*!< Important Variables */
      +  void    move(double dx, double dy); /*!< Moves the Shape */
      +  virtual double area(void) = 0; /*!< \return the area */
      +  virtual double perimeter(void) = 0; /*!< \return the perimeter */
      +  static  int nshapes;
      +};
      +
      + +

      +Simply running SWIG should result in the following code being present in Shapes.py +

      + +
      +
      +...
      +
      +class Shape(_object):
      +    """
      +    This is describing class Shape 
      +    Authors:
      +    Bob 
      +
      +    """
      +    
      +    ...
      +    
      +    def move(self, *args):
      +        """
      +        Moves the Shape 
      +        """
      +        return _Shapes.Shape_move(self, *args)
      +
      +    def area(self):
      +        """
      +        Return:
      +        the area 
      +        """
      +        return _Shapes.Shape_area(self)
      +
      +    def perimeter(self):
      +        """
      +        Return:
      +        the perimeter 
      +        """
      +        return _Shapes.Shape_perimeter(self)
      +
      + +

      +Currently Doxygen comments assigned to vars are not present in proxy file, so they have no comment translated for them. +

      + +

      39.4.2 PyDoc translator

      + + +

      +Here is the list of all doxygen tags and the description of how they are translated to PyDoc +
      +Doxygen tags: +

      +
      +
      \awraped with <i> html tagwrapped with <i> html tag
      \arg
      \ewraped with <i> html tagwrapped with <i> html tag
      \else
      \emwraped with <i> html tagwrapped with <i> html tag
      \endcode
      \liwraped with <li> html tagwrapped with <li> html tag
      \link
      \pwraped with <code> html tagwrapped with <code> html tag
      \par
      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      \awrapped with '_'
      \argprepended with ' --'
      \authorprints 'Author:'
      \authorsprints 'Author:'
      \bwrapped with '__'
      \citewrapped with single quotes
      \condtranslated to 'Conditional comment: <condition>'
      \copyrightprints'Copyrigth:'
      \deprecatedprints 'Deprecated:'
      \ewrapped with '_'
      \elsereplaced with '}Else:{'
      \elseifreplaced with '}Else if: <condition>{'
      \emwrapped with '_'
      \endcondreplaced with 'End of conditional comment.'
      \endifreplaced with '}'
      \exceptionreplaced with 'Throws:'
      \ifreplaced with 'If: <condition> {'
      \ifnotreplaced with 'If not: <condition> {'
      \liprepended with ' --'
      \nreplaced with new line char
      \notereplaced with 'Note:'
      \overloadprints 'This is an overloaded ...' according to Doxygen docs
      \parreplaced with 'Title: ...'
      \paramtranslated to 'Arguments:\n param(type) --description'
      \remarkreplaced with 'Remarks:'
      \remarksreplaced with 'Remarks:'
      \resultreplaced with 'Result:'
      \returnreplaced with 'Result:'
      \returnsreplaced with 'Result:'
      \sareplaced with 'See also:'
      \seereplaced with 'See also:'
      \sincereplaced with 'Since:'
      \throwreplaced with 'Throws:'
      \throwsreplaced wih 'Throws:'
      \todoreplaced with 'TODO:'
      \tparamtranslated to 'Arguments:\n param(type) --description'
      \versionreplaced with 'Version:'
      \warningtranslated to 'Warning:'
      \$prints $ char
      \@prints @ char
      \\prints \ char
      \&prints & char
      \~prints ~ char
      \<prints < char
      \>prints > char
      \#prints # char
      \%prints % char
      \"prints " char
      \.prints . char
      \::prints ::
      +
  • + +

    39.4.3 Unsupported tags

    + + +

    +Doxygen has a wealth of tags such as @latexonly that have no equivalent in PyDoc. +As a result several tags that have no translation (or particular use, such as some linking and section tags) are supressed with their content just printed out (if it has any sense, typically text content). +
    +Here is the list of these tags: +

    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    \addindex\addtogroup\anchor\attention
    \brief\bug\callgraph\callergraph
    \class\copybrief\copydetails\copydoc
    \date\def\defgroup\details
    \dir\dontinclude\dot\dotfile
    \code\endcode\endverbatim\endlink
    \enddot\endhtmlonly\endinternal\endlatexonly
    \endmanonly\endmsc\endrtfonly\endxmlonly
    \enum\example\extends\f$
    \f[\f]\f{\f}
    \file\fn\headerfile\hideinitializer
    \htmlinclude\htmlonly\implements\include
    \image\link\verbatim\p
    \includelineno\ingroup\internal\invariant
    \interface\latexonly\line\mainpage
    \manonly\memberof\msc\mscfile
    \name\namespace\nosubgrouping\package
    \page\paragraph\post\pre
    \private\privatesection\property\protected
    \protectedsection\protocol\public\publicsection
    \ref\related\relates\relatedalso
    \relatesalso\retval\rtfonly\section
    \short\showinitializer\skip\skipline
    \snippet\struct\subpage\subsection
    \subsubsection\tableofcontents\test\typedef
    \union\until\var\verbinclude
    \weakgroup\xmlonly\xrefitem\category
    \c
    +
    + +

    39.4.4 Further Details

    + + +

    +TO BE ADDED. +

    + +

    39.5 Developer Information

    + + +

    +

    + +

    39.5.1 Module Design

    @@ -722,7 +1210,7 @@ This module builds its own private parse tree and hands it to a separate class f For example, JavaDocConverter is the JavaDoc module class.

    -

    39.4.2 Debugging commands

    +

    39.5.2 Debugging commands

    @@ -734,7 +1222,7 @@ There are two handy command line switches, that enable lots of detailed debug in -debug-doxygen-translator - Display doxygen translator module debugging information

    -

    39.5 Extending to Other Languages

    +

    39.6 Extending to Other Languages

    From e764c9a73e738aabe0a0a8dbd3cdc5b357de636e Mon Sep 17 00:00:00 2001 From: Dmitry Kabak Date: Mon, 30 Jul 2012 08:09:14 +0000 Subject: [PATCH 109/314] Made JavaDoc output nicer git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2012-doxygen@13430 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Source/DoxygenTranslator/src/JavaDocConverter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/DoxygenTranslator/src/JavaDocConverter.cpp b/Source/DoxygenTranslator/src/JavaDocConverter.cpp index 165075708..0856eabf1 100644 --- a/Source/DoxygenTranslator/src/JavaDocConverter.cpp +++ b/Source/DoxygenTranslator/src/JavaDocConverter.cpp @@ -276,7 +276,7 @@ String *JavaDocConverter::makeDocumentation(Node *node) { printTree(entityList); } - std::string javaDocString = "/**"; + std::string javaDocString = "/**\n * "; for (std::list < DoxygenEntity >::iterator entityIterator = entityList.begin(); entityIterator != entityList.end();) { translateEntity(*entityIterator, javaDocString); From fb3ee4fb78dd3be28fdd8308af33ae5818e031b6 Mon Sep 17 00:00:00 2001 From: Dmitry Kabak Date: Thu, 2 Aug 2012 10:31:02 +0000 Subject: [PATCH 110/314] Implemented support for default args - overloaded functions, optional feature 1 in my project plan. Extended testcase. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2012-doxygen@13483 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Examples/test-suite/doxygen_basic_translate.i | 1 + .../java/doxygen_basic_translate_runme.java | 5 +++ .../python/doxygen_basic_translate_runme.py | 4 +- Source/CParse/parser.y | 15 +++++-- .../src/JavaDocConverter.cpp | 44 ++++++++++++++++--- .../DoxygenTranslator/src/JavaDocConverter.h | 7 +++ 6 files changed, 66 insertions(+), 10 deletions(-) diff --git a/Examples/test-suite/doxygen_basic_translate.i b/Examples/test-suite/doxygen_basic_translate.i index c06cbddc9..9cef037b1 100644 --- a/Examples/test-suite/doxygen_basic_translate.i +++ b/Examples/test-suite/doxygen_basic_translate.i @@ -61,6 +61,7 @@ int function4() /** * Test for default args + * @param a Some parameter, default is 42 */ int function5(int a=42) { diff --git a/Examples/test-suite/java/doxygen_basic_translate_runme.java b/Examples/test-suite/java/doxygen_basic_translate_runme.java index 50d6cedda..4e95b73a7 100644 --- a/Examples/test-suite/java/doxygen_basic_translate_runme.java +++ b/Examples/test-suite/java/doxygen_basic_translate_runme.java @@ -63,6 +63,11 @@ public class doxygen_basic_translate_runme { " \n" + ""); wantedComments.put("doxygen_basic_translate.doxygen_basic_translate.function5(int)", + " Test for default args \n" + + " @param a Some parameter, default is 42" + + " \n" + + ""); + wantedComments.put("doxygen_basic_translate.doxygen_basic_translate.function5()", " Test for default args \n" + " \n" + ""); diff --git a/Examples/test-suite/python/doxygen_basic_translate_runme.py b/Examples/test-suite/python/doxygen_basic_translate_runme.py index 95596c1f3..a952df8b0 100644 --- a/Examples/test-suite/python/doxygen_basic_translate_runme.py +++ b/Examples/test-suite/python/doxygen_basic_translate_runme.py @@ -58,5 +58,7 @@ check(doxygen_basic_translate.function4.__doc__, '' ' }' ) check(doxygen_basic_translate.function5.__doc__, '' -' Test for default args' +' Test for default args \n' +' Arguments: \n' +' a (int) -- Some parameter, default is 42\n' ) \ No newline at end of file diff --git a/Source/CParse/parser.y b/Source/CParse/parser.y index 6aed8c3f9..e331752bf 100644 --- a/Source/CParse/parser.y +++ b/Source/CParse/parser.y @@ -190,6 +190,7 @@ static Node *copy_node(Node *n) { } static void set_comment(Node *n, String *comment) { + String *name; Parm *p; if (!n || !comment) return; @@ -206,6 +207,16 @@ static void set_comment(Node *n, String *comment) { p=nextSibling(p); } } + + /* Append same comment to every generated overload */ + name = Getattr(n, "name"); + if (!name) + return; + n = nextSibling(n); + while (n && Getattr(n, "name") && Strcmp(Getattr(n, "name"), name) == 0) { + Setattr(n, "DoxygenComment", comment); + n = nextSibling(n); + } } /* ----------------------------------------------------------------------------- @@ -1586,10 +1597,6 @@ static void default_arguments(Node *n) { if (throws) Setattr(new_function,"throws",pl); Delete(pl); } - - /* copy doxygen comments if found */ - if(Getattr(function,"DoxygenComment")) - Setattr(new_function,"DoxygenComment",Getattr(function,"DoxygenComment")); /* copy specific attributes for global (or in a namespace) template functions - these are not templated class methods */ if (strcmp(cntype,"template") == 0) { diff --git a/Source/DoxygenTranslator/src/JavaDocConverter.cpp b/Source/DoxygenTranslator/src/JavaDocConverter.cpp index 0856eabf1..421134828 100644 --- a/Source/DoxygenTranslator/src/JavaDocConverter.cpp +++ b/Source/DoxygenTranslator/src/JavaDocConverter.cpp @@ -66,8 +66,8 @@ void JavaDocConverter::fillStaticTables() { tagHandlers["deprecated"] = make_pair(&JavaDocConverter::handleTagSame, ""); tagHandlers["exception"] = make_pair(&JavaDocConverter::handleTagSame, ""); tagHandlers["package"] = make_pair(&JavaDocConverter::handleTagSame, ""); - tagHandlers["param"] = make_pair(&JavaDocConverter::handleTagSame, ""); - tagHandlers["tparam"] = make_pair(&JavaDocConverter::handleTagSame, "param"); + tagHandlers["param"] = make_pair(&JavaDocConverter::handleTagParam, ""); + tagHandlers["tparam"] = make_pair(&JavaDocConverter::handleTagParam, ""); tagHandlers["result"] = make_pair(&JavaDocConverter::handleTagSame, "return"); tagHandlers["return"] = make_pair(&JavaDocConverter::handleTagSame, ""); tagHandlers["returns"] = make_pair(&JavaDocConverter::handleTagSame, "return"); @@ -151,6 +151,23 @@ std::string JavaDocConverter::formatCommand(std::string unformattedLine, int ind return formattedLines; } +bool JavaDocConverter::paramExists(std::string param) { + ParmList *plist = CopyParmList(Getattr(currentNode, "parms")); + Parm *p = NULL; + for (p = plist; p;) { + if (Char(Getattr(p, "name")) == param) + return true; + /* + * doesn't seem to work always: in some cases (especially for 'self' parameters) + * tmap:in is present, but tmap:in:next is not and so this code skips all the parameters + */ + //p = Getattr(p, "tmap:in") ? Getattr(p, "tmap:in:next") : nextSibling(p); + p = nextSibling(p); + } + Delete(plist); + return false; +} + std::string JavaDocConverter::translateSubtree(DoxygenEntity & doxygenEntity) { std::string translatedComment; @@ -250,12 +267,26 @@ void JavaDocConverter::handleTagImage(DoxygenEntity& tag, std::string& translate void JavaDocConverter::handleTagPar(DoxygenEntity& tag, std::string& translatedComment, std::string&) { std::string dummy; translatedComment += "data + "\""; - translatedComment += ">"; + translatedComment += ">"; + tag.entityList.pop_front(); + handleParagraph(tag, translatedComment, dummy); + } + translatedComment += "

    "; +} + +void JavaDocConverter::handleTagParam(DoxygenEntity& tag, std::string& translatedComment, std::string&) { + std::string dummy; + if (!tag.entityList.size()) + return; + if (!paramExists(tag.entityList.begin()->data)) + return; + + translatedComment += "@param "; + translatedComment += tag.entityList.begin()->data + " "; tag.entityList.pop_front(); handleParagraph(tag, translatedComment, dummy); - translatedComment += "

    "; } String *JavaDocConverter::makeDocumentation(Node *node) { @@ -278,6 +309,9 @@ String *JavaDocConverter::makeDocumentation(Node *node) { std::string javaDocString = "/**\n * "; + // store the current node + // (currently just to handle params) + currentNode = node; for (std::list < DoxygenEntity >::iterator entityIterator = entityList.begin(); entityIterator != entityList.end();) { translateEntity(*entityIterator, javaDocString); entityIterator++; diff --git a/Source/DoxygenTranslator/src/JavaDocConverter.h b/Source/DoxygenTranslator/src/JavaDocConverter.h index 1d51a8d7b..f68a712b9 100644 --- a/Source/DoxygenTranslator/src/JavaDocConverter.h +++ b/Source/DoxygenTranslator/src/JavaDocConverter.h @@ -85,12 +85,19 @@ protected: * Insert

    ...

    */ void handleTagPar(DoxygenEntity &tag, std::string &translatedComment, std::string &arg); + /* + * Insert @param command, if it is really a function param + */ + void handleTagParam(DoxygenEntity &tag, std::string &translatedComment, std::string &arg); private: + Node *currentNode; // this contains the handler pointer and one string argument static std::map > tagHandlers; void fillStaticTables(); + + bool paramExists(std::string param); }; #endif From c72a56c6f1d5f1366e09bd99e8bef5b31b0c9598 Mon Sep 17 00:00:00 2001 From: Dmitry Kabak Date: Thu, 2 Aug 2012 12:22:26 +0000 Subject: [PATCH 111/314] Small fix to display params type correctly in PyDocConverter git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2012-doxygen@13484 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Source/DoxygenTranslator/src/PyDocConverter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/DoxygenTranslator/src/PyDocConverter.cpp b/Source/DoxygenTranslator/src/PyDocConverter.cpp index a873cfb16..df9466067 100644 --- a/Source/DoxygenTranslator/src/PyDocConverter.cpp +++ b/Source/DoxygenTranslator/src/PyDocConverter.cpp @@ -101,7 +101,7 @@ std::string PyDocConverter::getParamType(std::string param) { Parm *p = NULL; for (p = plist; p;) { if (Char(Getattr(p, "name")) == param) { - std::string type = Char(Swig_name_make(currentNode, 0, Getattr(p, "type"), 0, 0)); + std::string type = Char(SwigType_str(Getattr(p, "type"), "")); return type; } /* From 174e20318038b2311051938a88fa0233f744e50c Mon Sep 17 00:00:00 2001 From: Marko Klopcic Date: Thu, 2 Aug 2012 20:48:28 +0000 Subject: [PATCH 112/314] Fixed problem with doxygen comments at the end of a file or in a file without declarations. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2012-doxygen@13485 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Examples/test-suite/doxygen_basic_translate.h | 5 +++++ Examples/test-suite/doxygen_basic_translate.i | 13 ++++++++++++- Source/CParse/parser.y | 19 ++++++++++++------- 3 files changed, 29 insertions(+), 8 deletions(-) create mode 100644 Examples/test-suite/doxygen_basic_translate.h diff --git a/Examples/test-suite/doxygen_basic_translate.h b/Examples/test-suite/doxygen_basic_translate.h new file mode 100644 index 000000000..7b2b3f58a --- /dev/null +++ b/Examples/test-suite/doxygen_basic_translate.h @@ -0,0 +1,5 @@ + +/** + * This file contains only doxygen comment without a declaration - + * it should be ignored by SWIG and must not trigger syntax error. + */ diff --git a/Examples/test-suite/doxygen_basic_translate.i b/Examples/test-suite/doxygen_basic_translate.i index 9cef037b1..11c6a75ac 100644 --- a/Examples/test-suite/doxygen_basic_translate.i +++ b/Examples/test-suite/doxygen_basic_translate.i @@ -1,5 +1,7 @@ %module doxygen_basic_translate +%include "doxygen_basic_translate.h" + %inline %{ /** @@ -59,12 +61,21 @@ int function4() { } + +int function5(int a) +{ +} +/**< This is a post comment. */ + /** * Test for default args * @param a Some parameter, default is 42 */ -int function5(int a=42) +int function6(int a=42) { } +/** + * Comment at the end of file should be ignored. + */ %} diff --git a/Source/CParse/parser.y b/Source/CParse/parser.y index e331752bf..41c94a5f3 100644 --- a/Source/CParse/parser.y +++ b/Source/CParse/parser.y @@ -66,7 +66,7 @@ static Node **class_decl = NULL; * ----------------------------------------------------------------------------- */ String *currentComment; /* Location of the stored Doxygen Comment */ String *currentPostComment; /* Location of the stored Doxygen Post-Comment */ -String *currentCComment; /* Location of the stored C Comment */ +static String *currentDeclComment = NULL; /* Comment of C/C++ declaration. */ static Node *previousNode = NULL; /* Pointer to the previous node (for post comments) */ static Node *currentNode = NULL; /* Pointer to the current node (for post comments) */ @@ -1852,17 +1852,22 @@ program : interface { interface : interface declaration { /* add declaration to end of linked list (the declaration isn't always a single declaration, sometimes it is a linked list itself) */ + if (currentDeclComment != NULL) { + set_comment($2, currentDeclComment); + currentDeclComment = NULL; + } appendChild($1,$2); $$ = $1; } - | interface doxygen_comment declaration { - set_comment($3, $2); - appendChild($1, $3); + | interface doxygen_comment { + currentDeclComment = $2; $$ = $1; } - | interface declaration doxygen_post_comment { - set_comment($2, $3); - appendChild($1, $2); + | interface doxygen_post_comment { + Node *node = lastChild($1); + if (node) { + set_comment(node, $2); + } $$ = $1; } | empty { From 1881130f10cf70b6a0c398cd8c9ae89aa6e5e3f4 Mon Sep 17 00:00:00 2001 From: Dmitry Kabak Date: Thu, 2 Aug 2012 22:01:54 +0000 Subject: [PATCH 113/314] Fixed doxygen_basic_translate java runtime test git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2012-doxygen@13486 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- .../test-suite/java/doxygen_basic_translate_runme.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Examples/test-suite/java/doxygen_basic_translate_runme.java b/Examples/test-suite/java/doxygen_basic_translate_runme.java index 4e95b73a7..946988c57 100644 --- a/Examples/test-suite/java/doxygen_basic_translate_runme.java +++ b/Examples/test-suite/java/doxygen_basic_translate_runme.java @@ -63,14 +63,22 @@ public class doxygen_basic_translate_runme { " \n" + ""); wantedComments.put("doxygen_basic_translate.doxygen_basic_translate.function5(int)", + " This is a post comment. \n" + + ""); + wantedComments.put("doxygen_basic_translate.doxygen_basic_translate.function6(int)", " Test for default args \n" + " @param a Some parameter, default is 42" + " \n" + ""); - wantedComments.put("doxygen_basic_translate.doxygen_basic_translate.function5()", + wantedComments.put("doxygen_basic_translate.doxygen_basic_translate.function6()", " Test for default args \n" + " \n" + ""); + wantedComments.put("doxygen_basic_translate.doxygen_basic_translate.function7(doxygen_basic_translate.SWIGTYPE_p_p_p_Shape)", + " Test for a parameter with difficult type \n" + + " (mostly for python) \n" + + " @param a Very strange param \n" + + ""); wantedComments.put("doxygen_basic_translate.doxygen_basic_translate.function3(int, int)", " A test for overloaded functions \n" + " This is function two \n" + From 9d3446d8030ec226a7aa1e43daae13d0f1a8143b Mon Sep 17 00:00:00 2001 From: Dmitry Kabak Date: Fri, 3 Aug 2012 18:44:47 +0000 Subject: [PATCH 114/314] Fixed critical bug with doxygen comments, containing % symbol git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2012-doxygen@13487 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Source/Modules/java.cxx | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Source/Modules/java.cxx b/Source/Modules/java.cxx index c7174d0fc..3591b7363 100644 --- a/Source/Modules/java.cxx +++ b/Source/Modules/java.cxx @@ -566,7 +566,7 @@ public: String *doxygen_comments=doxygenTranslator->getDocumentation(n); if(comment_creation_chatter) Printf(f_module, "/* This was generated from top() */"); - Printf(f_module, Char(doxygen_comments)); + Printv(f_module, Char(doxygen_comments), NIL); Delete(doxygen_comments); } if (Len(module_class_modifiers) > 0) @@ -1360,7 +1360,7 @@ public: String *doxygen_comments=doxygenTranslator->getDocumentation(n); if(comment_creation_chatter) Printf(f_enum, "/* This was generated from enumDeclaration() */"); - Printf(f_enum, Char(doxygen_comments)); + Printv(f_enum, Char(doxygen_comments), NIL); Delete(doxygen_comments); } @@ -1457,7 +1457,7 @@ public: String *doxygen_comments=doxygenTranslator->getDocumentation(n); if(comment_creation_chatter) Printf(enum_code, "/* This was generated from enumvalueDeclaration() */"); - Printf(enum_code, Char(doxygen_comments)); + Printv(enum_code, Char(doxygen_comments), NIL); Delete(doxygen_comments); } @@ -1527,7 +1527,7 @@ public: String *doxygen_comments=doxygenTranslator->getDocumentation(n); if(comment_creation_chatter) Printf(structuralComments, "/* This was generated from doxygenComment() */"); - Printf(structuralComments, Char(doxygen_comments)); + Printv(structuralComments, Char(doxygen_comments), NIL); Delete(doxygen_comments); } return SWIG_OK; @@ -1559,7 +1559,7 @@ public: String *doxygen_comments=doxygenTranslator->getDocumentation(n); if(comment_creation_chatter) Printf(constants_code, "/* This was generated from constantWrapper() */"); - Printf(constants_code, Char(doxygen_comments)); + Printv(constants_code, Char(doxygen_comments), NIL); Delete(doxygen_comments); } @@ -1855,7 +1855,7 @@ public: String *doxygen_comments=doxygenTranslator->getDocumentation(n); if(comment_creation_chatter) Printf(proxy_class_def, "/* This was generated from emitProxyClassDefAndCPPCasts() */"); - Printf(proxy_class_def, Char(doxygen_comments)); + Printv(proxy_class_def, Char(doxygen_comments), NIL); Delete(doxygen_comments); } @@ -2259,7 +2259,7 @@ public: String *doxygen_comments=doxygenTranslator->getDocumentation(n); if(comment_creation_chatter) Printf(function_code, "/* This was generated from proxyclassfunctionhandler() */"); - Printf(function_code, Char(doxygen_comments)); + Printv(function_code, Char(doxygen_comments), NIL); Delete(doxygen_comments); } @@ -2490,7 +2490,7 @@ public: String *doxygen_comments=doxygenTranslator->getDocumentation(n); if(comment_creation_chatter) Printf(function_code, "/* This was generated from constructionhandler() */"); - Printf(function_code, Char(doxygen_comments)); + Printv(function_code, Char(doxygen_comments), NIL); Delete(doxygen_comments); } From 3b280b6ffe51fed5bdbfad261b58fa369476bf77 Mon Sep 17 00:00:00 2001 From: Dmitry Kabak Date: Fri, 3 Aug 2012 19:34:56 +0000 Subject: [PATCH 115/314] Fixed doxygen_basic_translate testcase. Why do I always have the tests messed up? git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2012-doxygen@13488 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Examples/test-suite/doxygen_basic_translate.i | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Examples/test-suite/doxygen_basic_translate.i b/Examples/test-suite/doxygen_basic_translate.i index 11c6a75ac..e8c21f452 100644 --- a/Examples/test-suite/doxygen_basic_translate.i +++ b/Examples/test-suite/doxygen_basic_translate.i @@ -75,6 +75,21 @@ int function6(int a=42) { } +class Shape +{ +public: + typedef Shape* superType; +}; + +/** + * Test for a parameter with difficult type + * (mostly for python) + * @param a Very strange param + */ +void function7(Shape::superType *a[10]) +{ +} + /** * Comment at the end of file should be ignored. */ From d99fe121b8cd3fda73aa2b0822fbcdbf09b4abab Mon Sep 17 00:00:00 2001 From: Dmitry Kabak Date: Fri, 3 Aug 2012 19:43:35 +0000 Subject: [PATCH 116/314] Fixed python doxygen_basic_translate runtime test git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2012-doxygen@13489 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Examples/test-suite/python/doxygen_basic_translate_runme.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Examples/test-suite/python/doxygen_basic_translate_runme.py b/Examples/test-suite/python/doxygen_basic_translate_runme.py index a952df8b0..4698e0f6c 100644 --- a/Examples/test-suite/python/doxygen_basic_translate_runme.py +++ b/Examples/test-suite/python/doxygen_basic_translate_runme.py @@ -58,7 +58,10 @@ check(doxygen_basic_translate.function4.__doc__, '' ' }' ) check(doxygen_basic_translate.function5.__doc__, '' +' This is a post comment. \n' +) +check(doxygen_basic_translate.function6.__doc__, '' ' Test for default args \n' ' Arguments: \n' ' a (int) -- Some parameter, default is 42\n' -) \ No newline at end of file +) From 380b71eb561f7c74848e16607c21d23ce509c5af Mon Sep 17 00:00:00 2001 From: Dmitry Kabak Date: Fri, 3 Aug 2012 21:43:02 +0000 Subject: [PATCH 117/314] Implemented automatic translation of links in doxygen comments, for example @see function(std::string) -> @see function(String) in java. Also included testcase for that git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2012-doxygen@13490 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Examples/test-suite/doxygen_translate_links.i | 67 ++++++++++ .../java/doxygen_translate_links_runme.java | 68 ++++++++++ .../src/JavaDocConverter.cpp | 123 +++++++++++++++++- .../DoxygenTranslator/src/JavaDocConverter.h | 15 +++ 4 files changed, 269 insertions(+), 4 deletions(-) create mode 100644 Examples/test-suite/doxygen_translate_links.i create mode 100644 Examples/test-suite/java/doxygen_translate_links_runme.java diff --git a/Examples/test-suite/doxygen_translate_links.i b/Examples/test-suite/doxygen_translate_links.i new file mode 100644 index 000000000..5eee1d67f --- /dev/null +++ b/Examples/test-suite/doxygen_translate_links.i @@ -0,0 +1,67 @@ + + +%module doxygen_translate_links +%include "std_string.i" + +%inline %{ + +class Shape +{ +public: + typedef Shape* superType; +}; + +/** + * Testing typenames converting in \@ link + * + * \link superFunc(int,std::string) + * Test for std_string member + * \endlink + * + * \link superFunc(int,long,void*) + * Test for simple types + * \endlink + * + * \link superFunc(Shape::superType*) + * Test for custom types + * \endlink + * + * \link superFunc(int**[13]) + * Test for complex types + * \endlink + * + * same works for 'See also:' links: + * + * \sa superFunc(int,std::string) + * \sa superFunc(int,long,void*) + * \sa superFunc(Shape::superType*) + * \sa superFunc(int**[13]) + * + * some failing params: + * + * \sa superFunc() + * \sa superFunc() + * \sa superFunc() + * + */ +int function() +{ +} + +void superFunc(int, std::string) +{ +} + +void superFunc(int, long, void *) +{ +} + +void superFunc(Shape::superType *) +{ +} + +void superFunc(int **arr[13]) +{ +} + +%} diff --git a/Examples/test-suite/java/doxygen_translate_links_runme.java b/Examples/test-suite/java/doxygen_translate_links_runme.java new file mode 100644 index 000000000..080063430 --- /dev/null +++ b/Examples/test-suite/java/doxygen_translate_links_runme.java @@ -0,0 +1,68 @@ + +import doxygen_translate_links.*; +import com.sun.javadoc.*; +import java.util.HashMap; + +public class doxygen_translate_links_runme { + static { + try { + System.loadLibrary("doxygen_translate_links"); + } catch (UnsatisfiedLinkError e) { + System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e); + System.exit(1); + } + } + + public static void main(String argv[]) + { + /* + Here we are using internal javadoc tool, it accepts the name of the class as paramterer, + and calls the start() method of that class with parsed information. + */ + commentParser parser = new commentParser(); + com.sun.tools.javadoc.Main.execute("doxygen_translate_links runtime test", + "commentParser", new String[]{"-quiet", "doxygen_translate_links"}); + + HashMap wantedComments = new HashMap(); + + + wantedComments.put("doxygen_translate_links.doxygen_translate_links.function()", + " \n" + + " Testing typenames converting in @ link \n" + + " \n" + + " {@link superFunc(int,String) \n" + + " Test for std_string member \n" + + " }\n" + + " \n" + + " {@link superFunc(int,int,SWIGTYPE_p_void) \n" + + " Test for simple types \n" + + " }\n" + + " \n" + + " {@link superFunc(SWIGTYPE_p_p_Shape) \n" + + " Test for custom types \n" + + " }\n" + + " \n" + + " {@link superFunc(SWIGTYPE_p_p_p_int) \n" + + " Test for complex types \n" + + " }\n" + + " \n" + + " same works for 'See also:' links: \n" + + " \n" + + " @see superFunc(int,String)\n" + + " @see superFunc(int,int,SWIGTYPE_p_void)\n" + + " @see superFunc(SWIGTYPE_p_p_Shape)\n" + + " @see superFunc(SWIGTYPE_p_p_p_int)\n" + + " \n" + + " some failing params: \n" + + " \n" + + " @see superFunc() \n" + + " @see superFunc() \n" + + " @see superFunc() \n" + + " \n" + + " \n" + + ""); + + // and ask the parser to check comments for us + System.exit(parser.check(wantedComments)); + } +} \ No newline at end of file diff --git a/Source/DoxygenTranslator/src/JavaDocConverter.cpp b/Source/DoxygenTranslator/src/JavaDocConverter.cpp index 421134828..123eb040b 100644 --- a/Source/DoxygenTranslator/src/JavaDocConverter.cpp +++ b/Source/DoxygenTranslator/src/JavaDocConverter.cpp @@ -12,6 +12,8 @@ #include "JavaDocConverter.h" #include "DoxygenParser.h" #include +#include +#include "../../Modules/swigmod.h" #define APPROX_LINE_LENGTH 64 //characters per line allowed #define TAB_SIZE 8 //current tab size in spaces //TODO {@link} {@linkplain} {@docRoot}, and other useful doxy commands that are not a javadoc tag @@ -71,8 +73,8 @@ void JavaDocConverter::fillStaticTables() { tagHandlers["result"] = make_pair(&JavaDocConverter::handleTagSame, "return"); tagHandlers["return"] = make_pair(&JavaDocConverter::handleTagSame, ""); tagHandlers["returns"] = make_pair(&JavaDocConverter::handleTagSame, "return"); - tagHandlers["see"] = make_pair(&JavaDocConverter::handleTagSame, ""); - tagHandlers["sa"] = make_pair(&JavaDocConverter::handleTagSame, "see"); + //tagHandlers["see"] = make_pair(&JavaDocConverter::handleTagSame, ""); + //tagHandlers["sa"] = make_pair(&JavaDocConverter::handleTagSame, "see"); tagHandlers["since"] = make_pair(&JavaDocConverter::handleTagSame, ""); tagHandlers["throws"] = make_pair(&JavaDocConverter::handleTagSame, ""); tagHandlers["throw"] = make_pair(&JavaDocConverter::handleTagSame, "throws"); @@ -87,7 +89,9 @@ void JavaDocConverter::fillStaticTables() { tagHandlers["if"] = make_pair(&JavaDocConverter::handleTagIf, "If: "); tagHandlers["ifnot"] = make_pair(&JavaDocConverter::handleTagIf, "If not: "); tagHandlers["image"] = make_pair(&JavaDocConverter::handleTagImage, ""); - tagHandlers["link"] = make_pair(&JavaDocConverter::handleTagExtended, "link"); + tagHandlers["link"] = make_pair(&JavaDocConverter::handleTagLink, ""); + tagHandlers["see"] = make_pair(&JavaDocConverter::handleTagSee, ""); + tagHandlers["sa"] = make_pair(&JavaDocConverter::handleTagSee, ""); tagHandlers["note"] = make_pair(&JavaDocConverter::handleTagMessage, "Note: "); tagHandlers["overload"] = make_pair(&JavaDocConverter::handleTagMessage, "This is an overloaded member function, provided for" " convenience. It differs from the above function only in what" @@ -152,10 +156,12 @@ std::string JavaDocConverter::formatCommand(std::string unformattedLine, int ind } bool JavaDocConverter::paramExists(std::string param) { + if (GetFlag(currentNode, "feature:doxygen:nostripparams")) + return true; ParmList *plist = CopyParmList(Getattr(currentNode, "parms")); Parm *p = NULL; for (p = plist; p;) { - if (Char(Getattr(p, "name")) == param) + if (Getattr(p, "name") && Char(Getattr(p, "name")) == param) return true; /* * doesn't seem to work always: in some cases (especially for 'self' parameters) @@ -289,6 +295,115 @@ void JavaDocConverter::handleTagParam(DoxygenEntity& tag, std::string& translate handleParagraph(tag, translatedComment, dummy); } +string JavaDocConverter::convertLink(string linkObject) { + if (GetFlag(currentNode, "feature:doxygen:nolinktranslate")) + return linkObject; + // find the params in function in linkObject (if any) + size_t lbracePos = linkObject.find('(', 0); + size_t rbracePos = linkObject.find(')', 0); + if (lbracePos == string::npos && rbracePos == string::npos && lbracePos >= rbracePos) + return ""; + + string paramsStr = linkObject.substr(lbracePos + 1, rbracePos - lbracePos - 1); + // strip the params, to fill them later + linkObject = linkObject.substr(0, lbracePos); + + // find all the params + vector params; + size_t lastPos = 0, commaPos = 0; + while (true) { + commaPos = paramsStr.find(',', lastPos); + if (commaPos == string::npos) + commaPos = paramsStr.size(); + string param = paramsStr.substr(lastPos, commaPos - lastPos); + // if any param type is empty, we are failed + if (!param.size()) + return ""; + params.push_back(param); + lastPos = commaPos + 1; + if (lastPos >= paramsStr.size()) + break; + } + + linkObject += "("; + for (size_t i=0; i 'a(100).a(10).p.p.int' + // also converting arrays to pointers + string paramStr = params[i]; + String *swigType = NewString(""); + for (int j=(int)params[i].size() - 1; j>=0; j--) { + // skip all the [...] blocks, write 'p.' for every of it + if (paramStr[j] == ']') { + while (j>=0 && paramStr[j] != '[') + j--; + // no closing brace + if (!j) + return ""; + Append(swigType, "p."); + continue; + } + else if (paramStr[j] == '*') + Append(swigType, "p."); + else if (isalnum(paramStr[j])) { + Append(swigType, paramStr.substr(0, j + 1).c_str()); + break; + } + } + + // make dummy param list, to lookup typemaps for it + Parm *dummyParam = NewParm(swigType, "", 0); + Swig_typemap_attach_parms("jstype", dummyParam, NULL); + Language::instance()->replaceSpecialVariables(0, Getattr(dummyParam, "tmap:jstype"), dummyParam); + + //Swig_print(dummyParam, 1); + linkObject += Char(Getattr(dummyParam, "tmap:jstype")); + if (i != params.size() - 1) + linkObject += ","; + + Delete(dummyParam); + Delete(swigType); + } + linkObject += ")"; + + return linkObject; +} + +void JavaDocConverter::handleTagLink(DoxygenEntity& tag, std::string& translatedComment, std::string&) { + std::string dummy; + if (!tag.entityList.size()) + return; + + string linkObject = convertLink(tag.entityList.begin()->data); + if (!linkObject.size()) + linkObject = tag.entityList.begin()->data; + tag.entityList.pop_front(); + + translatedComment += "{@link "; + translatedComment += linkObject + " "; + handleParagraph(tag, translatedComment, dummy); + translatedComment += "}"; +} + +void JavaDocConverter::handleTagSee(DoxygenEntity& tag, std::string& translatedComment, std::string&) { + std::string dummy; + if (!tag.entityList.size()) + return; + + list::iterator it; + for (it = tag.entityList.begin(); it!=tag.entityList.end(); it++) { + if (it->typeOfEntity == "plainstd::endl") + handleNewLine(*it, translatedComment, dummy); + if (it->typeOfEntity != "plainstd::string") + continue; + translatedComment += "@see "; + string linkObject = convertLink(it->data); + if (!linkObject.size()) + linkObject = it->data; + translatedComment += linkObject; + } +} + String *JavaDocConverter::makeDocumentation(Node *node) { String *documentation = getDoxygenComment(node); diff --git a/Source/DoxygenTranslator/src/JavaDocConverter.h b/Source/DoxygenTranslator/src/JavaDocConverter.h index f68a712b9..a547a17f8 100644 --- a/Source/DoxygenTranslator/src/JavaDocConverter.h +++ b/Source/DoxygenTranslator/src/JavaDocConverter.h @@ -30,6 +30,11 @@ protected: std::string translateSubtree(DoxygenEntity & doxygenEntity); void translateEntity(DoxygenEntity &tag, std::string &translatedComment); + /* + * Convert params in link-objects and references + */ + std::string convertLink(std::string linkObject); + /* * Typedef for the function that handles one tag * arg - some string argument to easily pass it through lookup table @@ -89,6 +94,16 @@ protected: * Insert @param command, if it is really a function param */ void handleTagParam(DoxygenEntity &tag, std::string &translatedComment, std::string &arg); + /* + * Insert {@link...} command, and handle all the s correctly + * (like converting types of params, etc) + */ + void handleTagLink(DoxygenEntity &tag, std::string &translatedComment, std::string &arg); + /* + * Insert @see command, and handle all the s correctly + * (like converting types of params, etc) + */ + void handleTagSee(DoxygenEntity &tag, std::string &translatedComment, std::string &arg); private: From e05d88b83cfbd1baef54988346911c3b1df8f5a7 Mon Sep 17 00:00:00 2001 From: Dmitry Kabak Date: Fri, 3 Aug 2012 21:53:48 +0000 Subject: [PATCH 118/314] Removed some old unused code from parser.y git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2012-doxygen@13491 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Source/CParse/parser.y | 31 ++----------------------------- 1 file changed, 2 insertions(+), 29 deletions(-) diff --git a/Source/CParse/parser.y b/Source/CParse/parser.y index 41c94a5f3..27957d9ab 100644 --- a/Source/CParse/parser.y +++ b/Source/CParse/parser.y @@ -64,8 +64,6 @@ static Node **class_decl = NULL; /* ----------------------------------------------------------------------------- * Doxygen Comment Globals and Assist Functions * ----------------------------------------------------------------------------- */ -String *currentComment; /* Location of the stored Doxygen Comment */ -String *currentPostComment; /* Location of the stored Doxygen Post-Comment */ static String *currentDeclComment = NULL; /* Comment of C/C++ declaration. */ static Node *previousNode = NULL; /* Pointer to the previous node (for post comments) */ static Node *currentNode = NULL; /* Pointer to the current node (for post comments) */ @@ -4866,37 +4864,12 @@ storage_class : EXTERN { $$ = "extern"; } ------------------------------------------------------------------------------ */ parms : rawparms { - Parm *p, *nextSibling; + Parm *p; $$ = $1; p = $1; while (p) { - String *postComment = NULL; - nextSibling = nextSibling(p); - if (nextSibling != NULL) { - postComment = Getattr(nextSibling, "postComment"); - } else { - /* the last functino parameter has two attributes - - post comment of the previous params and its own post - comment. - */ - postComment = Getattr(p, "lastParamPostComment"); - } - if (postComment != NULL) { - String *param = NewString("\n@param "); - if (currentComment != 0) { - Append(currentComment, param); - Append(currentComment, Getattr(p, "name")); - Append(currentComment, postComment); - } - else { - currentComment = param; - Append(currentComment, Getattr(p, "name")); - Append(currentComment, postComment); - } - } - Replace(Getattr(p,"type"),"typename ", "", DOH_REPLACE_ANY); - p = nextSibling; + p = nextSibling(p); } } ; From 6365770c7fe90d449ccea50823146ff15736afb0 Mon Sep 17 00:00:00 2001 From: Dmitry Kabak Date: Sun, 5 Aug 2012 13:31:19 +0000 Subject: [PATCH 119/314] Added missing test part to python testsuite git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2012-doxygen@13516 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Examples/test-suite/python/doxygen_basic_translate_runme.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Examples/test-suite/python/doxygen_basic_translate_runme.py b/Examples/test-suite/python/doxygen_basic_translate_runme.py index 4698e0f6c..4c1376f44 100644 --- a/Examples/test-suite/python/doxygen_basic_translate_runme.py +++ b/Examples/test-suite/python/doxygen_basic_translate_runme.py @@ -65,3 +65,9 @@ check(doxygen_basic_translate.function6.__doc__, '' ' Arguments: \n' ' a (int) -- Some parameter, default is 42\n' ) +check(doxygen_basic_translate.function7.__doc__, '' +' Test for a parameter with difficult type \n' +' (mostly for python) \n' +' Arguments: \n' +' a (Shape::superType *[10]) -- Very strange param \n' +) From 346fdfcab7d8532ec4a702d5edd0bf6575b29605 Mon Sep 17 00:00:00 2001 From: Dmitry Kabak Date: Sun, 5 Aug 2012 14:16:57 +0000 Subject: [PATCH 120/314] Added doxygen:notranslate feature, to prevent running of automatic comment translation git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2012-doxygen@13517 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Examples/test-suite/common.mk | 2 + .../test-suite/doxygen_basic_notranslate.i | 103 ++++++++++++++++++ .../src/JavaDocConverter.cpp | 10 ++ .../DoxygenTranslator/src/PyDocConverter.cpp | 30 ++++- 4 files changed, 139 insertions(+), 6 deletions(-) create mode 100644 Examples/test-suite/doxygen_basic_notranslate.i diff --git a/Examples/test-suite/common.mk b/Examples/test-suite/common.mk index eb8f7b03a..86e33037a 100644 --- a/Examples/test-suite/common.mk +++ b/Examples/test-suite/common.mk @@ -189,8 +189,10 @@ CPP_TEST_CASES += \ disown \ doxygen_parsing \ doxygen_basic_translate \ + doxygen_basic_notranslate \ doxygen_translate \ doxygen_translate_all_tags \ + doxygen_translate_links \ dynamic_cast \ empty \ enum_rename \ diff --git a/Examples/test-suite/doxygen_basic_notranslate.i b/Examples/test-suite/doxygen_basic_notranslate.i new file mode 100644 index 000000000..8699e3289 --- /dev/null +++ b/Examples/test-suite/doxygen_basic_notranslate.i @@ -0,0 +1,103 @@ +%module doxygen_basic_notranslate + +%include "doxygen_basic_translate.h" +%feature("doxygen:notranslate") function; +%feature("doxygen:notranslate") function2; +%feature("doxygen:notranslate") function3; +%feature("doxygen:notranslate") function4; +%feature("doxygen:notranslate") function5; +%feature("doxygen:notranslate") function6; +%feature("doxygen:notranslate") function7; + +%inline %{ + +/** + * \brief + * Brief description. + * + * The comment text + * \author Some author + * \return Some number + * \sa function2 + */ +int function() +{ +} + +/** + * A test of a very very very very very very very very very very very very very very very very + * very very very very very long comment string. + */ +int function2() +{ +} + +/** + * A test for overloaded functions + * This is function \b one + */ +int function3(int a) +{ +} + +/** + * A test for overloaded functions + * This is function \b two + */ +int function3(int a, int b) +{ +} + +/** + * A test of some mixed tag usage + * \if CONDITION + * This \a code fragment shows us something \. + * \par Minuses: + * \arg it's senseless + * \arg it's stupid + * \arg it's null + * + * \warning This may not work as expected + * + * \code + * int main() { while(true); } + * \endcode + * \endif + */ +int function4() +{ +} + + +int function5(int a) +{ +} +/**< This is a post comment. */ + +/** + * Test for default args + * @param a Some parameter, default is 42 + */ +int function6(int a=42) +{ +} + +class Shape +{ +public: + typedef Shape* superType; +}; + +/** + * Test for a parameter with difficult type + * (mostly for python) + * @param a Very strange param + */ +void function7(Shape::superType *a[10]) +{ +} + +/** + * Comment at the end of file should be ignored. + */ +%} diff --git a/Source/DoxygenTranslator/src/JavaDocConverter.cpp b/Source/DoxygenTranslator/src/JavaDocConverter.cpp index 123eb040b..b03556b47 100644 --- a/Source/DoxygenTranslator/src/JavaDocConverter.cpp +++ b/Source/DoxygenTranslator/src/JavaDocConverter.cpp @@ -412,6 +412,16 @@ String *JavaDocConverter::makeDocumentation(Node *node) { return NULL; } + if (GetFlag(node, "feature:doxygen:notranslate")) { + String *comment = NewString("/**\n"); + Append(comment, documentation); + // reformat the comment + Replaceall(comment, "\n *", "\n"); + Replaceall(comment, "\n", "\n * "); + Append(comment, "\n */\n"); + return comment; + } + std::list < DoxygenEntity > entityList = parser.createTree(Char(documentation), Char(Getfile(documentation)), Getline(documentation)); // entityList.sort(CompareDoxygenEntities()); sorting currently not used, diff --git a/Source/DoxygenTranslator/src/PyDocConverter.cpp b/Source/DoxygenTranslator/src/PyDocConverter.cpp index df9466067..777a54201 100644 --- a/Source/DoxygenTranslator/src/PyDocConverter.cpp +++ b/Source/DoxygenTranslator/src/PyDocConverter.cpp @@ -254,9 +254,18 @@ String *PyDocConverter::makeDocumentation(Node *n) { documentation = getDoxygenComment(n); if (!Swig_is_generated_overload(n) && documentation) { currentNode = n; - std::list < DoxygenEntity > entityList = parser.createTree(Char(documentation), Char(Getfile(documentation)), Getline(documentation)); - DoxygenEntity root("root", entityList); - allDocumentation.push_back(translateSubtree(root)); + if (GetFlag(n, "feature:doxygen:notranslate")) { + String *comment = NewString(""); + Append(comment, documentation); + Replaceall(comment, "\n *", "\n"); + allDocumentation.push_back(Char(comment)); + Delete(comment); + } + else { + std::list < DoxygenEntity > entityList = parser.createTree(Char(documentation), Char(Getfile(documentation)), Getline(documentation)); + DoxygenEntity root("root", entityList); + allDocumentation.push_back(translateSubtree(root)); + } } n = Getattr(n, "sym:nextSibling"); } @@ -279,9 +288,18 @@ String *PyDocConverter::makeDocumentation(Node *n) { else { documentation = getDoxygenComment(n); if (documentation != NULL) { - std::list < DoxygenEntity > entityList = parser.createTree(Char(documentation), Char(Getfile(documentation)), Getline(documentation)); - DoxygenEntity root("root", entityList); - pyDocString = translateSubtree(root); + if (GetFlag(n, "feature:doxygen:notranslate")) { + String *comment = NewString(""); + Append(comment, documentation); + Replaceall(comment, "\n *", "\n"); + pyDocString = Char(comment); + Delete(comment); + } + else { + std::list < DoxygenEntity > entityList = parser.createTree(Char(documentation), Char(Getfile(documentation)), Getline(documentation)); + DoxygenEntity root("root", entityList); + pyDocString = translateSubtree(root); + } } } From 0a3db948cca61b0976b68eed5a2bc777da0d38b2 Mon Sep 17 00:00:00 2001 From: Dmitry Kabak Date: Sun, 5 Aug 2012 14:18:46 +0000 Subject: [PATCH 121/314] Fixed possible bug: as the return value of makeDocumentation is never checked, don't return null pointers, even in case of errors git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2012-doxygen@13518 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Source/DoxygenTranslator/src/JavaDocConverter.cpp | 2 +- Source/DoxygenTranslator/src/PyDocConverter.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/DoxygenTranslator/src/JavaDocConverter.cpp b/Source/DoxygenTranslator/src/JavaDocConverter.cpp index b03556b47..c7485ab4f 100644 --- a/Source/DoxygenTranslator/src/JavaDocConverter.cpp +++ b/Source/DoxygenTranslator/src/JavaDocConverter.cpp @@ -409,7 +409,7 @@ String *JavaDocConverter::makeDocumentation(Node *node) { String *documentation = getDoxygenComment(node); if (documentation == NULL) { - return NULL; + return NewString(""); } if (GetFlag(node, "feature:doxygen:notranslate")) { diff --git a/Source/DoxygenTranslator/src/PyDocConverter.cpp b/Source/DoxygenTranslator/src/PyDocConverter.cpp index 777a54201..7937b5ba5 100644 --- a/Source/DoxygenTranslator/src/PyDocConverter.cpp +++ b/Source/DoxygenTranslator/src/PyDocConverter.cpp @@ -316,7 +316,7 @@ String *PyDocConverter::makeDocumentation(Node *n) { return NewString(result.c_str()); } - return 0; + return NewString(""); } std::string PyDocConverter::generateDivider() { From 51e184f134cf1a7897aac7e5c4f1a3229c74c3db Mon Sep 17 00:00:00 2001 From: Dmitry Kabak Date: Sun, 5 Aug 2012 16:22:48 +0000 Subject: [PATCH 122/314] Added special doxygen features description to docs git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2012-doxygen@13523 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Doc/Manual/Doxygen.html | 90 ++++++++++++++++++++++++++++++++++++----- 1 file changed, 81 insertions(+), 9 deletions(-) diff --git a/Doc/Manual/Doxygen.html b/Doc/Manual/Doxygen.html index 77c00b40e..3178f70c2 100644 --- a/Doc/Manual/Doxygen.html +++ b/Doc/Manual/Doxygen.html @@ -101,7 +101,7 @@ Here they are: Also any of the above with '<' added after comment-starting symbol, like /**<, /*!<, ///<, or //!< will be treated as post-comment and will be assigned to the node before the comment.
    -Any number of '*' or '/' in doxygen comment is considered to be a separator and is not included in final comment, so you may safely use +Any number of '*' or '/' in Doxygen comment is considered to be a separator and is not included in final comment, so you may safely use comments like /*********/ or //////////.

    @@ -172,11 +172,11 @@ Also, currently only the comments directly before or after the nodes are support

    There is a switch '-doxygen' in every module that supports converting documentation comments. Some comments in some target languages can be manually overriden by specific -swig's features, like feature:docstring or feature:autodoc, in this cases doxygen comments +swig's features, like feature:docstring or feature:autodoc, in this cases Doxygen comments have lowest priority.

    -If doxygen parsing is switched off, then all the comments are stripped out in parser and all the resources used by comment parser and translator are freed. +If Doxygen parsing is switched off, then all the comments are stripped out in parser and all the resources used by comment parser and translator are freed.

    39.2.2 Additional Commandline Options

    @@ -274,19 +274,61 @@ public class Shape { - -

    The code Java-wise should be identical to what would have been generated without this feature enabled. When the Doxygen Translator Module encounters a comment it finds nothing useful in or cannot parse, it should not effect the functionality of the SWIG generated code.

    +

    +JavaDoc translator will handle most of the tags conversions (see the table below). It will also automatically translate link-objects +params, in \see and \link...\endlink commands. For example, 'someFunction(std::string)' will be converted to 'someFunction(String)'. +If this works not really good for you, or if you don't want such behaviour, you could turn this off by using 'doxygen:nolinktranslate' +feature. Also all '\param' and '\tparam' commands are stripped out, if specified parameter is not present in function. Use 'doxygen:nostripparams' +to avoid. +
    +If you intend to use resulting proxy files with Doxygen docs generator, rather than JavaDoc, you may want to turn off translator completely +(doxygen:notranslate feature). +Then SWIG will just copy the comments to the proxy file and reformat them if needed, but all the comment content will be left as is. +

    + +

    +JavaDoc translator features summary (see %feature directives): +
    + +

    + +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    doxygen:noranslate +Turn off the whole Doxygen translator. +The Doxygen comment will be attached to the right node, +but all the commands and text will be left as-is +
    doxygen:notlinkranslateTurn off automatic link-objects translation
    doxygen:nostripparams +Turn off stripping of @param and @tparam +Doxygen commands if such parameter is not found +
    +
    +

    39.3.2 JavaDoc Tags

    -Here is the list of all doxygen tags and the description of how they are translated to JavaDoc +Here is the list of all Doxygen tags and the description of how they are translated to JavaDoc
    Doxygen tags:

    @@ -782,11 +824,41 @@ class Shape(_object): Currently Doxygen comments assigned to vars are not present in proxy file, so they have no comment translated for them.

    +

    +Since all the overloaded functions in c++ are wrapped into one Python function, PyDoc translator will combine every comment of every +overloaded function and put it in the comment for wrapping function. +
    +If you intend to use resulting proxy files with Doxygen docs generator, rather than PyDoc, you may want to turn off translator completely +(doxygen:notranslate feature). +Then SWIG will just copy the comments to the proxy file and reformat them if needed, but all the comment content will be left as is. As Doxygen +don't support special commands in Python comments (see Doxygen docs), +you may want to use some tool like doxypy (http://code.foosel.org/doxypy) to do the work. +

    + +

    +PyDoc translator features summary (see %feature directives): +
    + +

    + +
    +
    +
    +
    +
    +
    +
    doxygen:noranslate +Turn off the whole Doxygen translator. +The Doxygen comment will be attached to the right node, +but all the commands and text will be left as-is +
    +
    +

    39.4.2 PyDoc translator

    -Here is the list of all doxygen tags and the description of how they are translated to PyDoc +Here is the list of all Doxygen tags and the description of how they are translated to PyDoc
    Doxygen tags:

    @@ -1218,8 +1290,8 @@ There are two handy command line switches, that enable lots of detailed debug in

    -  -debug-doxygen-parser     - Display doxygen parser module debugging information
    -  -debug-doxygen-translator - Display doxygen translator module debugging information
    +  -debug-doxygen-parser     - Display Doxygen parser module debugging information
    +  -debug-doxygen-translator - Display Doxygen translator module debugging information
     

    39.6 Extending to Other Languages

    From cecc793782e329b1f811b49960d84d5a89e4fc81 Mon Sep 17 00:00:00 2001 From: Dmitry Kabak Date: Tue, 7 Aug 2012 20:04:23 +0000 Subject: [PATCH 123/314] Various small code fixes. Some unwanted code removed. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2012-doxygen@13551 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- .../DoxygenTranslator/src/DoxygenCommands.h | 35 ----- Source/DoxygenTranslator/src/DoxygenEntity.h | 4 - .../DoxygenTranslator/src/DoxygenParser.cpp | 134 ++++-------------- Source/DoxygenTranslator/src/DoxygenParser.h | 31 +--- .../src/DoxygenTranslator.cpp | 2 +- .../DoxygenTranslator/src/DoxygenTranslator.h | 5 +- Source/DoxygenTranslator/src/TokenList.cpp | 2 +- 7 files changed, 36 insertions(+), 177 deletions(-) diff --git a/Source/DoxygenTranslator/src/DoxygenCommands.h b/Source/DoxygenTranslator/src/DoxygenCommands.h index 96fde4a7c..10ebca862 100644 --- a/Source/DoxygenTranslator/src/DoxygenCommands.h +++ b/Source/DoxygenTranslator/src/DoxygenCommands.h @@ -2,25 +2,6 @@ #ifndef DOXYGENCOMMANDS_H #define DOXYGENCOMMANDS_H -const char *commandArray[] = { - "a", "addindex", "addtogroup", "anchor", "arg", "attention", - "author", "authors", "b", "brief", "bug", "c", "callgraph", "callergraph", "category", "cite", - "class", "code", "cond", "copybrief", "copydetails", "copydoc", "copyright", "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", "mscfile", "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", "remark", "result", "return", "returns", "retval", - "sa", "section", "see", "showinitializer", "since", "skip", "skipline", "struct", "subpage", - "subsection", "subsubsection", "test", "throw", "throws", "todo", "tparam", "typedef", "union", "until", - "var", "verbatim", "verbinclude", "version", "warning", "weakgroup", "xmlonly", "xrefitem", "$", "@", "\\", "&", "~", "<", ">", "#", "%"}; - - const char *sectionIndicators[] = { "attention", "author", "authors", "brief", "bug", "cond", "date", "deprecated", "details", "else", "elseif", "endcond", "endif", "exception", "if", "ifnot", "invariant", "note", "par", "param", @@ -35,38 +16,22 @@ const char *simpleCommands[] = { "protected", "protectedsection", "tableofcontents"}; const int simpleCommandsSize = sizeof(simpleCommands) / sizeof(*simpleCommands); -const char *ignoredSimpleCommands[] = { - "nothing at the moment"}; -const int ignoredSimpleCommandsSize = sizeof(ignoredSimpleCommands) / sizeof(*ignoredSimpleCommands); - const char *commandWords[] = { "a", "b", "c", "e", "em", "p", "def", "enum", "package", "relates", "namespace", "relatesalso", "anchor", "dontinclude", "include", "includelineno", "copydoc", "copybrief", "copydetails", "verbinclude", "htmlinclude", "extends", "implements", "memberof", "related", "relatedalso", "cite"}; const int commandWordsSize = sizeof(commandWords) / sizeof(*commandWords); -const char *ignoredCommandWords[] = { - "nothing at the moment"}; -const int ignoredCommandWordsSize = sizeof(ignoredCommandWords) / sizeof(*ignoredCommandWords); - const char *commandLines[] = { "addindex", "fn", "name", "line", "var", "skipline", "typedef", "skip", "until", "property"}; const int commandLinesSize = sizeof(commandLines) / sizeof(*commandLines); -const char *ignoreCommandLines[] = { - "nothing at the moment"}; -const int ignoreCommandLinesSize = sizeof(ignoreCommandLines) / sizeof(*ignoreCommandLines); - const char *commandParagraph[] = { "partofdescription", "result", "return", "returns", "remarks", "remark", "since", "test", "sa", "see", "pre", "post", "details", "invariant", "deprecated", "date", "note", "warning", "version", "todo", "bug", "attention", "brief", "author", "authors", "copyright", "short"}; const int commandParagraphSize = sizeof(commandParagraph) / sizeof(*commandParagraph); -const char *ignoreCommandParagraphs[] = { - "nothing at the moment"}; -const int ignoreCommandParagraphsSize = sizeof(ignoreCommandParagraphs) / sizeof(*ignoreCommandParagraphs); - const char *commandEndCommands[] = { "htmlonly", "latexonly", "manonly", "xmlonly", "link", "rtfonly"}; const int commandEndCommandsSize = sizeof(commandEndCommands) / sizeof(*commandEndCommands); diff --git a/Source/DoxygenTranslator/src/DoxygenEntity.h b/Source/DoxygenTranslator/src/DoxygenEntity.h index dcdba7644..64b692ba0 100644 --- a/Source/DoxygenTranslator/src/DoxygenEntity.h +++ b/Source/DoxygenTranslator/src/DoxygenEntity.h @@ -20,13 +20,9 @@ typedef enum { SIMPLECOMMAND, - IGNOREDSIMPLECOMMAND, COMMANDWORD, - IGNOREDCOMMANDWORD, COMMANDLINE, - IGNOREDCOMMANDLINE, COMMANDPARAGRAPH, - IGNORECOMMANDPARAGRAPH, COMMANDENDCOMMAND, COMMANDWORDPARAGRAPH, COMMANDWORDLINE, diff --git a/Source/DoxygenTranslator/src/DoxygenParser.cpp b/Source/DoxygenTranslator/src/DoxygenParser.cpp index 8ed186727..4df82b2d7 100644 --- a/Source/DoxygenTranslator/src/DoxygenParser.cpp +++ b/Source/DoxygenTranslator/src/DoxygenParser.cpp @@ -32,24 +32,12 @@ void DoxygenParser::fillTables() { // fill in tables with data from DxygenCommands.h for (int i = 0; i < simpleCommandsSize; i++) doxygenCommands[simpleCommands[i]] = SIMPLECOMMAND; - for (int i = 0; i < ignoredSimpleCommandsSize; i++) - doxygenCommands[ignoredSimpleCommands[i]] = IGNOREDSIMPLECOMMAND; - for (int i = 0; i < commandWordsSize; i++) doxygenCommands[commandWords[i]] = COMMANDWORD; - for (int i = 0; i < ignoredCommandWordsSize; i++) - doxygenCommands[ignoredCommandWords[i]] = IGNOREDCOMMANDWORD; - for (int i = 0; i < commandLinesSize; i++) doxygenCommands[commandLines[i]] = COMMANDLINE; - for (int i = 0; i < ignoreCommandLinesSize; i++) - doxygenCommands[ignoreCommandLines[i]] = IGNOREDCOMMANDLINE; - for (int i = 0; i < commandParagraphSize; i++) doxygenCommands[commandParagraph[i]] = COMMANDPARAGRAPH; - for (int i = 0; i < ignoreCommandParagraphsSize; i++) - doxygenCommands[ignoreCommandParagraphs[i]] = IGNORECOMMANDPARAGRAPH; - for (int i = 0; i < commandEndCommandsSize; i++) doxygenCommands[commandEndCommands[i]] = COMMANDENDCOMMAND; for (int i = 0; i < commandWordParagraphsSize; i++) @@ -70,7 +58,7 @@ void DoxygenParser::fillTables() { doxygenSectionIndicators.insert(sectionIndicators[i]); } -std::string DoxygenParser::StringToLower(std::string stringToConvert) { +std::string DoxygenParser::stringToLower(std::string &stringToConvert) { for (unsigned int i = 0; i < stringToConvert.length(); i++) { stringToConvert[i] = tolower(stringToConvert[i]); } @@ -79,7 +67,7 @@ std::string DoxygenParser::StringToLower(std::string stringToConvert) { int DoxygenParser::findCommand(std::string smallString) { std::map::iterator it; - smallString = StringToLower(smallString); + smallString = stringToLower(smallString); // I'm not sure if we can really do so, because there are different commands // in doxygenCommands and original commandArray it = doxygenCommands.find(smallString); @@ -89,7 +77,7 @@ int DoxygenParser::findCommand(std::string smallString) { } int DoxygenParser::isSectionIndicator(std::string smallString) { - smallString = StringToLower(smallString); + smallString = stringToLower(smallString); std::set::iterator it; it = doxygenSectionIndicators.find(smallString); if (it != doxygenSectionIndicators.end()) @@ -106,7 +94,7 @@ void DoxygenParser::printTree(std::list < DoxygenEntity > &rootList) { } int DoxygenParser::commandBelongs(std::string theCommand) { - std::string smallString = StringToLower(theCommand); + std::string smallString = stringToLower(theCommand); //cout << " Looking for command " << theCommand << endl; std::map::iterator it; it = doxygenCommands.find(smallString); @@ -238,8 +226,7 @@ std::list < Token >::iterator DoxygenParser::getEndCommand(std::string theComman return tokList.end(); } -std::list < Token >::iterator DoxygenParser::getTilAnyCommand(std::string theCommand, TokenList & tokList) { -#pragma unused(theCommand,tokList) +std::list < Token >::iterator DoxygenParser::getTilAnyCommand(std::string, TokenList &) { std::list < Token >::iterator anIterator; return anIterator; } @@ -251,13 +238,6 @@ int DoxygenParser::addSimpleCommand(std::string theCommand, std::list < DoxygenE return 1; } -int DoxygenParser::ignoreSimpleCommand(std::string theCommand, std::list < DoxygenEntity > &doxyList) { -#pragma unused(doxyList) - if (noisy) - cout << "Not Adding " << theCommand << endl; - return 1; -} - int DoxygenParser::addCommandWord(std::string theCommand, TokenList & tokList, std::list < DoxygenEntity > &doxyList) { if (noisy) cout << "Parsing " << theCommand << endl; @@ -272,18 +252,6 @@ int DoxygenParser::addCommandWord(std::string theCommand, TokenList & tokList, s return 0; } -int DoxygenParser::ignoreCommandWord(std::string theCommand, TokenList & tokList, std::list < DoxygenEntity > &doxyList) { -#pragma unused(doxyList) - if (noisy) - cout << "Not Adding " << theCommand << endl; - std::string name = getNextWord(tokList); - if (!name.empty()) - return 1; - else - tokList.printListError("No word followed " + theCommand + " command."); - return 0; -} - int DoxygenParser::addCommandLine(std::string theCommand, TokenList & tokList, std::list < DoxygenEntity > &doxyList) { if (noisy) cout << "Parsing " << theCommand << endl; @@ -293,15 +261,6 @@ int DoxygenParser::addCommandLine(std::string theCommand, TokenList & tokList, s return 1; } -int DoxygenParser::ignoreCommandLine(std::string theCommand, TokenList & tokList, std::list < DoxygenEntity > &doxyList) { -#pragma unused(doxyList) - if (noisy) - cout << "Not Adding " << theCommand << endl; - std::list < Token >::iterator endOfLine = getOneLine(tokList); - tokList.setIterator(endOfLine); - return 1; -} - int DoxygenParser::addCommandParagraph(std::string theCommand, TokenList & tokList, std::list < DoxygenEntity > &doxyList) { if (noisy) cout << "Parsing " << theCommand << endl; @@ -312,15 +271,6 @@ int DoxygenParser::addCommandParagraph(std::string theCommand, TokenList & tokLi return 1; } -int DoxygenParser::ignoreCommandParagraph(std::string theCommand, TokenList & tokList, std::list < DoxygenEntity > &doxyList) { -#pragma unused(doxyList) - if (noisy) - cout << "Not Adding " << theCommand << endl; - std::list < Token >::iterator endOfParagraph = getEndOfParagraph(tokList); - tokList.setIterator(endOfParagraph); - return 1; -} - int DoxygenParser::addCommandEndCommand(std::string theCommand, TokenList & tokList, std::list < DoxygenEntity > &doxyList) { if (noisy) cout << "Parsing " << theCommand << endl; @@ -399,8 +349,7 @@ int DoxygenParser::addCommandOWord(std::string theCommand, TokenList & tokList, return 1; } -int DoxygenParser::addCommandErrorThrow(std::string theCommand, TokenList & tokList, std::list < DoxygenEntity > &doxyList) { -#pragma unused(doxyList) +int DoxygenParser::addCommandErrorThrow(std::string theCommand, TokenList & tokList, std::list < DoxygenEntity > &) { tokList.printListError("Encountered: " + theCommand + "\nThis command should not have been encountered. Behaviour past this may be unpredictable"); std::list < Token >::iterator endOfLine = getOneLine(tokList); @@ -684,7 +633,7 @@ int DoxygenParser::addCommandUnique(std::string theCommand, TokenList & tokList, } int DoxygenParser::addCommand(std::string commandString, TokenList & tokList, std::list < DoxygenEntity > &doxyList) { - std::string theCommand = StringToLower(commandString); + std::string theCommand = stringToLower(commandString); if (theCommand == "plainstd::string") { std::string nextPhrase = getStringTilCommand(tokList); if (noisy) @@ -692,53 +641,30 @@ int DoxygenParser::addCommand(std::string commandString, TokenList & tokList, st doxyList.push_back(DoxygenEntity("plainstd::string", nextPhrase)); return 1; } - int commandNumber = commandBelongs(theCommand); - if (commandNumber == SIMPLECOMMAND) { - return addSimpleCommand(theCommand, doxyList); + switch (commandBelongs(theCommand)) { + case SIMPLECOMMAND: + return addSimpleCommand(theCommand, doxyList); + case COMMANDWORD: + return addCommandWord(theCommand, tokList, doxyList); + case COMMANDLINE: + return addCommandLine(theCommand, tokList, doxyList); + case COMMANDPARAGRAPH: + return addCommandParagraph(theCommand, tokList, doxyList); + case COMMANDENDCOMMAND: + return addCommandEndCommand(theCommand, tokList, doxyList); + case COMMANDWORDPARAGRAPH: + return addCommandWordParagraph(theCommand, tokList, doxyList); + case COMMANDWORDLINE: + return addCommandWordLine(theCommand, tokList, doxyList); + case COMMANDWORDOWORDWORD: + return addCommandWordOWordOWord(theCommand, tokList, doxyList); + case COMMANDOWORD: + return addCommandOWord(theCommand, tokList, doxyList); + case COMMANDERRORTHROW: + return addCommandErrorThrow(theCommand, tokList, doxyList); + case COMMANDUNIQUE: + return addCommandUnique(theCommand, tokList, doxyList); } - if (commandNumber == IGNOREDSIMPLECOMMAND) { - return ignoreSimpleCommand(theCommand, doxyList); - } - if (commandNumber == COMMANDWORD) { - return addCommandWord(theCommand, tokList, doxyList); - } - if (commandNumber == IGNOREDCOMMANDWORD) { - return ignoreCommandWord(theCommand, tokList, doxyList); - } - if (commandNumber == COMMANDLINE) { - return addCommandLine(theCommand, tokList, doxyList); - } - if (commandNumber == IGNOREDCOMMANDLINE) { - return ignoreCommandLine(theCommand, tokList, doxyList); - } - if (commandNumber == COMMANDPARAGRAPH) { - return addCommandParagraph(theCommand, tokList, doxyList); - } - if (commandNumber == IGNORECOMMANDPARAGRAPH) { - return ignoreCommandParagraph(theCommand, tokList, doxyList); - } - if (commandNumber == COMMANDENDCOMMAND) { - return addCommandEndCommand(theCommand, tokList, doxyList); - } - if (commandNumber == COMMANDWORDPARAGRAPH) { - return addCommandWordParagraph(theCommand, tokList, doxyList); - } - if (commandNumber == COMMANDWORDLINE) { - return addCommandWordLine(theCommand, tokList, doxyList); - } - if (commandNumber == COMMANDWORDOWORDWORD) { - return addCommandWordOWordOWord(theCommand, tokList, doxyList); - } - if (commandNumber == COMMANDOWORD) { - return addCommandOWord(theCommand, tokList, doxyList); - } - if (commandNumber == COMMANDERRORTHROW) { - return addCommandErrorThrow(theCommand, tokList, doxyList); - } - if (commandNumber == COMMANDUNIQUE) { - return addCommandUnique(theCommand, tokList, doxyList); - } - return 0; } diff --git a/Source/DoxygenTranslator/src/DoxygenParser.h b/Source/DoxygenTranslator/src/DoxygenParser.h index 5f6432d87..376676e08 100644 --- a/Source/DoxygenTranslator/src/DoxygenParser.h +++ b/Source/DoxygenTranslator/src/DoxygenParser.h @@ -27,7 +27,7 @@ private: /* *Changes a std::string to all lower case */ - std::string StringToLower(std::string stringToConvert); + std::string stringToLower(std::string &stringToConvert); /* * Finds out if a command exists (is a possible command) @@ -112,12 +112,6 @@ private: * \n \\ \@ \& \$ \# \< \> \% */ int addSimpleCommand(std::string theCommand, std::list < DoxygenEntity > &doxyList); - /* - * NOT INCLUDED Simple Commands - * Format: @command - * Plain commands, such as newline etc, they contain no other data - */ - int ignoreSimpleCommand(std::string theCommand, std::list < DoxygenEntity > &doxyList); /* * CommandWord * Format: @command @@ -126,13 +120,6 @@ private: * "relates", "namespace", "relatesalso","anchor", "dontinclude", "include", "includelineno" */ int addCommandWord(std::string theCommand, TokenList & tokList, std::list < DoxygenEntity > &doxyList); - /* - * NOT INCLUDED CommandWord - * Format: @command - * Commands with a single WORD after then such as @b - * "copydoc", "copybrief", "copydetails", "verbinclude", "htmlinclude" - */ - int ignoreCommandWord(std::string theCommand, TokenList & tokList, std::list < DoxygenEntity > &doxyList); /* * CommandLine * Format: @command (line) @@ -140,12 +127,6 @@ private: * "addindex", "fn", "name", "line", "var", "skipline", "typedef", "skip", "until", "property" */ int addCommandLine(std::string theCommand, TokenList & tokList, std::list < DoxygenEntity > &doxyList); - /* - * NOT INCLUDED CommandLine - * Format: @command (line) - * Commands with a single LINE after then such as @var - */ - int ignoreCommandLine(std::string theCommand, TokenList & tokList, std::list < DoxygenEntity > &doxyList); /* * CommandParagraph * Format: @command {paragraph} @@ -154,12 +135,6 @@ private: * "deprecated", "date", "note", "warning", "version", "todo", "bug", "attention", "brief", "arg", "author" */ int addCommandParagraph(std::string theCommand, TokenList & tokList, std::list < DoxygenEntity > &doxyList); - /* - * CommandParagraph - * Format: @command {paragraph} - * Commands with a single LINE after then such as @var - */ - int ignoreCommandParagraph(std::string theCommand, TokenList & tokList, std::list < DoxygenEntity > &doxyList); /* * Command EndCommand * Format: @command and ends at @endcommand @@ -207,9 +182,7 @@ private: */ int addCommandUnique(std::string theCommand, TokenList & tokList, std::list < DoxygenEntity > &doxyList); /* - * 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 + * The actual "meat" of the doxygen parser. Calls the correct addCommand* function */ int addCommand(std::string commandString, TokenList & tokList, std::list < DoxygenEntity > &doxyList); diff --git a/Source/DoxygenTranslator/src/DoxygenTranslator.cpp b/Source/DoxygenTranslator/src/DoxygenTranslator.cpp index 10f6a4585..51df52f59 100644 --- a/Source/DoxygenTranslator/src/DoxygenTranslator.cpp +++ b/Source/DoxygenTranslator/src/DoxygenTranslator.cpp @@ -32,7 +32,7 @@ String *DoxygenTranslator::getDoxygenComment(Node *node) { String *DoxygenTranslator::getDocumentation(Node *node) { if (!hasDocumentation(node)) - return 0; + return NewString(""); return makeDocumentation(node); } diff --git a/Source/DoxygenTranslator/src/DoxygenTranslator.h b/Source/DoxygenTranslator/src/DoxygenTranslator.h index 97be4ee35..7d2e64542 100644 --- a/Source/DoxygenTranslator/src/DoxygenTranslator.h +++ b/Source/DoxygenTranslator/src/DoxygenTranslator.h @@ -39,7 +39,7 @@ public: * Return the documentation for a given node formated for the correct * documentation system. * @param node The node to extract and translate documentation for. - * @return The resulted documentation string. + * @return The resulted documentation string, or empty string in case of any errors. */ String *getDocumentation(Node *node); /* @@ -57,8 +57,7 @@ protected: * Overridden in subclasses to return the documentation formatted for a given * documentation system. * @param node The node to extract and translate documentation for. - * @param documentation The returned documentation string. - * @return A bool to indicate if there was documentation to return for the node. + * @return The resulted documentation string */ virtual String *makeDocumentation(Node *node) = 0; diff --git a/Source/DoxygenTranslator/src/TokenList.cpp b/Source/DoxygenTranslator/src/TokenList.cpp index 62dbdc997..fd5850ffe 100644 --- a/Source/DoxygenTranslator/src/TokenList.cpp +++ b/Source/DoxygenTranslator/src/TokenList.cpp @@ -45,7 +45,7 @@ TokenList TokenList::tokenizeDoxygenComment(const std::string &doxygenComment, c // check if it's one of the '!!!', '***', '///' of any length char c = currentWord[0]; isPlainString = false; - for (int i=0; i Date: Wed, 8 Aug 2012 14:16:48 +0000 Subject: [PATCH 124/314] Changed quoted strings handling. Also not missing any doxygen commands now. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2012-doxygen@13563 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- .../doxygen_translate_all_tags_runme.py | 13 ++-- .../DoxygenTranslator/src/DoxygenParser.cpp | 20 +++++- Source/DoxygenTranslator/src/TokenList.cpp | 67 ++++++++----------- 3 files changed, 52 insertions(+), 48 deletions(-) diff --git a/Examples/test-suite/python/doxygen_translate_all_tags_runme.py b/Examples/test-suite/python/doxygen_translate_all_tags_runme.py index 768ccf1ba..e1d7a33b7 100644 --- a/Examples/test-suite/python/doxygen_translate_all_tags_runme.py +++ b/Examples/test-suite/python/doxygen_translate_all_tags_runme.py @@ -21,7 +21,7 @@ check(doxygen_translate_all_tags.function.__doc__, '' '' ' SomeLatexIndex ' '' -' someGroupSome title ' +' someGroup"Some title" ' '' ' theAnchor' '' @@ -84,8 +84,8 @@ check(doxygen_translate_all_tags.function.__doc__, '' ' digraph example { ' ' node [shape=record, fontname=Helvetica, fontsize=10]; ' '' -' b [ label="class B" URL="\ref B"]; ' -' c [ label="class C" URL="\ref C"]; ' +' b [ label="class B" URL=" B"]; ' +' c [ label="class C" URL=" C"]; ' ' b -> c [ arrowhead="open", style="dashed" ]; ' ' } ' '' @@ -171,9 +171,9 @@ check(doxygen_translate_all_tags.function.__doc__, '' ' someThing' '' ' Sender,Receiver; ' -' Sender->Receiver [label="Command()", URL="\ref ' +' Sender->Receiver [label="Command()", URL=" ' ' Receiver::Command()"]; ' -' Sender<-Receiver [label="Ack()", URL="\ref ' +' Sender<-Receiver [label="Ack()", URL=" ' ' Ack()", ID="1"]; ' '' ' mscFile.mscThe caption' @@ -312,9 +312,10 @@ check(doxygen_translate_all_tags.function.__doc__, '' '' ' This will only appear in XML ' '' +' todo"Todo"Todo List' '' ' Here goes test of symbols: ' ' $@\&~<>#%".::' '' ' And here goes simple text ' -) \ No newline at end of file +) diff --git a/Source/DoxygenTranslator/src/DoxygenParser.cpp b/Source/DoxygenTranslator/src/DoxygenParser.cpp index 4df82b2d7..dd2e556eb 100644 --- a/Source/DoxygenTranslator/src/DoxygenParser.cpp +++ b/Source/DoxygenTranslator/src/DoxygenParser.cpp @@ -106,7 +106,23 @@ int DoxygenParser::commandBelongs(std::string theCommand) { std::string DoxygenParser::getNextWord(TokenList & tokList) { Token nextToken = tokList.peek(); if (nextToken.tokenType == PLAINSTRING) { - nextToken = tokList.next(); + // handle quoted strings as words + if (nextToken.tokenString[0] == '"' + && nextToken.tokenString[nextToken.tokenString.size() - 1] != '"') { + string word = nextToken.tokenString + " "; + nextToken = tokList.next(); + while (true) { + string nextWord = getNextWord(tokList); + if (!nextWord.size()) // maybe report unterminated string error + return word; + word += nextWord; + if (word[word.size() - 1] == '"') // strip quotes + return word.substr(1, word.size() - 2); + word += " "; + } + } + + tokList.next(); return nextToken.tokenString; } return ""; @@ -120,7 +136,6 @@ std::list < Token >::iterator DoxygenParser::getOneLine(TokenList & tokList) { //endOfLine++; return endOfLine; } - //cout << (* endOfLine).toString(); endOfLine++; } @@ -390,6 +405,7 @@ int DoxygenParser::addCommandUnique(std::string theCommand, TokenList & tokList, aNewList.push_front(DoxygenEntity("plainstd::string", title)); aNewList.push_front(DoxygenEntity("plainstd::string", heading)); aNewList.push_front(DoxygenEntity("plainstd::string", key)); + doxyList.push_back(DoxygenEntity(theCommand, aNewList)); return 1; } // \ingroup ( [ ]) diff --git a/Source/DoxygenTranslator/src/TokenList.cpp b/Source/DoxygenTranslator/src/TokenList.cpp index fd5850ffe..d69721e9a 100644 --- a/Source/DoxygenTranslator/src/TokenList.cpp +++ b/Source/DoxygenTranslator/src/TokenList.cpp @@ -28,57 +28,44 @@ TokenList TokenList::tokenizeDoxygenComment(const std::string &doxygenComment, c bool isPlainString = false; string::size_type pos, lastPos = 0; + char prevChar = doxygenComment[lastPos]; string currentWord; while (true) { isPlainString = false; - pos = doxygenComment.find_first_of("\t\n ", lastPos); + pos = doxygenComment.find_first_of("\\@\t\n ", lastPos); if (pos == string::npos) pos = doxygenComment.size(); - if (pos > lastPos) { - currentWord = doxygenComment.substr(lastPos, pos-lastPos); - if (currentWord[0] == '\\' || currentWord[0] == '@') { - // it's a doxygen command - currentWord = currentWord.substr(1, currentWord.length() - 1); - tokList.m_tokenList.push_back(Token(COMMAND, currentWord)); - } - else if (currentWord[0] == '!' || currentWord[0] == '*' || currentWord[0] == '/') { - // check if it's one of the '!!!', '***', '///' of any length - char c = currentWord[0]; - isPlainString = false; - for (size_t i=0; i= doxygenComment.size()) break; - - if (doxygenComment[pos] == '\n') - tokList.m_tokenList.push_back(Token(END_LINE, "\n")); } tokList.m_tokenListIter = tokList.m_tokenList.begin(); return tokList; From 7178385d48763cae99421c948657cd05d1d8e59b Mon Sep 17 00:00:00 2001 From: Dmitry Kabak Date: Thu, 9 Aug 2012 18:58:53 +0000 Subject: [PATCH 125/314] Made comment output nicer, now printing _someword_ instead of _someword _ git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2012-doxygen@13576 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- .../DoxygenTranslator/src/JavaDocConverter.cpp | 18 ++++++++++++++++-- .../DoxygenTranslator/src/PyDocConverter.cpp | 11 +++++++++-- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/Source/DoxygenTranslator/src/JavaDocConverter.cpp b/Source/DoxygenTranslator/src/JavaDocConverter.cpp index c7485ab4f..fb13728ea 100644 --- a/Source/DoxygenTranslator/src/JavaDocConverter.cpp +++ b/Source/DoxygenTranslator/src/JavaDocConverter.cpp @@ -199,8 +199,15 @@ void JavaDocConverter::translateEntity(DoxygenEntity& tag, std::string& translat } void JavaDocConverter::handleTagHtml(DoxygenEntity& tag, std::string& translatedComment, std::string &arg) { - if (tag.entityList.size()) // do not include empty tags - translatedComment += "<" + arg + ">" + translateSubtree(tag) + ""; + if (tag.entityList.size()) { // do not include empty tags + std::string tagData = translateSubtree(tag); + // wrap the thing, ignoring whitespaces + size_t wsPos = tagData.find_last_not_of("\n\t "); + if (wsPos != std::string::npos) + translatedComment += "<" + arg + ">" + tagData.substr(0, wsPos + 1) + "" + tagData.substr(wsPos + 1); + else + translatedComment += "<" + arg + ">" + translateSubtree(tag) + " "; + } } void JavaDocConverter::handleNewLine(DoxygenEntity&, std::string& translatedComment, std::string&) { translatedComment += "\n * "; @@ -434,6 +441,13 @@ String *JavaDocConverter::makeDocumentation(Node *node) { std::string javaDocString = "/**\n * "; + // strip endlines at the beginning + while (entityList.begin()->typeOfEntity == "plainstd::endl") + entityList.pop_front(); + // and at the end + while (entityList.rbegin()->typeOfEntity == "plainstd::endl") + entityList.pop_back(); + // store the current node // (currently just to handle params) currentNode = node; diff --git a/Source/DoxygenTranslator/src/PyDocConverter.cpp b/Source/DoxygenTranslator/src/PyDocConverter.cpp index 7937b5ba5..0f1f32cbb 100644 --- a/Source/DoxygenTranslator/src/PyDocConverter.cpp +++ b/Source/DoxygenTranslator/src/PyDocConverter.cpp @@ -227,8 +227,15 @@ void PyDocConverter::handleTagParam(DoxygenEntity& tag, std::string& translatedC translatedComment += paramNameEntity.data + " (" + paramType + ")" + paramDescription; } void PyDocConverter::handleTagWrap(DoxygenEntity& tag, std::string& translatedComment, std::string &arg) { - if (tag.entityList.size()) // do not include empty tags - translatedComment += arg + translateSubtree(tag) + arg; + if (tag.entityList.size()) { // do not include empty tags + std::string tagData = translateSubtree(tag); + // wrap the thing, ignoring whitespaces + int wsPos = tagData.find_last_not_of("\n\t "); + if (wsPos != std::string::npos) + translatedComment += arg + tagData.substr(0, wsPos + 1) + arg + tagData.substr(wsPos + 1); + else + translatedComment += arg + tagData + arg + " "; + } } void PyDocConverter::handleNewLine(DoxygenEntity&, std::string& translatedComment, std::string&) { translatedComment += "\n"; From 423915eef695b50790d4345441bba161b5a845e9 Mon Sep 17 00:00:00 2001 From: Dmitry Kabak Date: Thu, 9 Aug 2012 19:06:58 +0000 Subject: [PATCH 126/314] Added some docs, updated project-plan git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2012-doxygen@13577 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Doc/Devel/plan-gsoc-2012.txt | 20 +++++++++++++---- Doc/Manual/Contents.html | 3 ++- Doc/Manual/Doxygen.html | 42 ++++++++++++++++++++++++++++++++++-- 3 files changed, 58 insertions(+), 7 deletions(-) diff --git a/Doc/Devel/plan-gsoc-2012.txt b/Doc/Devel/plan-gsoc-2012.txt index 43fc1adc3..7e8ecf541 100644 --- a/Doc/Devel/plan-gsoc-2012.txt +++ b/Doc/Devel/plan-gsoc-2012.txt @@ -77,7 +77,9 @@ Functionality to the destination documentation. 'Not implemented' means that the tag with it's contents is stripped out of the output. - Doxygen tags: + Doxygen tags: + + All tags: -OK- \a - translated to in JD, surrounded with _ in PD \addindex - ignored @@ -257,12 +259,12 @@ Optional functionality That section describes some complex cases where the current code does not behave really well. Like a short to-do list of special cases. -- When translating functions with default parameters in swig to +-OK- When translating functions with default parameters in swig to java, it creates overloaded functions with all the parameters except the default ones. We need to copy the doxygen comment to such functions and correct the list of @param tags. -- In doxygen there is a special tags (and even a special option) +-OK- In doxygen there is a special tags (and even a special option) to create links to some code members from the current comment. Sometimes it needs a type of parameters specified because of the overloaded functions. And the same linking tags are supported in JD, @@ -303,6 +305,15 @@ The following test cases will be implemented: -OK- Class comment, with all supported tags. -OK- Class comment, with all doxygen tags, including ignored ones. + +The list of all tests, in form of shell commands to make it simple +to test project by copying the text below into terminal program. +make doxygen_parsing.cpptest -s +make doxygen_translate.cpptest -s +make doxygen_translate_all_tags.cpptest -s +make doxygen_basic_translate.cpptest -s +make doxygen_basic_notranslate.cpptest -s +make doxygen_translate_links.cpptest -s Refactoring @@ -313,7 +324,7 @@ All the code in directory _DoxygenTranslator_ should be refactored: -OK- most static methods should be normal members -OK- replace C arrays of strings and sequential searches with STL data structures and algorithms. -- use singletons instead of class instantiaion for each comment found. +-OK- use singletons instead of class instantiaion for each comment found. Documentation @@ -324,4 +335,5 @@ SWIG documentation will contain: -OK- list of implemented features (types and placements of comments) -OK- list of unimplemented features (types and placements of comments) -OK- list of tags and their translations (all Doxygen tags). +-OK- some amount of debugging and development information diff --git a/Doc/Manual/Contents.html b/Doc/Manual/Contents.html index ca66d87cc..137c746ab 100644 --- a/Doc/Manual/Contents.html +++ b/Doc/Manual/Contents.html @@ -1719,7 +1719,8 @@
  • Developer Information
  • Extending to Other Languages diff --git a/Doc/Manual/Doxygen.html b/Doc/Manual/Doxygen.html index 3178f70c2..cb79ef83c 100644 --- a/Doc/Manual/Doxygen.html +++ b/Doc/Manual/Doxygen.html @@ -32,7 +32,8 @@
  • Developer Information
  • Extending to Other Languages @@ -1282,7 +1283,7 @@ This module builds its own private parse tree and hands it to a separate class f For example, JavaDocConverter is the JavaDoc module class.

    -

    39.5.2 Debugging commands

    +

    39.5.2 Debugging Doxygen parser and translator

    @@ -1294,6 +1295,43 @@ There are two handy command line switches, that enable lots of detailed debug in -debug-doxygen-translator - Display Doxygen translator module debugging information +

    39.5.3 Tests

    + + +

    +This part of SWIG currently has 6 runtime tests in both Java and Python. +

    + +
    +  doxygen_parsing
    +  doxygen_translate
    +  doxygen_translate_all_tags
    +  doxygen_basic_translate
    +  doxygen_basic_notranslate
    +  doxygen_translate_links
    +
    + +

    +All this tests are included in common.mk and are build with the commands like 'make check-test-suite' +or 'make check-python-test-suite'. To run them individually, type 'make .cpptest -s' in the +language-specific subdir in Examples\test-suite. +
    +Runtime tests in Java are implemented using JavaDoc doclets. To make that work, you +should have tools.jar from the JDK in your classpath. Or you should have JAVA_HOME +environmental var defined and pointing to the JDK location. +
    +The Java's comment parsing code (the testing part) is located in commentParser.java. +You may see it to understand how the checking process works. There is also a possibility +to run that file as stand-alone program, with 'java commentParser ', +and it will print the list of comments found in the specified dir (in the format it's used +in runtime tests). So, when you want to create the new test of Doxygen comment translator, +just copy any existing one, and replace the actual comment content (section of entries in +form 'wantedComments.put(...)' with the output of the above command. +
    +Runtime tests in Python are just plain strings comparison with the use of __doc__ +properties. +

    +

    39.6 Extending to Other Languages

    From f7f3960d1126069aa2c7414b66dbf437879d3f5d Mon Sep 17 00:00:00 2001 From: Dmitry Kabak Date: Fri, 10 Aug 2012 12:27:40 +0000 Subject: [PATCH 127/314] Eliminate 'signed/unsigned comparison' compiler warning git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2012-doxygen@13582 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Source/DoxygenTranslator/src/PyDocConverter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/DoxygenTranslator/src/PyDocConverter.cpp b/Source/DoxygenTranslator/src/PyDocConverter.cpp index 0f1f32cbb..1826bcab5 100644 --- a/Source/DoxygenTranslator/src/PyDocConverter.cpp +++ b/Source/DoxygenTranslator/src/PyDocConverter.cpp @@ -230,7 +230,7 @@ void PyDocConverter::handleTagWrap(DoxygenEntity& tag, std::string& translatedCo if (tag.entityList.size()) { // do not include empty tags std::string tagData = translateSubtree(tag); // wrap the thing, ignoring whitespaces - int wsPos = tagData.find_last_not_of("\n\t "); + size_t wsPos = tagData.find_last_not_of("\n\t "); if (wsPos != std::string::npos) translatedComment += arg + tagData.substr(0, wsPos + 1) + arg + tagData.substr(wsPos + 1); else From 9600bb310f675b1462dd35e3cb074dfe388e3253 Mon Sep 17 00:00:00 2001 From: Dmitry Kabak Date: Fri, 10 Aug 2012 21:21:16 +0000 Subject: [PATCH 128/314] Improved unknown Doxygen commands handling git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2012-doxygen@13591 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Source/DoxygenTranslator/src/DoxygenParser.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Source/DoxygenTranslator/src/DoxygenParser.cpp b/Source/DoxygenTranslator/src/DoxygenParser.cpp index dd2e556eb..cffdd6b0d 100644 --- a/Source/DoxygenTranslator/src/DoxygenParser.cpp +++ b/Source/DoxygenTranslator/src/DoxygenParser.cpp @@ -701,7 +701,8 @@ std::list < DoxygenEntity > DoxygenParser::parse(std::list < Token >::iterator e if (currCommand < 0) { if (noisy) cout << "Unidentified Command " << currToken.tokenString << endl; - tokList.next(); + tokList.printListError("Unsupported command: " + currToken.tokenString + ". Ignored"); + tokList.current()->tokenType = PLAINSTRING; // little hack to add the command as plaintext addCommand(currPlainstringCommandType, tokList, aNewList); } else { tokList.next(); From 771c61f9f18bc1a8feb74d24ccffa7cd296232ae Mon Sep 17 00:00:00 2001 From: Dmitry Kabak Date: Sat, 11 Aug 2012 14:34:48 +0000 Subject: [PATCH 129/314] Renamed DoxygenComment to doxygen to better comply swig's attribute namings git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2012-doxygen@13597 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Source/CParse/parser.y | 14 +++++++------- Source/DoxygenTranslator/src/DoxygenTranslator.cpp | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Source/CParse/parser.y b/Source/CParse/parser.y index 27957d9ab..ddcdc5477 100644 --- a/Source/CParse/parser.y +++ b/Source/CParse/parser.y @@ -193,15 +193,15 @@ static void set_comment(Node *n, String *comment) { if (!n || !comment) return; - if (Getattr(n, "DoxygenComment")) - Append(Getattr(n, "DoxygenComment"), comment); + if (Getattr(n, "doxygen")) + Append(Getattr(n, "doxygen"), comment); else { - Setattr(n, "DoxygenComment", comment); + Setattr(n, "doxygen", comment); /* This is the first comment, populate it with @params, if any */ p = Getattr(n, "parms"); while (p) { - if (Getattr(p, "DoxygenComment")) - Printv(comment, "\n@param ", Getattr(p, "name"), Getattr(p, "DoxygenComment"), NIL); + if (Getattr(p, "doxygen")) + Printv(comment, "\n@param ", Getattr(p, "name"), Getattr(p, "doxygen"), NIL); p=nextSibling(p); } } @@ -212,7 +212,7 @@ static void set_comment(Node *n, String *comment) { return; n = nextSibling(n); while (n && Getattr(n, "name") && Strcmp(Getattr(n, "name"), name) == 0) { - Setattr(n, "DoxygenComment", comment); + Setattr(n, "doxygen", comment); n = nextSibling(n); } } @@ -3474,7 +3474,7 @@ doxygen_comment_item : DOXYGENSTRING { not translatable to javadoc anyway) */ if(0 && isStructuralDoxygen($1)){ $$ = new_node("doxycomm"); - Setattr($$,"DoxygenComment",$1); + set_comment($$, $1); } else { $$ = $1; diff --git a/Source/DoxygenTranslator/src/DoxygenTranslator.cpp b/Source/DoxygenTranslator/src/DoxygenTranslator.cpp index 51df52f59..d9bf5f059 100644 --- a/Source/DoxygenTranslator/src/DoxygenTranslator.cpp +++ b/Source/DoxygenTranslator/src/DoxygenTranslator.cpp @@ -25,7 +25,7 @@ bool DoxygenTranslator::hasDocumentation(Node *node) { } String *DoxygenTranslator::getDoxygenComment(Node *node) { - return Getattr(node, "DoxygenComment"); + return Getattr(node, "doxygen"); } From 3eed72b659b456613ba3b1c5e942833003a2247b Mon Sep 17 00:00:00 2001 From: Dmitry Kabak Date: Sat, 11 Aug 2012 15:23:18 +0000 Subject: [PATCH 130/314] Updated Doxygen warning system git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2012-doxygen@13598 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- .../DoxygenTranslator/src/DoxygenParser.cpp | 42 +++++++++---------- Source/DoxygenTranslator/src/TokenList.cpp | 8 ++-- Source/DoxygenTranslator/src/TokenList.h | 3 +- Source/Include/swigwarn.h | 8 ++++ 4 files changed, 36 insertions(+), 25 deletions(-) diff --git a/Source/DoxygenTranslator/src/DoxygenParser.cpp b/Source/DoxygenTranslator/src/DoxygenParser.cpp index cffdd6b0d..8be8660d7 100644 --- a/Source/DoxygenTranslator/src/DoxygenParser.cpp +++ b/Source/DoxygenTranslator/src/DoxygenParser.cpp @@ -174,7 +174,7 @@ std::string DoxygenParser::getStringTilEndCommand(std::string theCommand, TokenL tokList.next(); } - tokList.printListError(theCommand + " command expected"); + tokList.printListError(WARN_DOXYGEN_COMMAND_EXPECTED, theCommand + " command expected"); return description; } @@ -263,7 +263,7 @@ int DoxygenParser::addCommandWord(std::string theCommand, TokenList & tokList, s doxyList.push_back(DoxygenEntity(theCommand, aNewList)); return 1; } else - tokList.printListError("No word followed " + theCommand + " command. Not added"); + tokList.printListError(WARN_DOXYGEN_COMMAND_ERROR, "No word followed " + theCommand + " command. Not added"); return 0; } @@ -291,7 +291,7 @@ int DoxygenParser::addCommandEndCommand(std::string theCommand, TokenList & tokL cout << "Parsing " << theCommand << endl; std::list < Token >::iterator endCommand = getEndCommand("end" + theCommand, tokList); if (endCommand == tokList.end()) { - tokList.printListError("Expected end" + theCommand); + tokList.printListError(WARN_DOXYGEN_COMMAND_EXPECTED, "Expected end" + theCommand); return 0; } std::list < DoxygenEntity > aNewList; @@ -306,7 +306,7 @@ int DoxygenParser::addCommandWordParagraph(std::string theCommand, TokenList & t cout << "Parsing " << theCommand << endl; std::string name = getNextWord(tokList); if (name.empty()) { - tokList.printListError("No word followed " + theCommand + " command. Not added"); + tokList.printListError(WARN_DOXYGEN_COMMAND_ERROR, "No word followed " + theCommand + " command. Not added"); return 0; } std::list < Token >::iterator endOfParagraph = getEndOfParagraph(tokList); @@ -322,7 +322,7 @@ int DoxygenParser::addCommandWordLine(std::string theCommand, TokenList & tokLis cout << "Parsing " << theCommand << endl; std::string name = getNextWord(tokList); if (name.empty()) { - tokList.printListError("No word followed " + theCommand + " command. Not added"); + tokList.printListError(WARN_DOXYGEN_COMMAND_ERROR, "No word followed " + theCommand + " command. Not added"); return 0; } std::list < Token >::iterator endOfLine = getOneLine(tokList); @@ -339,7 +339,7 @@ int DoxygenParser::addCommandWordOWordOWord(std::string theCommand, TokenList & cout << "Parsing " << theCommand << endl; std::string name = getNextWord(tokList); if (name.empty()) { - tokList.printListError("No word followed " + theCommand + " command. Not added"); + tokList.printListError(WARN_DOXYGEN_COMMAND_ERROR, "No word followed " + theCommand + " command. Not added"); return 0; } std::string headerfile = getNextWord(tokList); @@ -365,7 +365,7 @@ int DoxygenParser::addCommandOWord(std::string theCommand, TokenList & tokList, } int DoxygenParser::addCommandErrorThrow(std::string theCommand, TokenList & tokList, std::list < DoxygenEntity > &) { - tokList.printListError("Encountered: " + theCommand + + tokList.printListError(WARN_DOXYGEN_COMMAND_ERROR, "Encountered: " + theCommand + "\nThis command should not have been encountered. Behaviour past this may be unpredictable"); std::list < Token >::iterator endOfLine = getOneLine(tokList); tokList.setIterator(endOfLine); @@ -387,17 +387,17 @@ int DoxygenParser::addCommandUnique(std::string theCommand, TokenList & tokList, cout << "Parsing " << theCommand << endl; std::string key = getNextWord(tokList); if (key.empty()) { - tokList.printListError("No key followed " + theCommand + " command. Not added"); + tokList.printListError(WARN_DOXYGEN_COMMAND_ERROR, "No key followed " + theCommand + " command. Not added"); return 0; } std::string heading = getNextWord(tokList); if (key.empty()) { - tokList.printListError("No heading followed " + theCommand + " command. Not added"); + tokList.printListError(WARN_DOXYGEN_COMMAND_ERROR, "No heading followed " + theCommand + " command. Not added"); return 0; } std::string title = getNextWord(tokList); if (title.empty()) { - tokList.printListError("No title followed " + theCommand + " command. Not added"); + tokList.printListError(WARN_DOXYGEN_COMMAND_ERROR, "No title followed " + theCommand + " command. Not added"); return 0; } std::list < Token >::iterator endOfParagraph = getEndOfParagraph(tokList); @@ -460,7 +460,7 @@ int DoxygenParser::addCommandUnique(std::string theCommand, TokenList & tokList, cout << "Parsing " << theCommand << endl; std::string name = getNextWord(tokList); if (name.empty()) { - tokList.printListError("No word followed " + theCommand + " command. Not added"); + tokList.printListError(WARN_DOXYGEN_COMMAND_ERROR, "No word followed " + theCommand + " command. Not added"); return 0; } std::list < DoxygenEntity > aNewList; @@ -477,7 +477,7 @@ int DoxygenParser::addCommandUnique(std::string theCommand, TokenList & tokList, cout << "Parsing " << theCommand << endl; std::string name = getNextWord(tokList); if (name.empty()) { - tokList.printListError("No key followed " + theCommand + " command. Not added"); + tokList.printListError(WARN_DOXYGEN_COMMAND_ERROR, "No key followed " + theCommand + " command. Not added"); return 0; } std::string text = getNextWord(tokList); @@ -492,7 +492,7 @@ int DoxygenParser::addCommandUnique(std::string theCommand, TokenList & tokList, cout << "Parsing " << theCommand << endl; std::string name = getNextWord(tokList); if (name.empty()) { - tokList.printListError("No name followed " + theCommand + " command. Not added"); + tokList.printListError(WARN_DOXYGEN_COMMAND_ERROR, "No name followed " + theCommand + " command. Not added"); return 0; } std::string text = getNextWord(tokList); @@ -541,7 +541,7 @@ int DoxygenParser::addCommandUnique(std::string theCommand, TokenList & tokList, cout << "Parsing " << theCommand << endl; std::string file = getNextWord(tokList); if (file.empty()) { - tokList.printListError("No file followed " + theCommand + " command. Not added"); + tokList.printListError(WARN_DOXYGEN_COMMAND_ERROR, "No file followed " + theCommand + " command. Not added"); return 0; } std::string caption = getNextWord(tokList); @@ -556,12 +556,12 @@ int DoxygenParser::addCommandUnique(std::string theCommand, TokenList & tokList, cout << "Parsing " << theCommand << endl; std::string format = getNextWord(tokList); if (format.empty()) { - tokList.printListError("No format followed " + theCommand + " command. Not added"); + tokList.printListError(WARN_DOXYGEN_COMMAND_ERROR, "No format followed " + theCommand + " command. Not added"); return 0; } std::string file = getNextWord(tokList); if (file.empty()) { - tokList.printListError("No name followed " + theCommand + " command. Not added"); + tokList.printListError(WARN_DOXYGEN_COMMAND_ERROR, "No name followed " + theCommand + " command. Not added"); return 0; } std::string caption = getNextWord(tokList); @@ -582,7 +582,7 @@ int DoxygenParser::addCommandUnique(std::string theCommand, TokenList & tokList, cout << "Parsing " << theCommand << endl; std::string name = getNextWord(tokList); if (name.empty()) { - tokList.printListError("No word followed " + theCommand + " command. Not added"); + tokList.printListError(WARN_DOXYGEN_COMMAND_ERROR, "No word followed " + theCommand + " command. Not added"); return 0; } std::list < DoxygenEntity > aNewList; @@ -605,7 +605,7 @@ int DoxygenParser::addCommandUnique(std::string theCommand, TokenList & tokList, if (needsCond) { cond = getNextWord(tokList); if (cond.empty()) { - tokList.printListError("No word followed " + theCommand + " command. Not added"); + tokList.printListError(WARN_DOXYGEN_COMMAND_ERROR, "No word followed " + theCommand + " command. Not added"); return 0; } } @@ -633,7 +633,7 @@ int DoxygenParser::addCommandUnique(std::string theCommand, TokenList & tokList, } if (endCommand == tokList.end()) { - tokList.printListError("No corresponding endif found"); + tokList.printListError(WARN_DOXYGEN_COMMAND_EXPECTED, "No corresponding endif found"); return 0; } @@ -701,7 +701,7 @@ std::list < DoxygenEntity > DoxygenParser::parse(std::list < Token >::iterator e if (currCommand < 0) { if (noisy) cout << "Unidentified Command " << currToken.tokenString << endl; - tokList.printListError("Unsupported command: " + currToken.tokenString + ". Ignored"); + tokList.printListError(WARN_DOXYGEN_UNKNOWN_COMMAND, "Unsupported command: '" + currToken.tokenString + "'. Ignored"); tokList.current()->tokenType = PLAINSTRING; // little hack to add the command as plaintext addCommand(currPlainstringCommandType, tokList, aNewList); } else { @@ -714,7 +714,7 @@ std::list < DoxygenEntity > DoxygenParser::parse(std::list < Token >::iterator e if (endParsingIndex != tokList.end() && tokList.current() == tokList.end()) { // this could happen if we cant reach the original endParsingIndex - tokList.printListError("Unexpected end of comment encountered"); + tokList.printListError(WARN_DOXYGEN_UNEXPECTED_END_OF_COMMENT, "Unexpected end of comment encountered"); break; } } diff --git a/Source/DoxygenTranslator/src/TokenList.cpp b/Source/DoxygenTranslator/src/TokenList.cpp index d69721e9a..037518263 100644 --- a/Source/DoxygenTranslator/src/TokenList.cpp +++ b/Source/DoxygenTranslator/src/TokenList.cpp @@ -42,8 +42,10 @@ TokenList TokenList::tokenizeDoxygenComment(const std::string &doxygenComment, c else if (prevChar == '\\' || prevChar == '@') { // it's a doxygen command // hack to get commands like \\ or \@ or @\ or @@ - if (doxygenComment[pos] == '@' || doxygenComment[pos] == '\\') + if (doxygenComment[pos] == '@' || doxygenComment[pos] == '\\') { currentWord += doxygenComment[pos]; + pos++; + } tokList.m_tokenList.push_back(Token(COMMAND, currentWord)); } else if (currentWord.size() && (currentWord[0] == '!' || currentWord[0] == '*' || currentWord[0] == '/')) { @@ -133,10 +135,10 @@ void TokenList::printList() { } } -void TokenList::printListError(std::string message) { +void TokenList::printListError(int warningType, std::string message) { int curLine = fileLine; for (list< Token >::iterator it = m_tokenList.begin(); it != current(); it++) if (it->tokenType == END_LINE) curLine++; - Swig_error(fileName.c_str(), curLine, "Doxygen parser error: %s. \n", message.c_str()); + Swig_warning(warningType, fileName.c_str(), curLine, "Doxygen parser warning: %s. \n", message.c_str()); } diff --git a/Source/DoxygenTranslator/src/TokenList.h b/Source/DoxygenTranslator/src/TokenList.h index ce9d14c45..69580f11c 100644 --- a/Source/DoxygenTranslator/src/TokenList.h +++ b/Source/DoxygenTranslator/src/TokenList.h @@ -16,6 +16,7 @@ #include #include #include "Token.h" +#include "swigwarn.h" /* a small class used to represent the sequence of tokens * that can be derived from a formatted doxygen string @@ -43,7 +44,7 @@ public: void setIterator(list < Token >::iterator newPosition); /*moves up the iterator */ void printList(); /* prints out the sequence of tokens */ - void printListError(std::string message); /* prints properly formatted error message */ + void printListError(int warningType, std::string message); /* prints properly formatted error message */ /* * Create TokenList and populate it with tokens from diff --git a/Source/Include/swigwarn.h b/Source/Include/swigwarn.h index 1aae86fdd..68f35e02f 100644 --- a/Source/Include/swigwarn.h +++ b/Source/Include/swigwarn.h @@ -221,6 +221,14 @@ /* please leave 700-719 free for D */ +#define WARN_DOXYGEN_UNKNOWN_COMMAND 720 +#define WARN_DOXYGEN_UNEXPECTED_END_OF_COMMENT 721 +#define WARN_DOXYGEN_COMMAND_EXPECTED 722 +#define WARN_DOXYGEN_UNTERMINATED_STRING 723 +#define WARN_DOXYGEN_COMMAND_ERROR 724 + +/* please leave 720-729 free for Doxygen */ + #define WARN_RUBY_WRONG_NAME 801 #define WARN_RUBY_MULTIPLE_INHERITANCE 802 From c592e0db5126796221d83bd9b7e68fa68088cdef Mon Sep 17 00:00:00 2001 From: Dmitry Kabak Date: Mon, 13 Aug 2012 09:09:25 +0000 Subject: [PATCH 131/314] Made doxygen parsing switched off by default git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2012-doxygen@13602 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Examples/test-suite/common.mk | 2 +- Source/CParse/cscanner.c | 2 +- Source/Modules/java.cxx | 9 ++------- Source/Modules/python.cxx | 9 ++------- 4 files changed, 6 insertions(+), 16 deletions(-) diff --git a/Examples/test-suite/common.mk b/Examples/test-suite/common.mk index 86e33037a..e7f757f0e 100644 --- a/Examples/test-suite/common.mk +++ b/Examples/test-suite/common.mk @@ -64,7 +64,7 @@ CXXSRCS = CSRCS = TARGETPREFIX = TARGETSUFFIX = -SWIGOPT = -outcurrentdir -I$(top_srcdir)/$(EXAMPLES)/$(TEST_SUITE) +SWIGOPT = -doxygen -outcurrentdir -I$(top_srcdir)/$(EXAMPLES)/$(TEST_SUITE) INCLUDES = -I$(top_srcdir)/$(EXAMPLES)/$(TEST_SUITE) LIBS = -L. LIBPREFIX = lib diff --git a/Source/CParse/cscanner.c b/Source/CParse/cscanner.c index e15201b93..fb5754856 100644 --- a/Source/CParse/cscanner.c +++ b/Source/CParse/cscanner.c @@ -47,7 +47,7 @@ static int last_id = 0; static int rename_active = 0; /* Doxygen comments scanning */ -int scan_doxygen_comments = 1; +int scan_doxygen_comments = 0; /* ----------------------------------------------------------------------------- * Swig_cparse_cplusplus() diff --git a/Source/Modules/java.cxx b/Source/Modules/java.cxx index 3591b7363..910d481ab 100644 --- a/Source/Modules/java.cxx +++ b/Source/Modules/java.cxx @@ -123,7 +123,7 @@ public: global_variable_flag(false), old_variable_names(false), member_func_flag(false), - doxygen(true), + doxygen(false), comment_creation_chatter(false), imclass_name(NULL), module_class_name(NULL), @@ -267,10 +267,6 @@ public: Swig_mark_arg(i); doxygen = true; scan_doxygen_comments = true; - } else if ((strcmp(argv[i], "-nodoxygen") == 0)) { - Swig_mark_arg(i); - doxygen = false; - scan_doxygen_comments = false; } else if ((strcmp(argv[i], "-debug-doxygen-translator") == 0)) { Swig_mark_arg(i); debug_doxygen_translator = true; @@ -4541,8 +4537,7 @@ extern "C" Language *swig_java(void) { const char *JAVA::usage = (char *) "\ Java Options (available with -java)\n\ - -doxygen - Convert C++ doxygen comments to JavaDoc comments in proxy classes (default)\n\ - -nodoxygen - Don't convert C++ doxygen comments to JavaDoc comments in proxy classes\n\ + -doxygen - Convert C++ doxygen comments to JavaDoc comments in proxy classes\n\ -debug-doxygen-parser - Display doxygen parser module debugging information\n\ -debug-doxygen-translator - Display doxygen translator module debugging information\n\ -nopgcpp - Suppress premature garbage collection prevention parameter\n\ diff --git a/Source/Modules/python.cxx b/Source/Modules/python.cxx index f7c9c00c1..1d2096c81 100644 --- a/Source/Modules/python.cxx +++ b/Source/Modules/python.cxx @@ -85,7 +85,7 @@ static int buildnone = 0; static int nobuildnone = 0; static int safecstrings = 0; static int dirvtable = 0; -static int doxygen = 1; +static int doxygen = 0; static int proxydel = 1; static int fastunpack = 0; static int fastproxy = 0; @@ -120,7 +120,7 @@ Python Options (available with -python)\n\ -classptr - Generate shadow 'ClassPtr' as in older swig versions\n\ -cppcast - Enable C++ casting operators (default) \n\ -dirvtable - Generate a pseudo virtual table for directors for faster dispatch \n\ - -doxygen - Convert C++ doxygen comments to pydoc comments in proxy classes (default) \n\ + -doxygen - Convert C++ doxygen comments to pydoc comments in proxy classes \n\ -debug-doxygen-parser - Display doxygen parser module debugging information\n\ -debug-doxygen-translator - Display doxygen translator module debugging information\n\ -extranative - Return extra native C++ wraps for std containers when possible \n\ @@ -141,7 +141,6 @@ static const char *usage2 = (char *) "\ -nocastmode - Disable the casting mode (default)\n\ -nocppcast - Disable C++ casting operators, useful for generating bugs\n\ -nodirvtable - Don't use the virtual table feature, resolve the python method each time (default)\n\ - -nodoxygen - Don't convert C++ doxygen comments to pydoc comments in proxy classes \n\ -noexcept - No automatic exception handling\n\ -noextranative - Don't use extra native C++ wraps for std containers when possible (default) \n\ -nofastinit - Use traditional init mechanism for classes \n\ @@ -431,10 +430,6 @@ public: doxygen = 1; scan_doxygen_comments = 1; Swig_mark_arg(i); - } else if (strcmp(argv[i], "-nodoxygen") == 0) { - doxygen = 0; - scan_doxygen_comments = 0; - Swig_mark_arg(i); } else if (strcmp(argv[i], "-debug-doxygen-translator") == 0) { debug_doxygen_translator = true; Swig_mark_arg(i); From a9cdb000bac276c5750fa785a8e230a757dd4d8a Mon Sep 17 00:00:00 2001 From: Dmitry Kabak Date: Thu, 16 Aug 2012 11:35:02 +0000 Subject: [PATCH 132/314] Made swig strip out all structural comments git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2012-doxygen@13622 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Source/CParse/parser.y | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/Source/CParse/parser.y b/Source/CParse/parser.y index ddcdc5477..24c1842c0 100644 --- a/Source/CParse/parser.y +++ b/Source/CParse/parser.y @@ -3469,19 +3469,18 @@ doxygen_comment_item : DOXYGENSTRING { DohReplace($1, "//!", "", 0); DohReplace($1, "*/", "", 0); - /* isStructuralDoxygen() is disabled, since no comment - appears in such case. Need to fix. (most commands are - not translatable to javadoc anyway) */ - if(0 && isStructuralDoxygen($1)){ - $$ = new_node("doxycomm"); - set_comment($$, $1); - } - else { - $$ = $1; + /* Throw out all structural comments */ + if (isStructuralDoxygen($1)) { + Delete($1); + $1 = 0; } + $$ = $1; } | doxygen_comment_item doxygen_comment_item { - Append($1, $2); + if ($1) + Append($1, $2); + else + $1 = $2; $$ = $1; } ; From 40ce1b412ad7d038e9e114ad94049ffe5faad7aa Mon Sep 17 00:00:00 2001 From: Dmitry Kabak Date: Thu, 16 Aug 2012 14:16:59 +0000 Subject: [PATCH 133/314] Now commands with no whitespace following them are also parsed git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2012-doxygen@13632 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Source/DoxygenTranslator/src/TokenList.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Source/DoxygenTranslator/src/TokenList.cpp b/Source/DoxygenTranslator/src/TokenList.cpp index 037518263..ceea0ba17 100644 --- a/Source/DoxygenTranslator/src/TokenList.cpp +++ b/Source/DoxygenTranslator/src/TokenList.cpp @@ -46,6 +46,14 @@ TokenList TokenList::tokenizeDoxygenComment(const std::string &doxygenComment, c currentWord += doxygenComment[pos]; pos++; } + // also strip the command till the first nonalpha char + for (int i=2; i Date: Thu, 16 Aug 2012 14:18:47 +0000 Subject: [PATCH 134/314] Fixed lots of PyDoc converter problems, see doxygen_tricky_constructs test git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2012-doxygen@13633 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- .../test-suite/doxygen_tricky_constructs.i | 106 +++++++++++++ .../doxygen_translate_all_tags_runme.py | 145 +----------------- .../python/doxygen_translate_runme.py | 6 +- .../DoxygenTranslator/src/PyDocConverter.cpp | 62 +++++++- Source/DoxygenTranslator/src/PyDocConverter.h | 4 + 5 files changed, 169 insertions(+), 154 deletions(-) create mode 100644 Examples/test-suite/doxygen_tricky_constructs.i diff --git a/Examples/test-suite/doxygen_tricky_constructs.i b/Examples/test-suite/doxygen_tricky_constructs.i new file mode 100644 index 000000000..96b1dfae3 --- /dev/null +++ b/Examples/test-suite/doxygen_tricky_constructs.i @@ -0,0 +1,106 @@ +# This file contains tests for situations, which do not normally +# appear in the code, but must neverthless be handled correctly. + +%module doxygen_tricky_constructs + +%inline %{ + + # Bug 1: Tag '@endink' is not recognized becuse it is not + # followed by whitespace. + + /** + * Tag endlink must be recognized also when followed by nonspace charater. + * + * @link Connection::getId() @endlink
    + */ + char g_counter; + + + /** + * Tag endlink must be recognized also when it is the last token + * in the commment. + * + * @link Connection::getId() @endlink
    + * @link debugIdeTraceProfilerCoverageSample.py Python example. @endlink + */ + int g_zipCode; + + + # Bug 2: Paramter 'isReportSize' is missing in comment of the overload, which + # has it. This bug disappears if @endlink is follwed by a space. + # + # Bug 3: Empty line before the link is missing, + # making the link text part of parameter description. This bug appears also + # when there is ordinary text in place of the link in case of overload + # with only 2 parameters. + /** + * Returns address of file line. + * + * @param fileName name of the file, where the source line is located + * @param line line number + * @param isGetSize if set, for every object location both address and size are returned + * + * @link Connection::getId() @endlink
    + */ + std::vector getAddress(const std::string &fileName, + int line, + bool isGetSize = false); + + # Bug 4: The first comment is attached to the second in Python (wrong), + # but not in Java (correct). + /** + * \defgroup icFacade isystem.connect Facade + * + * This page shows the core classes, which can be used to control + * all aspects of winIDEA, for example: debugging, analyzers, IO module, ... + */ + + /** + * This class contains information for connection to winIDEA. Its methods + * return reference to self, so we can use it like this: + *
    +     * CConnectionConfig config = new CConnectionConfig();
    +     * config.discoveryPort(5534).dllPath("C:\\myWinIDEA\\connect.dll").id("main");
    +     * 
    + * + * All parameters are optional. Set only what is required, default values are + * used for unspecified parameters. + *

    + * + * @link advancedWinIDEALaunching.py Python example. @endlink
    + */ + class CConnectionConfig + { + }; + + # Bug 5: Text after '\c' has no space following in Python. + # There are also to many empty lines in multiline comments in Python. + # Whitespaces are really a problem in Python (space and newlines), + # I like a parameter type added to each parameter description! + # """ + # Determines how long the isystem.connectshould wait for running + # + # instances to respond. Only one of lfWaitXXXflags from IConnect::ELaunchFlags + # + # may be specified. + # + # """ + + /** + * Determines how long the \c isystem.connect should wait for running + * instances to respond. Only one of \c lfWaitXXX flags from IConnect::ELaunchFlags + * may be specified. + */ + int waitTime(long waitTime); + + + # Bug 6: Text after tag \ingroup appears in Python comment (empty line in + # Java, which is acceptable): + /** \ingroup icFacade + * + * This class manages connection. + */ + int getConnection(); + + +%} diff --git a/Examples/test-suite/python/doxygen_translate_all_tags_runme.py b/Examples/test-suite/python/doxygen_translate_all_tags_runme.py index e1d7a33b7..f71cb7e11 100644 --- a/Examples/test-suite/python/doxygen_translate_all_tags_runme.py +++ b/Examples/test-suite/python/doxygen_translate_all_tags_runme.py @@ -19,12 +19,6 @@ def check(got, expected): check(doxygen_translate_all_tags.function.__doc__, '' ' _Hello_' '' -' SomeLatexIndex ' -'' -' someGroup"Some title" ' -'' -' theAnchor' -'' ' -some list item ' '' ' This is attention! ' @@ -44,60 +38,29 @@ check(doxygen_translate_all_tags.function.__doc__, '' '' ' codeword' '' -' someCategoryheaderFile.hheaderName' -'' ' \'citationword\'' '' -' someClassheaderFile.hheaderName' -'' ' some test code ' '' ' Conditional comment: SOMECONDITION' ' Some conditional comment ' ' End of conditional comment.' '' -' someClass::someMethod' -'' -' someClass::someMethod2' -'' -' someClass::someMethod3' -'' ' Copyright:' ' some copyright ' '' ' 1970 - 2012 ' '' -' someDefine' -'' -' someGroupSome titles ' -'' ' Deprecated:' ' Now use another function ' '' ' This is very large ' ' and detailed description of some thing ' '' -' /somePath/someFolder' -'' -' someFile.h' -'' -' digraph example { ' -' node [shape=record, fontname=Helvetica, fontsize=10]; ' -'' -' b [ label="class B" URL=" B"]; ' -' c [ label="class C" URL=" C"]; ' -' b -> c [ arrowhead="open", style="dashed" ]; ' -' } ' -'' -'' -' dotFile.dotThe caption' -'' ' _italicword_' '' ' emphazedWord' '' -' someEnum' -'' ' Example:' ' someFile.txt' ' Some details on using the example ' @@ -105,16 +68,6 @@ check(doxygen_translate_all_tags.function.__doc__, '' ' Throws:' ' SuperError' '' -' someOtherFunction' -'' -' file.h' -'' -' someFn ' -'' -' someHeader.hHeader name' -'' -' htmlFile.htm' -'' ' This will only appear in hmtl ' '' ' If: ANOTHERCONDITION {' @@ -135,21 +88,11 @@ check(doxygen_translate_all_tags.function.__doc__, '' ' This is printed if not ' ' }' '' -' Image: htmltestImage.bmpHello, world!asd=10qwe' -'' -' someFunction' -'' -' header.h' -'' -' header2.h' -'' -' someGroupanotherGroup' +' Image: testImage.bmp(Hello, world!)' '' ' Some text ' ' describing invariant. ' '' -' someInterfacesomeHeader.hHeader name' -'' ' This will only appear in LATeX ' '' '

      ' @@ -160,28 +103,10 @@ check(doxygen_translate_all_tags.function.__doc__, '' '' '
    ' '' -' example ' -'' ' someMember Some description follows ' '' -' Sometitle ' -'' ' This will only appear in man ' '' -' someThing' -'' -' Sender,Receiver; ' -' Sender->Receiver [label="Command()", URL=" ' -' Receiver::Command()"]; ' -' Sender<-Receiver [label="Ack()", URL=" ' -' Ack()", ID="1"]; ' -'' -' mscFile.mscThe caption' -'' -' someHeader.h ' -'' -' someNamespace' -'' ' Notes:' ' Here ' ' is the note! ' @@ -191,37 +116,13 @@ check(doxygen_translate_all_tags.function.__doc__, '' '' ' someword' '' -' superPackage' -'' -' somePageThe title ' -'' ' Title: The paragraph title ' ' The paragraph text. ' ' Maybe even multiline ' '' -' someParagraphParagraph title ' -'' ' Arguments:' ' a (int) -- the first param ' '' -' Some description ' -'' -' Some description ' -'' -' someVar ' -'' -' someProtocolheader.hHeader name' -'' -' someAnchor' -'' -' toSomething' -'' -' toSomethingElse' -'' -' someName' -'' -' someName' -'' ' Remarks:' ' Some remark text ' '' @@ -234,47 +135,20 @@ check(doxygen_translate_all_tags.function.__doc__, '' '' ' may return ' '' -' someValueSome description ' -'' -'' ' This will only appear in RTF ' '' '' ' See also:' ' someOtherMethod ' '' -' someSectionSome title ' -'' ' function ' '' ' Same as ' ' brief description ' '' -'' -'' ' Since:' ' version 0.0.0.1 ' '' -' somePattern ' -'' -' someLine ' -'' -' example.hSome snippet ' -'' -' someStruct' -'' -' someSubpageSome description' -'' -' someSubsectionSome title ' -'' -' someSubsectionSome title ' -'' -'' -'' -' Some ' -' description of the ' -' test case ' -'' ' Throws:' ' superException' '' @@ -286,34 +160,17 @@ check(doxygen_translate_all_tags.function.__doc__, '' ' Arguments:' ' b (float) -- B is mentioned again... ' '' -' someTypedef ' -'' -' someUnion' -'' -' somePattern ' -'' -' someVar ' -'' -'' ' very long ' ' text with tags ' '' -'' -' someFile.h' -'' ' Version:' ' 0.0.0.2 ' '' ' Warning:' ' This is senseless! ' '' -' someGroupSome title ' -'' -'' ' This will only appear in XML ' '' -' todo"Todo"Todo List' -'' ' Here goes test of symbols: ' ' $@\&~<>#%".::' '' diff --git a/Examples/test-suite/python/doxygen_translate_runme.py b/Examples/test-suite/python/doxygen_translate_runme.py index 61e5f5398..e7d819199 100644 --- a/Examples/test-suite/python/doxygen_translate_runme.py +++ b/Examples/test-suite/python/doxygen_translate_runme.py @@ -71,7 +71,7 @@ check(doxygen_translate.function.__doc__, '' ' This is printed if not ' ' }' '' -' Image: htmltestImage.bmpHello, world!asd=10qwe' +' Image: testImage.bmp(Hello, world!)' '' ' -

    42.10.14 Prerequisites for adding a new language module to the SWIG distribution

    +

    43.10.14 Prerequisites for adding a new language module to the SWIG distribution

    @@ -3588,7 +3588,7 @@ should be added should there be an area not already covered by the existing tests.

    -

    42.10.15 Coding style guidelines

    +

    43.10.15 Coding style guidelines

    @@ -3612,7 +3612,7 @@ The generated C/C++ code should also follow this style as close as possible. How should be avoided as unlike the SWIG developers, users will never have consistent tab settings.

    -

    42.11 Debugging Options

    +

    43.11 Debugging Options

    @@ -3639,7 +3639,7 @@ There are various command line options which can aid debugging a SWIG interface The complete list of command line options for SWIG are available by running swig -help.

    -

    42.12 Guide to parse tree nodes

    +

    43.12 Guide to parse tree nodes

    @@ -4047,7 +4047,7 @@ extern "X" { ... } declaration. -

    42.13 Further Development Information

    +

    43.13 Further Development Information

    diff --git a/Doc/Manual/Go.html b/Doc/Manual/Go.html index 432f932ad..750a62514 100644 --- a/Doc/Manual/Go.html +++ b/Doc/Manual/Go.html @@ -6,7 +6,7 @@ -

    24 SWIG and Go

    +

    25 SWIG and Go

    -

    24.3.1 Go-specific Commandline Options

    +

    25.3.1 Go-specific Commandline Options

    @@ -264,7 +264,7 @@ swig -go -help -

    24.3.2 Generated Wrapper Files

    +

    25.3.2 Generated Wrapper Files

    There are two different approaches to generating wrapper files, @@ -308,7 +308,7 @@ combined with the compiled MODULE.go using go tool pack. -

    24.4 A tour of basic C/C++ wrapping

    +

    25.4 A tour of basic C/C++ wrapping

    @@ -318,7 +318,7 @@ modifications have to occur. This section briefly covers the essential aspects of this wrapping.

    -

    24.4.1 Go Package Name

    +

    25.4.1 Go Package Name

    @@ -328,7 +328,7 @@ directive. You may override this by using SWIG's -package command line option.

    -

    24.4.2 Go Names

    +

    25.4.2 Go Names

    @@ -360,7 +360,7 @@ followed by that name, and the destructor will be named Delete followed by that name.

    -

    24.4.3 Go Constants

    +

    25.4.3 Go Constants

    @@ -368,7 +368,7 @@ C/C++ constants created via #define or the %constant directive become Go constants, declared with a const declaration. -

    24.4.4 Go Enumerations

    +

    25.4.4 Go Enumerations

    @@ -378,7 +378,7 @@ usual). The values of the enumeration will become variables in Go; code should avoid modifying those variables.

    -

    24.4.5 Go Classes

    +

    25.4.5 Go Classes

    @@ -456,7 +456,7 @@ returns a go interface. If the returned pointer can be null, you can check for this by calling the Swigcptr() method.

    -

    24.4.5.1 Go Class Memory Management

    +

    25.4.5.1 Go Class Memory Management

    @@ -578,7 +578,7 @@ func (o *GoClassName) Close() { -

    24.4.5.2 Go Class Inheritance

    +

    25.4.5.2 Go Class Inheritance

    @@ -590,7 +590,7 @@ Doing the reverse will require an explicit type assertion, which will be checked dynamically.

    -

    24.4.6 Go Templates

    +

    25.4.6 Go Templates

    @@ -599,7 +599,7 @@ wrappers for a particular template instantation. To do this, use the %template directive. -

    24.4.7 Go Director Classes

    +

    25.4.7 Go Director Classes

    @@ -617,7 +617,7 @@ completely to avoid common pitfalls with directors in Go.

    -

    24.4.7.1 Example C++ code

    +

    25.4.7.1 Example C++ code

    @@ -689,7 +689,7 @@ be found in the end of the guide.

    -

    24.4.7.2 Enable director feature

    +

    25.4.7.2 Enable director feature

    @@ -724,7 +724,7 @@ documentation on directors.

    -

    24.4.7.3 Constructor and destructor

    +

    25.4.7.3 Constructor and destructor

    @@ -777,7 +777,7 @@ embedding.

    -

    24.4.7.4 Override virtual methods

    +

    25.4.7.4 Override virtual methods

    @@ -843,7 +843,7 @@ the Go methods.

    -

    24.4.7.5 Call base methods

    +

    25.4.7.5 Call base methods

    @@ -880,7 +880,7 @@ be found in the end of the guide.

    -

    24.4.7.6 Subclass via embedding

    +

    25.4.7.6 Subclass via embedding

    @@ -948,7 +948,7 @@ class.

    -

    24.4.7.7 Memory management with runtime.SetFinalizer

    +

    25.4.7.7 Memory management with runtime.SetFinalizer

    @@ -1013,7 +1013,7 @@ before using runtime.SetFinalizer to know all of its gotchas.

    -

    24.4.7.8 Complete FooBarGo example class

    +

    25.4.7.8 Complete FooBarGo example class

    @@ -1142,7 +1142,7 @@ SWIG/Examples/go/director/.

    -

    24.4.8 Default Go primitive type mappings

    +

    25.4.8 Default Go primitive type mappings

    @@ -1249,7 +1249,7 @@ that typemap, or add new values, to control how C/C++ types are mapped into Go types.

    -

    24.4.9 Output arguments

    +

    25.4.9 Output arguments

    Because of limitations in the way output arguments are processed in swig, @@ -1302,7 +1302,7 @@ void f(char *output); -

    24.4.10 Adding additional go code

    +

    25.4.10 Adding additional go code

    Often the APIs generated by swig are not very natural in go, especially if @@ -1397,7 +1397,7 @@ func bar() { -

    24.4.11 Go typemaps

    +

    25.4.11 Go typemaps

    diff --git a/Doc/Manual/Guile.html b/Doc/Manual/Guile.html index 31d822599..9d55b632b 100644 --- a/Doc/Manual/Guile.html +++ b/Doc/Manual/Guile.html @@ -8,7 +8,7 @@ -

    25 SWIG and Guile

    +

    26 SWIG and Guile

      @@ -48,7 +48,7 @@

      This section details guile-specific support in SWIG. -

      25.1 Supported Guile Versions

      +

      26.1 Supported Guile Versions

      @@ -62,7 +62,7 @@ improved performance. This is currently not tested with swig so your mileage may vary. To be safe set environment variable GUILE_AUTO_COMPILE to 0 when using swig generated guile code. -

      25.2 Meaning of "Module"

      +

      26.2 Meaning of "Module"

      @@ -70,7 +70,7 @@ There are three different concepts of "module" involved, defined separately for SWIG, Guile, and Libtool. To avoid horrible confusion, we explicitly prefix the context, e.g., "guile-module". -

      25.3 Old GH Guile API

      +

      26.3 Old GH Guile API

      Guile 1.8 and older could be interfaced using two different api's, the SCM @@ -81,7 +81,7 @@ or the GH API. The GH interface to guile is deprecated. Read more about why in version of SWIG that can still generate guile GH wrapper code is 2.0.9. Please use that version if you really need the GH wrapper code. -

      25.4 Linkage

      +

      26.4 Linkage

      @@ -89,7 +89,7 @@ Guile support is complicated by a lack of user community cohesiveness, which manifests in multiple shared-library usage conventions. A set of policies implementing a usage convention is called a linkage. -

      25.4.1 Simple Linkage

      +

      26.4.1 Simple Linkage

      @@ -194,7 +194,7 @@ placed between the define-module form and the SWIG_init via a preprocessor define to avoid symbol clashes. For this case, however, passive linkage is available. -

      25.4.2 Passive Linkage

      +

      26.4.2 Passive Linkage

      Passive linkage is just like simple linkage, but it generates an @@ -204,7 +204,7 @@ package name (see below).

      You should use passive linkage rather than simple linkage when you are using multiple modules. -

      25.4.3 Native Guile Module Linkage

      +

      26.4.3 Native Guile Module Linkage

      SWIG can also generate wrapper code that does all the Guile module @@ -245,7 +245,7 @@ Newer Guile versions have a shorthand procedure for this:

    -

    25.4.4 Old Auto-Loading Guile Module Linkage

    +

    26.4.4 Old Auto-Loading Guile Module Linkage

    Guile used to support an autoloading facility for object-code @@ -271,7 +271,7 @@ option, SWIG generates an exported module initialization function with an appropriate name. -

    25.4.5 Hobbit4D Linkage

    +

    26.4.5 Hobbit4D Linkage

    @@ -296,7 +296,7 @@ my/lib/libfoo.so.X.Y.Z and friends. This scheme is still very experimental; the (hobbit4d link) conventions are not well understood.

    -

    25.5 Underscore Folding

    +

    26.5 Underscore Folding

    @@ -308,7 +308,7 @@ complained so far. %rename to specify the Guile name of the wrapped functions and variables (see CHANGES). -

    25.6 Typemaps

    +

    26.6 Typemaps

    @@ -400,7 +400,7 @@ constant will appear as a scheme variable. See Features and the %feature directive for info on how to apply the %feature.

    -

    25.7 Representation of pointers as smobs

    +

    26.7 Representation of pointers as smobs

    @@ -421,7 +421,7 @@ representing the expected pointer type. See also If the Scheme object passed was not a SWIG smob representing a compatible pointer, a wrong-type-arg exception is raised. -

    25.7.1 Smobs

    +

    26.7.1 Smobs

    @@ -440,7 +440,7 @@ structure describing this type. If a generated GOOPS module has been loaded, sm the corresponding GOOPS class.

    -

    25.7.2 Garbage Collection

    +

    26.7.2 Garbage Collection

    Garbage collection is a feature of Guile since version 1.6. As SWIG now requires Guile > 1.8, @@ -454,14 +454,14 @@ is exactly like described in 25.8 Native Guile pointers +

    26.8 Native Guile pointers

    In addition to SWIG smob pointers, Guile's native pointer type are accepted as arguments to wrapped SWIG functions. This can be useful for passing pointers to bytevector data to wrapped functions.

    -

    25.9 Exception Handling

    +

    26.9 Exception Handling

    @@ -487,7 +487,7 @@ mapping: The default when not specified here is to use "swig-error". See Lib/exception.i for details. -

    25.10 Procedure documentation

    +

    26.10 Procedure documentation

    If invoked with the command-line option -procdoc @@ -522,7 +522,7 @@ like this: typemap argument doc. See Lib/guile/typemaps.i for details. -

    25.11 Procedures with setters

    +

    26.11 Procedures with setters

    For global variables, SWIG creates a single wrapper procedure @@ -550,7 +550,7 @@ struct members, the procedures (struct-member-get pointer) and (struct-member-set pointer value) are not generated. -

    25.12 GOOPS Proxy Classes

    +

    26.12 GOOPS Proxy Classes

    SWIG can also generate classes and generic functions for use with @@ -696,7 +696,7 @@ Notice that <Foo> is used before it is defined. The fix is to just put th %import "foo.h" before the %inline block.

    -

    25.12.1 Naming Issues

    +

    26.12.1 Naming Issues

    As you can see in the example above, there are potential naming conflicts. The default exported @@ -733,7 +733,7 @@ guile-modules. For example,

    (use-modules ((Test) #:renamer (symbol-prefix-proc 'goops:))) -

    25.12.2 Linking

    +

    26.12.2 Linking

    The guile-modules generated above all need to be linked together. GOOPS support requires diff --git a/Doc/Manual/Java.html b/Doc/Manual/Java.html index 9dfaa1fd4..f1ca6667e 100644 --- a/Doc/Manual/Java.html +++ b/Doc/Manual/Java.html @@ -6,7 +6,7 @@ -

    26 SWIG and Java

    +

    27 SWIG and Java

    -

    26.3.3 Global variables

    +

    27.3.3 Global variables

    @@ -816,7 +816,7 @@ extern char *path; // Read-only (due to %immutable) -

    26.3.4 Constants

    +

    27.3.4 Constants

    @@ -956,7 +956,7 @@ Or if you decide this practice isn't so bad and your own class implements ex

    -

    26.3.5 Enumerations

    +

    27.3.5 Enumerations

    @@ -970,7 +970,7 @@ The final two approaches use simple integers for each enum item. Before looking at the various approaches for wrapping named C/C++ enums, anonymous enums are considered.

    -

    26.3.5.1 Anonymous enums

    +

    27.3.5.1 Anonymous enums

    @@ -1033,7 +1033,7 @@ As in the case of constants, you can access them through either the module class

    -

    26.3.5.2 Typesafe enums

    +

    27.3.5.2 Typesafe enums

    @@ -1127,7 +1127,7 @@ When upgrading to JDK 1.5 or later, proper Java enums could be used instead, wit The following section details proper Java enum generation.

    -

    26.3.5.3 Proper Java enums

    +

    27.3.5.3 Proper Java enums

    @@ -1180,7 +1180,7 @@ The additional support methods need not be generated if none of the enum items h Simpler Java enums for enums without initializers section.

    -

    26.3.5.4 Type unsafe enums

    +

    27.3.5.4 Type unsafe enums

    @@ -1228,7 +1228,7 @@ Note that unlike typesafe enums, this approach requires users to mostly use diff Thus the upgrade path to proper enums provided in JDK 1.5 is more painful.

    -

    26.3.5.5 Simple enums

    +

    27.3.5.5 Simple enums

    @@ -1247,7 +1247,7 @@ SWIG-1.3.21 and earlier versions wrapped all enums using this approach. The type unsafe approach is preferable to this one and this simple approach is only included for backwards compatibility with these earlier versions of SWIG.

    -

    26.3.6 Pointers

    +

    27.3.6 Pointers

    @@ -1335,7 +1335,7 @@ C-style cast may return a bogus result whereas as the C++-style cast will return a NULL pointer if the conversion can't be performed.

    -

    26.3.7 Structures

    +

    27.3.7 Structures

    @@ -1503,7 +1503,7 @@ x.setA(3); // Modify x.a - this is the same as b.f.a -

    26.3.8 C++ classes

    +

    27.3.8 C++ classes

    @@ -1566,7 +1566,7 @@ int bar = Spam.getBar(); -

    26.3.9 C++ inheritance

    +

    27.3.9 C++ inheritance

    @@ -1627,7 +1627,7 @@ Note that Java does not support multiple inheritance so any multiple inheritance A warning is given when multiple inheritance is detected and only the first base class is used.

    -

    26.3.10 Pointers, references, arrays and pass by value

    +

    27.3.10 Pointers, references, arrays and pass by value

    @@ -1682,7 +1682,7 @@ to hold the result and a pointer is returned (Java will release this memory when the returned object's finalizer is run by the garbage collector).

    -

    26.3.10.1 Null pointers

    +

    27.3.10.1 Null pointers

    @@ -1706,7 +1706,7 @@ For spam1 and spam4 above the Java null gets translat The converse also occurs, that is, NULL pointers are translated into null Java objects when returned from a C/C++ function.

    -

    26.3.11 C++ overloaded functions

    +

    27.3.11 C++ overloaded functions

    @@ -1821,7 +1821,7 @@ void spam(unsigned short); // Ignored -

    26.3.12 C++ default arguments

    +

    27.3.12 C++ default arguments

    @@ -1864,7 +1864,7 @@ Further details on default arguments and how to restore this approach are given

    -

    26.3.13 C++ namespaces

    +

    27.3.13 C++ namespaces

    @@ -1954,7 +1954,7 @@ If the resulting use of the nspace feature and hence packages results in a proxy you will need to open up the visibility for the pointer constructor and getCPtr method from the default 'protected' to 'public' with the SWIG_JAVABODY_PROXY macro. See Java code typemaps.

    -

    26.3.14 C++ templates

    +

    27.3.14 C++ templates

    @@ -2003,10 +2003,10 @@ Obviously, there is more to template wrapping than shown in this example. More details can be found in the SWIG and C++ chapter.

    -

    26.3.15 C++ Smart Pointers

    +

    27.3.15 C++ Smart Pointers

    -

    26.3.15.1 The shared_ptr Smart Pointer

    +

    27.3.15.1 The shared_ptr Smart Pointer

    @@ -2017,7 +2017,7 @@ in the shared_ptr smart pointer -

    26.3.15.2 Generic Smart Pointers

    +

    27.3.15.2 Generic Smart Pointers

    @@ -2101,7 +2101,7 @@ Foo f = p.__deref__(); // Returns underlying Foo * -

    26.4 Further details on the generated Java classes

    +

    27.4 Further details on the generated Java classes

    @@ -2116,7 +2116,7 @@ Finally enum classes are covered. First, the crucial intermediary JNI class is considered.

    -

    26.4.1 The intermediary JNI class

    +

    27.4.1 The intermediary JNI class

    @@ -2236,7 +2236,7 @@ If name is the same as modulename then the module class name g from modulename to modulenameModule.

    -

    26.4.1.1 The intermediary JNI class pragmas

    +

    27.4.1.1 The intermediary JNI class pragmas

    @@ -2318,7 +2318,7 @@ For example, let's change the intermediary JNI class access to just the default All the methods in the intermediary JNI class will then not be callable outside of the package as the method modifiers have been changed from public access to default access. This is useful if you want to prevent users calling these low level functions.

    -

    26.4.2 The Java module class

    +

    27.4.2 The Java module class

    @@ -2349,7 +2349,7 @@ example.egg(new Foo()); The primary reason for having the module class wrapping the calls in the intermediary JNI class is to implement static type checking. In this case only a Foo can be passed to the egg function, whereas any long can be passed to the egg function in the intermediary JNI class.

    -

    26.4.2.1 The Java module class pragmas

    +

    27.4.2.1 The Java module class pragmas

    @@ -2400,7 +2400,7 @@ See The intermediary JNI class pragmas secti

    -

    26.4.3 Java proxy classes

    +

    27.4.3 Java proxy classes

    @@ -2476,7 +2476,7 @@ int y = f.spam(5, new Foo()); -

    26.4.3.1 Memory management

    +

    27.4.3.1 Memory management

    @@ -2638,7 +2638,7 @@ and

    -

    26.4.3.2 Inheritance

    +

    27.4.3.2 Inheritance

    @@ -2754,7 +2754,7 @@ However, true cross language polymorphism can be achieved using the 26.4.3.3 Proxy classes and garbage collection +

    27.4.3.3 Proxy classes and garbage collection

    @@ -2837,7 +2837,7 @@ The section on Java typemaps details how to specify See the How to Handle Java Finalization's Memory-Retention Issues article for alternative approaches to managing memory by avoiding finalizers altogether.

    -

    26.4.3.4 The premature garbage collection prevention parameter for proxy class marshalling

    +

    27.4.3.4 The premature garbage collection prevention parameter for proxy class marshalling

    @@ -2959,7 +2959,7 @@ For example: Compatibility note: The generation of this additional parameter did not occur in versions prior to SWIG-1.3.30.

    -

    26.4.3.5 Single threaded applications and thread safety

    +

    27.4.3.5 Single threaded applications and thread safety

    @@ -3047,7 +3047,7 @@ for (int i=0; i<100000; i++) { -

    26.4.4 Type wrapper classes

    +

    27.4.4 Type wrapper classes

    @@ -3134,7 +3134,7 @@ public static void spam(SWIGTYPE_p_int x, SWIGTYPE_p_int y, int z) { ... } -

    26.4.5 Enum classes

    +

    27.4.5 Enum classes

    @@ -3143,7 +3143,7 @@ The Enumerations section discussed these but om The following sub-sections detail the various types of enum classes that can be generated.

    -

    26.4.5.1 Typesafe enum classes

    +

    27.4.5.1 Typesafe enum classes

    @@ -3227,7 +3227,7 @@ The swigValue method is used for marshalling in the other direction. The toString method is overridden so that the enum name is available.

    -

    26.4.5.2 Proper Java enum classes

    +

    27.4.5.2 Proper Java enum classes

    @@ -3305,7 +3305,7 @@ These needn't be generated if the enum being wrapped does not have any initializ Simpler Java enums for enums without initializers section describes how typemaps can be used to achieve this.

    -

    26.4.5.3 Type unsafe enum classes

    +

    27.4.5.3 Type unsafe enum classes

    @@ -3336,7 +3336,7 @@ public final class Beverage { -

    26.4.6 Interfaces

    +

    27.4.6 Interfaces

    @@ -3581,7 +3581,7 @@ typemap which is only used when a class is marked with the interface fe See Java code typemaps for details.

    -

    26.5 Cross language polymorphism using directors

    +

    27.5 Cross language polymorphism using directors

    @@ -3603,7 +3603,7 @@ The upshot is that C++ classes can be extended in Java and from C++ these extens Neither C++ code nor Java code needs to know where a particular method is implemented: the combination of proxy classes, director classes, and C wrapper functions transparently takes care of all the cross-language method routing.

    -

    26.5.1 Enabling directors

    +

    27.5.1 Enabling directors

    @@ -3671,7 +3671,7 @@ public: -

    26.5.2 Director classes

    +

    27.5.2 Director classes

    @@ -3698,7 +3698,7 @@ If the correct implementation is in Java, the Java API is used to call the metho

    -

    26.5.3 Overhead and code bloat

    +

    27.5.3 Overhead and code bloat

    @@ -3716,7 +3716,7 @@ This situation can be optimized by selectively enabling director methods (using

    -

    26.5.4 Simple directors example

    +

    27.5.4 Simple directors example

    @@ -3779,7 +3779,7 @@ DirectorDerived.upcall_method() invoked. -

    26.5.5 Director threading issues

    +

    27.5.5 Director threading issues

    @@ -3799,7 +3799,7 @@ Macros can be defined on the commandline when compiling your C++ code, or altern -

    26.5.6 Director performance tuning

    +

    27.5.6 Director performance tuning

    @@ -3820,7 +3820,7 @@ However, if all director methods are expected to usually be overridden by Java s The disadvantage is that invocation of director methods from C++ when Java doesn't actually override the method will require an additional call up into Java and back to C++. As such, this option is only useful when overrides are extremely common and instantiation is frequent enough that its performance is critical.

    -

    26.5.7 Java exceptions from directors

    +

    27.5.7 Java exceptions from directors

    @@ -3896,7 +3896,7 @@ Exception in thread "main" java.lang.RuntimeException: There was a problem! More on the Swig::DirectorException class can be found in the next section which details how to customize the handling of director exceptions.

    -

    26.5.7.1 Customizing director exceptions

    +

    27.5.7.1 Customizing director exceptions

    @@ -4454,7 +4454,7 @@ Exception in thread "main" java.lang.IndexOutOfBoundsException: Index is negativ -

    26.6 Accessing protected members

    +

    27.6 Accessing protected members

    @@ -4550,7 +4550,7 @@ class MyProtectedBase extends ProtectedBase -

    26.7 Common customization features

    +

    27.7 Common customization features

    @@ -4562,7 +4562,7 @@ be awkward. This section describes some common SWIG features that are used to improve the interface to existing C/C++ code.

    -

    26.7.1 C/C++ helper functions

    +

    27.7.1 C/C++ helper functions

    @@ -4628,7 +4628,7 @@ hard to implement. It is possible to improve on this using Java code, typemaps, customization features as covered in later sections, but sometimes helper functions are a quick and easy solution to difficult cases.

    -

    26.7.2 Class extension with %extend

    +

    27.7.2 Class extension with %extend

    @@ -4691,7 +4691,7 @@ Vector(2, 3, 4) in any way---the extensions only show up in the Java interface.

    -

    26.7.3 Class extension with %proxycode

    +

    27.7.3 Class extension with %proxycode

    @@ -4828,7 +4828,7 @@ public class ValueUnsignedInt { -

    26.7.4 Exception handling with %exception and %javaexception

    +

    27.7.4 Exception handling with %exception and %javaexception

    @@ -4987,7 +4987,7 @@ to raise exceptions. See the SWIG Library ch The typemap example Handling C++ exception specifications as Java exceptions provides further exception handling capabilities.

    -

    26.7.5 Method access with %javamethodmodifiers

    +

    27.7.5 Method access with %javamethodmodifiers

    @@ -5013,7 +5013,7 @@ protected static void protect_me() { -

    26.8 Tips and techniques

    +

    27.8 Tips and techniques

    @@ -5023,7 +5023,7 @@ strings and arrays. This chapter discusses the common techniques for solving these problems.

    -

    26.8.1 Input and output parameters using primitive pointers and references

    +

    27.8.1 Input and output parameters using primitive pointers and references

    @@ -5197,7 +5197,7 @@ void foo(Bar *OUTPUT); will not have the intended effect since typemaps.i does not define an OUTPUT rule for Bar.

    -

    26.8.2 Simple pointers

    +

    27.8.2 Simple pointers

    @@ -5263,7 +5263,7 @@ System.out.println("3 + 4 = " + result); See the SWIG Library chapter for further details.

    -

    26.8.3 Wrapping C arrays with Java arrays

    +

    27.8.3 Wrapping C arrays with Java arrays

    @@ -5330,7 +5330,7 @@ Please be aware that the typemaps in this library are not efficient as all the e There is an alternative approach using the SWIG array library and this is covered in the next section.

    -

    26.8.4 Unbounded C Arrays

    +

    27.8.4 Unbounded C Arrays

    @@ -5475,7 +5475,7 @@ well suited for applications in which you need to create buffers, package binary data, etc.

    -

    26.8.5 Binary data vs Strings

    +

    27.8.5 Binary data vs Strings

    @@ -5519,7 +5519,7 @@ len: 5 data: 68 69 0 6a 6b -

    26.8.6 Overriding new and delete to allocate from Java heap

    +

    27.8.6 Overriding new and delete to allocate from Java heap

    @@ -5636,7 +5636,7 @@ model and use these functions in place of malloc and free in your own code.

    -

    26.9 Java typemaps

    +

    27.9 Java typemaps

    @@ -5657,7 +5657,7 @@ Before proceeding, it should be stressed that typemaps are not a required part of using SWIG---the default wrapping behavior is enough in most cases. Typemaps are only used if you want to change some aspect of the generated code. -

    26.9.1 Default primitive type mappings

    +

    27.9.1 Default primitive type mappings

    @@ -5809,7 +5809,7 @@ However, the mappings allow the full range of values for each C type from Java.

    -

    26.9.2 Default typemaps for non-primitive types

    +

    27.9.2 Default typemaps for non-primitive types

    @@ -5824,7 +5824,7 @@ So in summary, the C/C++ pointer to non-primitive types is cast into the 64 bit The Java type is either the proxy class or type wrapper class.

    -

    26.9.3 Sixty four bit JVMs

    +

    27.9.3 Sixty four bit JVMs

    @@ -5837,7 +5837,7 @@ Unfortunately it won't of course hold true for JNI code.

    -

    26.9.4 What is a typemap?

    +

    27.9.4 What is a typemap?

    @@ -5960,7 +5960,7 @@ int c = example.count('e', "Hello World"); -

    26.9.5 Typemaps for mapping C/C++ types to Java types

    +

    27.9.5 Typemaps for mapping C/C++ types to Java types

    @@ -6240,7 +6240,7 @@ These are listed below: -

    26.9.6 Java typemap attributes

    +

    27.9.6 Java typemap attributes

    @@ -6286,7 +6286,7 @@ The "javain" typemap has the optional 'pre', 'post' and 'pgcppname' attributes. Note that when the 'pre' or 'post' attributes are specified and the associated type is used in a constructor, a constructor helper function is generated. This is necessary as the Java proxy constructor wrapper makes a call to a support constructor using a this call. In Java the this call must be the first statement in the constructor body. The constructor body thus calls the helper function and the helper function instead makes the JNI call, ensuring the 'pre' code is called before the JNI call is made. There is a Date marshalling example showing 'pre', 'post' and 'pgcppname' attributes in action.

    -

    26.9.7 Java special variables

    +

    27.9.7 Java special variables

    @@ -6468,7 +6468,7 @@ in that it is not fully qualified with the package name when using the nspace feature.

    -

    26.9.8 Typemaps for both C and C++ compilation

    +

    27.9.8 Typemaps for both C and C++ compilation

    @@ -6505,7 +6505,7 @@ If you do not intend your code to be targeting both C and C++ then your typemaps

    -

    26.9.9 Java code typemaps

    +

    27.9.9 Java code typemaps

    @@ -6801,7 +6801,7 @@ to make the method and constructor public: -

    26.9.10 Director specific typemaps

    +

    27.9.10 Director specific typemaps

    @@ -7078,7 +7078,7 @@ The basic strategy here is to provide a default package typemap for the majority -

    26.10 Typemap Examples

    +

    27.10 Typemap Examples

    @@ -7088,7 +7088,7 @@ the SWIG library.

    -

    26.10.1 Simpler Java enums for enums without initializers

    +

    27.10.1 Simpler Java enums for enums without initializers

    @@ -7167,7 +7167,7 @@ This would be done by using the original versions of these typemaps in "enums.sw

    -

    26.10.2 Handling C++ exception specifications as Java exceptions

    +

    27.10.2 Handling C++ exception specifications as Java exceptions

    @@ -7292,7 +7292,7 @@ We could alternatively have used %rename to rename what() into

    -

    26.10.3 NaN Exception - exception handling for a particular type

    +

    27.10.3 NaN Exception - exception handling for a particular type

    @@ -7447,7 +7447,7 @@ If we were a martyr to the JNI cause, we could replace the succinct code within If we had, we would have put it in the "in" typemap which, like all JNI and Java typemaps, also supports the 'throws' attribute.

    -

    26.10.4 Converting Java String arrays to char **

    +

    27.10.4 Converting Java String arrays to char **

    @@ -7591,7 +7591,7 @@ Lastly the "jni", "jtype" and "jstype" typemaps are also required to specify what Java types to use.

    -

    26.10.5 Expanding a Java object to multiple arguments

    +

    27.10.5 Expanding a Java object to multiple arguments

    @@ -7673,7 +7673,7 @@ example.foo(new String[]{"red", "green", "blue", "white"}); -

    26.10.6 Using typemaps to return arguments

    +

    27.10.6 Using typemaps to return arguments

    @@ -7791,7 +7791,7 @@ $ java runme 1 12.0 340.0 -

    26.10.7 Adding Java downcasts to polymorphic return types

    +

    27.10.7 Adding Java downcasts to polymorphic return types

    @@ -7997,7 +7997,7 @@ SWIG usually generates code which constructs the proxy classes using Java code a Note that the JNI code above uses a number of string lookups to call a constructor, whereas this would not occur using byte compiled Java code.

    -

    26.10.8 Adding an equals method to the Java classes

    +

    27.10.8 Adding an equals method to the Java classes

    @@ -8041,7 +8041,7 @@ System.out.println("foo1? " + foo1.equals(foo2)); -

    26.10.9 Void pointers and a common Java base class

    +

    27.10.9 Void pointers and a common Java base class

    @@ -8100,7 +8100,7 @@ This example contains some useful functionality which you may want in your code.

  • It also has a function which effectively implements a cast from the type of the proxy/type wrapper class to a void pointer. This is necessary for passing a proxy class or a type wrapper class to a function that takes a void pointer. -

    26.10.10 Struct pointer to pointer

    +

    27.10.10 Struct pointer to pointer

    @@ -8280,7 +8280,7 @@ The C functional interface has been completely morphed into an object-oriented i the Butler class would behave much like any pure Java class and feel more natural to Java users.

    -

    26.10.11 Memory management when returning references to member variables

    +

    27.10.11 Memory management when returning references to member variables

    @@ -8403,7 +8403,7 @@ public class Bike { Note the addReference call.

    -

    26.10.12 Memory management for objects passed to the C++ layer

    +

    27.10.12 Memory management for objects passed to the C++ layer

    @@ -8531,7 +8531,7 @@ as mentioned earlier, setElement is actually: -

    26.10.13 Date marshalling using the javain typemap and associated attributes

    +

    27.10.13 Date marshalling using the javain typemap and associated attributes

    @@ -8708,7 +8708,7 @@ A few things to note: -

    26.11 Living with Java Directors

    +

    27.11 Living with Java Directors

    @@ -8887,10 +8887,10 @@ public abstract class UserVisibleFoo extends Foo {

  • -

    26.12 Odds and ends

    +

    27.12 Odds and ends

    -

    26.12.1 JavaDoc comments

    +

    27.12.1 JavaDoc comments

    @@ -8946,7 +8946,7 @@ public class Barmy { -

    26.12.2 Functional interface without proxy classes

    +

    27.12.2 Functional interface without proxy classes

    @@ -9007,7 +9007,7 @@ All destructors have to be called manually for example the delete_Foo(foo) -

    26.12.3 Using your own JNI functions

    +

    27.12.3 Using your own JNI functions

    @@ -9057,7 +9057,7 @@ This directive is only really useful if you want to mix your own hand crafted JN

    -

    26.12.4 Performance concerns and hints

    +

    27.12.4 Performance concerns and hints

    @@ -9078,7 +9078,7 @@ However, you will have to be careful about memory management and make sure that This method normally calls the C++ destructor or free() for C code.

    -

    26.12.5 Debugging

    +

    27.12.5 Debugging

    @@ -9100,7 +9100,7 @@ The -verbose:jni and -verbose:gc are also useful options for monitoring code beh

    -

    26.13 Java Examples

    +

    27.13 Java Examples

    diff --git a/Doc/Manual/Javascript.html b/Doc/Manual/Javascript.html index 10612f001..2a18aed8c 100644 --- a/Doc/Manual/Javascript.html +++ b/Doc/Manual/Javascript.html @@ -7,7 +7,7 @@ -

    27 SWIG and Javascript

    +

    28 SWIG and Javascript

      @@ -52,7 +52,7 @@

      This chapter describes SWIG's support of Javascript. It does not cover SWIG basics, but only information that is specific to this module.

      -

      27.1 Overview

      +

      28.1 Overview

      Javascript is a prototype-based scripting language that is dynamic, weakly typed and has first-class functions. Its arguably the most popular language for web development. @@ -63,10 +63,10 @@ Javascript has gone beyond being a browser-based scripting language and with node-webkit there is a platform which uses Google's Chromium as Web-Browser widget and node.js for javascript extensions.

      -

      27.2 Preliminaries

      +

      28.2 Preliminaries

      -

      27.2.1 Running SWIG

      +

      28.2.1 Running SWIG

      Suppose that you defined a SWIG module such as the following:

      @@ -121,7 +121,7 @@ void example_initialize(v8::Handle<v8::Object> exports) Note: be aware that v8 has a C++ API, and thus, the generated modules must be compiled as C++.

      -

      27.2.2 Running Tests and Examples

      +

      28.2.2 Running Tests and Examples

      The configuration for tests and examples currently supports Linux and Mac only and not MinGW (Windows) yet.

      @@ -153,7 +153,7 @@ $ make check-javascript-test-suite ENGINE=jsc $ make check-javascript-examples V8_VERSION=0x032530 ENGINE=v8
    -

    27.2.3 Known Issues

    +

    28.2.3 Known Issues

    At the moment, the Javascript generators pass all tests syntactically, i.e., the generated source code compiles. However, there are still remaining runtime issues.

    @@ -170,12 +170,12 @@ $ make check-javascript-examples V8_VERSION=0x032530 ENGINE=v8

    The primary development environment has been Linux (Ubuntu 12.04). Windows and Mac OS X have been tested sporadically. Therefore, the generators might have more issues on those platforms. Please report back any problem you observe to help us improving this module quickly.

    -

    27.3 Integration

    +

    28.3 Integration

    This chapter gives a short introduction how to use a native Javascript extension: as a node.js module, and as an extension for an embedded Webkit.

    -

    27.3.1 Creating node.js Extensions

    +

    28.3.1 Creating node.js Extensions

    To install node.js you can download an installer from their web-site for Mac OS X and Windows. For Linux you can either build the source yourself and run sudo checkinstall or keep to the (probably stone-age) packaged version. For Ubuntu there is a PPA available.

    @@ -221,7 +221,7 @@ require("./build/Release/example")

    A more detailed explanation is given in the Examples section.

    -

    27.3.1.1 Troubleshooting

    +

    28.3.1.1 Troubleshooting

      @@ -233,12 +233,12 @@ require("./build/Release/example") $ sudo apt-get remove gyp -

      27.3.2 Embedded Webkit

      +

      28.3.2 Embedded Webkit

      Webkit is pre-installed on Mac OS X and available as a library for GTK.

      -

      27.3.2.1 Mac OS X

      +

      28.3.2.1 Mac OS X

      There is general information about programming with WebKit on Apple Developer Documentation. Details about Cocoa programming are not covered here.

      @@ -286,7 +286,7 @@ extern bool example_initialize(JSGlobalContextRef context, JSObjectRef* exports) @end -

      27.3.2.2 GTK

      +

      28.3.2.2 GTK

      There is general information about programming GTK at GTK documentation and in the GTK tutorial, and for Webkit there is a Webkit GTK+ API Reference.

      @@ -331,7 +331,7 @@ int main(int argc, char* argv[]) } -

      27.3.3 Creating Applications with node-webkit

      +

      28.3.3 Creating Applications with node-webkit

      To get started with node-webkit there is a very informative set of wiki pages.

      @@ -422,12 +422,12 @@ open new windows, and many more things. }; -

      27.4 Examples

      +

      28.4 Examples

      Some basic examples are shown here in more detail.

      -

      27.4.1 Simple

      +

      28.4.1 Simple

      The common example simple looks like this:

      @@ -477,7 +477,7 @@ example.Foo = 3.1415926;

      Note: ECMAScript 5, the currently implemented Javascript standard, does not have modules. node.js and other implementations provide this mechanism defined by the CommonJS group. For browsers this is provided by Browserify, for instance.

      -

      27.4.2 Class

      +

      28.4.2 Class

      The common example class defines three classes, Shape, Circle, and Square:

      @@ -607,12 +607,12 @@ at emitKey (readline.js:1095:12) Note: In ECMAScript 5 there is no concept for classes. Instead each function can be used as a constructor function which is executed by the 'new' operator. Furthermore, during construction the key property prototype of the constructor function is used to attach a prototype instance to the created object. A prototype is essentially an object itself that is the first-class delegate of a class used whenever the access to a property of an object fails. The very same prototype instance is shared among all instances of one type. Prototypal inheritance is explained in more detail on in Inheritance and the prototype chain, for instance.

      -

      27.5 Implementation

      +

      28.5 Implementation

      The Javascript Module implementation has taken a very different approach compared to other language modules in order to support different Javascript interpreters.

      -

      27.5.1 Source Code

      +

      28.5.1 Source Code

      The Javascript module is implemented in Source/Modules/javascript.cxx. It dispatches the code generation to a JSEmitter instance, V8Emitter or JSCEmitter. Additionally there are some helpers: Template, for templated code generation, and JSEmitterState, which is used to manage state information during AST traversal. This rough map shall make it easier to find a way through this huge source file:

      @@ -713,7 +713,7 @@ Template::Template(const String *code_) { ... } ... -

      27.5.2 Code Templates

      +

      28.5.2 Code Templates

      All generated code is created on the basis of code templates. The templates for JavascriptCore can be found in Lib/javascript/jsc/javascriptcode.swg, for v8 in Lib/javascript/v8/javascriptcode.swg.

      @@ -752,7 +752,7 @@ t_register.replace("$jsparent", state.clazz(NAME_MANGLED))

      Template creates a copy of that string and Template::replace uses Swig's Replaceall to replace variables in the template. Template::trim can be used to eliminate leading and trailing whitespaces. Template::print is used to write the final template string to a Swig DOH (based on Printv). All methods allow chaining.

      -

      27.5.3 Emitter

      +

      28.5.3 Emitter

      The Javascript module delegates code generation to a JSEmitter instance. The following extract shows the essential interface:

      @@ -871,7 +871,7 @@ int JAVASCRIPT::classHandler(Node *n) {

      In enterClass the emitter stores state information that is necessary when processing class members. In exitClass the wrapper code for the whole class is generated.

      -

      27.5.4 Emitter states

      +

      28.5.4 Emitter states

      For storing information during the AST traversal the emitter provides a JSEmitterState with different slots to store data representing the scopes global, class, function, and variable.

      @@ -915,7 +915,7 @@ state.clazz(NAME, Getattr(n, "sym:name"));

      State information can be retrieved using state.clazz(NAME) or with Getattr on state.clazz() which actually returns a Hash instance.

      -

      27.5.5 Handling Exceptions in JavascriptCore

      +

      28.5.5 Handling Exceptions in JavascriptCore

      Applications with an embedded JavascriptCore should be able to present detailed exception messages that occur in the Javascript engine. Below is an example derived from code provided by Brian Barnes on how these exception details can be extracted.

      diff --git a/Doc/Manual/Lisp.html b/Doc/Manual/Lisp.html index 0d9e3dc4f..7ea6fb1b9 100644 --- a/Doc/Manual/Lisp.html +++ b/Doc/Manual/Lisp.html @@ -7,7 +7,7 @@ -

      28 SWIG and Common Lisp

      +

      29 SWIG and Common Lisp

      -

      28.2.3 Generating CFFI bindings for C++ code

      +

      29.2.3 Generating CFFI bindings for C++ code

      This feature to SWIG (for CFFI) is very new and still far from @@ -582,7 +582,7 @@ If you have any questions, suggestions, patches, etc., related to CFFI module feel free to contact us on the SWIG mailing list, and also please add a "[CFFI]" tag in the subject line. -

      28.2.4 Inserting user code into generated files

      +

      29.2.4 Inserting user code into generated files

      @@ -622,7 +622,7 @@ Note that the block %{ ... %} is effectively a shortcut for

      -

      28.3 CLISP

      +

      29.3 CLISP

      @@ -652,7 +652,7 @@ swig -clisp -module module-name file-name interface file for the CLISP module. The CLISP module tries to produce code which is both human readable and easily modifyable.

      -

      28.3.1 Additional Commandline Options

      +

      29.3.1 Additional Commandline Options

      @@ -685,7 +685,7 @@ shortcuts according to the typedefs in the input. -

      28.3.2 Details on CLISP bindings

      +

      29.3.2 Details on CLISP bindings

      @@ -809,7 +809,7 @@ struct bar { -

      28.4 UFFI

      +

      29.4 UFFI

      diff --git a/Doc/Manual/Lua.html b/Doc/Manual/Lua.html index 8e545776f..944223f3c 100644 --- a/Doc/Manual/Lua.html +++ b/Doc/Manual/Lua.html @@ -7,7 +7,7 @@ -

      29 SWIG and Lua

      +

      30 SWIG and Lua

        @@ -83,14 +83,14 @@ Lua is an extension programming language designed to support general procedural eLua stands for Embedded Lua (can be thought of as a flavor of Lua) and offers the full implementation of the Lua programming language to the embedded world, extending it with specific features for efficient and portable software embedded development. eLua runs on smaller devices like microcontrollers and provides the full features of the regular Lua desktop version. More information on eLua can be found here: http://www.eluaproject.net

        -

        29.1 Preliminaries

        +

        30.1 Preliminaries

        The current SWIG implementation is designed to work with Lua 5.0.x, 5.1.x and 5.2.x. It should work with later versions of Lua, but certainly not with Lua 4.0 due to substantial API changes. It is possible to either static link or dynamic link a Lua module into the interpreter (normally Lua static links its libraries, as dynamic linking is not available on all platforms). SWIG also has support for eLua starting from eLua 0.8. Due to substantial changes between SWIG 2.x and SWIG 3.0 and unavailability of testing platform, eLua status was downgraded to 'experimental'.

        -

        29.2 Running SWIG

        +

        30.2 Running SWIG

        @@ -138,7 +138,7 @@ $ swig -lua -eluac example.i The -elua option puts all the C function wrappers and variable get/set wrappers in rotables. It also generates a metatable which will control the access to these variables from eLua. It also offers a significant amount of module size compression. On the other hand, the -eluac option puts all the wrappers in a single rotable. With this option, no matter how huge the module, it will consume no additional microcontroller SRAM (crass compression). There is a catch though: Metatables are not generated with -eluac. To access any value from eLua, one must directly call the wrapper function associated with that value.

        -

        29.2.1 Additional command line options

        +

        30.2.1 Additional command line options

        @@ -179,7 +179,7 @@ swig -lua -help -

        29.2.2 Compiling and Linking and Interpreter

        +

        30.2.2 Compiling and Linking and Interpreter

        @@ -250,7 +250,7 @@ LUALIB_API int ( luaopen_mod )(lua_State *L ); More information on building and configuring eLua can be found here: http://www.eluaproject.net/doc/v0.8/en_building.html

        -

        29.2.3 Compiling a dynamic module

        +

        30.2.3 Compiling a dynamic module

        @@ -318,7 +318,7 @@ Is quite obvious (Go back and consult the Lua documents on how to enable loadlib -

        29.2.4 Using your module

        +

        30.2.4 Using your module

        @@ -336,19 +336,19 @@ $ ./my_lua >

      -

      29.3 A tour of basic C/C++ wrapping

      +

      30.3 A tour of basic C/C++ wrapping

      By default, SWIG tries to build a very natural Lua interface to your C/C++ code. This section briefly covers the essential aspects of this wrapping.

      -

      29.3.1 Modules

      +

      30.3.1 Modules

      The SWIG module directive specifies the name of the Lua module. If you specify `module example', then everything is wrapped into a Lua table 'example' containing all the functions and variables. When choosing a module name, make sure you don't use the same name as a built-in Lua command or standard module name.

      -

      29.3.2 Functions

      +

      30.3.2 Functions

      @@ -389,7 +389,7 @@ It is also possible to rename the module with an assignment. 24 -

      29.3.3 Global variables

      +

      30.3.3 Global variables

      @@ -477,7 +477,7 @@ If you have used the -eluac option for your eLua module, you will have In general, functions of the form "variable_get()" and "variable_set()" are automatically generated by SWIG for use with -eluac.

      -

      29.3.4 Constants and enums

      +

      30.3.4 Constants and enums

      @@ -512,7 +512,7 @@ If you're using eLua and have used -elua or -eluac to generate Hello World -

      29.3.4.1 Constants/enums and classes/structures

      +

      30.3.4.1 Constants/enums and classes/structures

      @@ -568,7 +568,7 @@ If the -no-old-metatable-bindings option is used, then these old-style It is worth mentioning, that example.Test.TEST1 and example.Test_TEST1 are different entities and changing one does not change the other. Given the fact that these are constantes and they are not supposed to be changed, it is up to you to avoid such issues.

      -

      29.3.5 Pointers

      +

      30.3.5 Pointers

      @@ -606,7 +606,7 @@ Lua enforces the integrity of its userdata, so it is virtually impossible to cor nil -

      29.3.6 Structures

      +

      30.3.6 Structures

      @@ -710,7 +710,7 @@ For eLua with the -eluac option, structure manipulation has to be perfo In general, functions of the form "new_struct()", "struct_member_get()", "struct_member_set()" and "free_struct()" are automatically generated by SWIG for each structure defined in C. (Please note: This doesn't apply for modules generated with the -elua option)

      -

      29.3.7 C++ classes

      +

      30.3.7 C++ classes

      @@ -785,7 +785,7 @@ Both style names are generated by default now. However, if the -no-old-metatable-bindings option is used, then the backward compatible names are not generated in addition to ordinary ones.

      -

      29.3.8 C++ inheritance

      +

      30.3.8 C++ inheritance

      @@ -810,7 +810,7 @@ then the function spam() accepts a Foo pointer or a pointer to any clas

      It is safe to use multiple inheritance with SWIG.

      -

      29.3.9 Pointers, references, values, and arrays

      +

      30.3.9 Pointers, references, values, and arrays

      @@ -841,7 +841,7 @@ Foo spam7();

      then all three functions will return a pointer to some Foo object. Since the third function (spam7) returns a value, newly allocated memory is used to hold the result and a pointer is returned (Lua will release this memory when the return value is garbage collected). The other two are pointers which are assumed to be managed by the C code and so will not be garbage collected.

      -

      29.3.10 C++ overloaded functions

      +

      30.3.10 C++ overloaded functions

      @@ -927,7 +927,7 @@ Please refer to the "SWIG and C++" chapter for more information about overloadin

      Dealing with the Lua coercion mechanism, the priority is roughly (integers, floats, strings, userdata). But it is better to rename the functions rather than rely upon the ordering.

      -

      29.3.11 C++ operators

      +

      30.3.11 C++ operators

      @@ -1059,7 +1059,7 @@ operators and pseudo-operators):

    No other lua metafunction is inherited. For example, __gc is not inherited and must be redefined in every class. __tostring is subject to a special handling. If absent in class and in class bases, a default one will be provided by SWIG.

    -

    29.3.12 Class extension with %extend

    +

    30.3.12 Class extension with %extend

    @@ -1116,7 +1116,7 @@ true Extend works with both C and C++ code, on classes and structs. It does not modify the underlying object in any way---the extensions only show up in the Lua interface. The only item to take note of is the code has to use the '$self' instead of 'this', and that you cannot access protected/private members of the code (as you are not officially part of the class).

    -

    29.3.13 Using %newobject to release memory

    +

    30.3.13 Using %newobject to release memory

    If you have a function that allocates memory like this,

    @@ -1140,7 +1140,7 @@ char *foo();

    This will release the allocated memory.

    -

    29.3.14 C++ templates

    +

    30.3.14 C++ templates

    @@ -1175,7 +1175,7 @@ In Lua:

    Obviously, there is more to template wrapping than shown in this example. More details can be found in the SWIG and C++ chapter. Some more complicated examples will appear later.

    -

    29.3.15 C++ Smart Pointers

    +

    30.3.15 C++ Smart Pointers

    @@ -1227,7 +1227,7 @@ If you ever need to access the underlying pointer returned by operator->( > f = p:__deref__() -- Returns underlying Foo * -

    29.3.16 C++ Exceptions

    +

    30.3.16 C++ Exceptions

    @@ -1370,7 +1370,7 @@ and the "Exception handling add exception specification to functions or globally (respectively).

    -

    29.3.17 Namespaces

    +

    30.3.17 Namespaces

    @@ -1421,7 +1421,7 @@ Now, from Lua usage is as follows: 19 > -

    29.3.17.1 Compatibility Note

    +

    30.3.17.1 Compatibility Note

    @@ -1437,7 +1437,7 @@ If SWIG is running in a backwards compatible way, i.e. without the -no-old-m -

    29.3.17.2 Names

    +

    30.3.17.2 Names

    If SWIG is launched without -no-old-metatable-bindings option, then it enters backward-compatible mode. While in this mode, it tries @@ -1481,7 +1481,7 @@ surrounding scope without any prefixing. Pretending that Test2 is a struct, not > -

    29.3.17.3 Inheritance

    +

    30.3.17.3 Inheritance

    The internal organization of inheritance has changed. @@ -1522,12 +1522,12 @@ function > -

    29.4 Typemaps

    +

    30.4 Typemaps

    This section explains what typemaps are and how to use them. The default wrapping behaviour of SWIG is enough in most cases. However sometimes SWIG may need a little additional assistance to know which typemap to apply to provide the best wrapping. This section will be explaining how to use typemaps to best effect

    -

    29.4.1 What is a typemap?

    +

    30.4.1 What is a typemap?

    A typemap is nothing more than a code generation rule that is attached to a specific C datatype. For example, to convert integers from Lua to C, you might define a typemap like this:

    @@ -1555,7 +1555,7 @@ Received an integer : 6 720 -

    29.4.2 Using typemaps

    +

    30.4.2 Using typemaps

    There are many ready written typemaps built into SWIG for all common types (int, float, short, long, char*, enum and more), which SWIG uses automatically, with no effort required on your part.

    @@ -1608,7 +1608,7 @@ void swap(int *sx, int *sy);

    Note: C++ references must be handled exactly the same way. However SWIG will automatically wrap a const int& as an input parameter (since that it obviously input).

    -

    29.4.3 Typemaps and arrays

    +

    30.4.3 Typemaps and arrays

    Arrays present a challenge for SWIG, because like pointers SWIG does not know whether these are input or output values, nor @@ -1672,7 +1672,7 @@ and Lua tables to be 1..N, (the indexing follows the norm for the language). In

    Note: SWIG also can support arrays of pointers in a similar manner.

    -

    29.4.4 Typemaps and pointer-pointer functions

    +

    30.4.4 Typemaps and pointer-pointer functions

    Several C++ libraries use a pointer-pointer functions to create its objects. These functions require a pointer to a pointer which is then filled with the pointer to the new object. Microsoft's COM and DirectX as well as many other libraries have this kind of function. An example is given below:

    @@ -1706,7 +1706,7 @@ int Create_Math(iMath** pptr); // its creator (assume it mallocs) ptr=nil -- the iMath* will be GC'ed as normal -

    29.5 Writing typemaps

    +

    30.5 Writing typemaps

    This section describes how you can modify SWIG's default wrapping behavior for various C/C++ datatypes using the %typemap directive. This is an advanced topic that assumes familiarity with the Lua C API as well as the material in the "Typemaps" chapter.

    @@ -1715,7 +1715,7 @@ ptr=nil -- the iMath* will be GC'ed as normal

    Before proceeding, you should read the previous section on using typemaps, and look at the existing typemaps found in luatypemaps.swg and typemaps.i. These are both well documented and fairly easy to read. You should not attempt to write your own typemaps until you have read and can understand both of these files (they may well also give you an idea to base your work on).

    -

    29.5.1 Typemaps you can write

    +

    30.5.1 Typemaps you can write

    There are many different types of typemap that can be written, the full list can be found in the "Typemaps" chapter. However the following are the most commonly used ones.

    @@ -1728,7 +1728,7 @@ ptr=nil -- the iMath* will be GC'ed as normal (the syntax for the typecheck is different from the typemap, see typemaps for details). -

    29.5.2 SWIG's Lua-C API

    +

    30.5.2 SWIG's Lua-C API

    This section explains the SWIG specific Lua-C API. It does not cover the main Lua-C api, as this is well documented and not worth covering.

    @@ -1777,7 +1777,7 @@ This macro, when called within the context of a SWIG wrapped function, will disp
    Similar to SWIG_fail_arg, except that it will display the swig_type_info information instead.
    -

    29.6 Customization of your Bindings

    +

    30.6 Customization of your Bindings

    @@ -1786,7 +1786,7 @@ This section covers adding of some small extra bits to your module to add the la -

    29.6.1 Writing your own custom wrappers

    +

    30.6.1 Writing your own custom wrappers

    @@ -1805,7 +1805,7 @@ int native_function(lua_State*L) // my native code The %native directive in the above example, tells SWIG that there is a function int native_function(lua_State*L); which is to be added into the module under the name 'my_func'. SWIG will not add any wrapper for this function, beyond adding it into the function table. How you write your code is entirely up to you.

    -

    29.6.2 Adding additional Lua code

    +

    30.6.2 Adding additional Lua code

    @@ -1843,7 +1843,7 @@ Good uses for this feature is adding of new code, or writing helper functions to See Examples/lua/arrays for an example of this code.

    -

    29.7 Details on the Lua binding

    +

    30.7 Details on the Lua binding

    @@ -1854,7 +1854,7 @@ See Examples/lua/arrays for an example of this code.

    -

    29.7.1 Binding global data into the module.

    +

    30.7.1 Binding global data into the module.

    @@ -1914,7 +1914,7 @@ end

    That way when you call 'a=example.Foo', the interpreter looks at the table 'example' sees that there is no field 'Foo' and calls __index. This will in turn check in '.get' table and find the existence of 'Foo' and then return the value of the C function call 'Foo_get()'. Similarly for the code 'example.Foo=10', the interpreter will check the table, then call the __newindex which will then check the '.set' table and call the C function 'Foo_set(10)'.

    -

    29.7.2 Userdata and Metatables

    +

    30.7.2 Userdata and Metatables

    @@ -1994,7 +1994,7 @@ Note: Both the opaque structures (like the FILE*) and normal wrapped classes/str

    Note: Operator overloads are basically done in the same way, by adding functions such as '__add' & '__call' to the class' metatable. The current implementation is a bit rough as it will add any member function beginning with '__' into the metatable too, assuming its an operator overload.

    -

    29.7.3 Memory management

    +

    30.7.3 Memory management

    diff --git a/Doc/Manual/Modula3.html b/Doc/Manual/Modula3.html index bdfc5992d..fc4ffa03c 100644 --- a/Doc/Manual/Modula3.html +++ b/Doc/Manual/Modula3.html @@ -6,7 +6,7 @@ -

    30 SWIG and Modula-3

    +

    31 SWIG and Modula-3

    -

    30.4.5 Exceptions

    +

    31.4.5 Exceptions

    @@ -817,7 +817,7 @@ you should declare %typemap("m3wrapinconv:throws") blah * %{OSError.E%}.

    -

    30.4.6 Example

    +

    31.4.6 Example

    @@ -864,10 +864,10 @@ where almost everything is generated by a typemap: -

    30.5 More hints to the generator

    +

    31.5 More hints to the generator

    -

    30.5.1 Features

    +

    31.5.1 Features

    @@ -904,7 +904,7 @@ where almost everything is generated by a typemap:
    -

    30.5.2 Pragmas

    +

    31.5.2 Pragmas

    @@ -927,7 +927,7 @@ where almost everything is generated by a typemap:
    -

    30.6 Remarks

    +

    31.6 Remarks

    -

    40.4.5 STL

    +

    41.4.5 STL

    @@ -1982,7 +1982,7 @@ ans = --> delete_PersonPtrSet(p); -

    40.5 Module initialization

    +

    41.5 Module initialization

    @@ -2006,7 +2006,7 @@ For example, to initialize the module example: --> example_Init(); -

    40.6 Building modes

    +

    41.6 Building modes

    @@ -2021,7 +2021,7 @@ To produce a dynamic module, when generating the wrapper, there are two possibil

  • the builder mode. In this mode, Scilab is responsible of building. -

    40.6.1 No-builder mode

    +

    41.6.1 No-builder mode

    @@ -2034,7 +2034,7 @@ This mode is the best option to use when you have to integrate the module build

    -

    40.6.2 Builder mode

    +

    41.6.2 Builder mode

    @@ -2074,14 +2074,14 @@ The command is: $ swig -scilab -builder -buildercflags -I/opt/foo/include -builderldflags "-L/opt/foo/lib -lfoo" -buildersources baa1.cxx, baa2.cxx example.i -

    40.7 Generated scripts

    +

    41.7 Generated scripts

    In this part we give some details about the generated Scilab scripts.

    -

    40.7.1 Builder script

    +

    41.7.1 Builder script

    @@ -2106,7 +2106,7 @@ ilib_build(ilib_name, table, files, libs);

  • table: two column string matrix containing a table of pairs of 'scilab function name', 'C function name'.
  • -

    40.7.2 Loader script

    +

    41.7.2 Loader script

    @@ -2145,7 +2145,7 @@ clear get_file_path; -

    40.8 Other resources

    +

    41.8 Other resources

    diff --git a/Doc/Manual/Doxygen.html b/Doc/Manual/Doxygen.html index de9ff5841..08d1aef94 100644 --- a/Doc/Manual/Doxygen.html +++ b/Doc/Manual/Doxygen.html @@ -18,8 +18,8 @@
  • doxygen:notranslate
  • doxygen:alias:<command-name>
  • doxygen:ignore:<command-name> -
  • doxygen:nolinktranslate (Java-only currently) -
  • doxygen:nostripparams (Java-only currently) +
  • doxygen:nolinktranslate +
  • doxygen:nostripparams
  • Additional command line options @@ -416,20 +416,22 @@ def func(): -

    16.2.2.4 doxygen:nolinktranslate (Java-only currently)

    +

    16.2.2.4 doxygen:nolinktranslate

    Turn off automatic link-objects translation. +This is only applicable to Java at the moment.

    -

    16.2.2.5 doxygen:nostripparams (Java-only currently)

    +

    16.2.2.5 doxygen:nostripparams

    Turn off stripping of @param and @tparam Doxygen commands if the parameter is not found in the function signature. +This is only applicable to Java at the moment.

    From cbaf6eb2b3b04fd75b152d94f9baa806aa698ab9 Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Thu, 24 May 2018 19:18:55 +0100 Subject: [PATCH 299/314] Clean up merge problem --- Examples/test-suite/java/Makefile.in | 1 - 1 file changed, 1 deletion(-) diff --git a/Examples/test-suite/java/Makefile.in b/Examples/test-suite/java/Makefile.in index e3333692c..f1717b81b 100644 --- a/Examples/test-suite/java/Makefile.in +++ b/Examples/test-suite/java/Makefile.in @@ -76,7 +76,6 @@ java_nspacewithoutpackage.%: JAVA_PACKAGEOPT = multiple_inheritance_nspace.%: JAVA_PACKAGE = $*Package nspace.%: JAVA_PACKAGE = $*Package nspace_extend.%: JAVA_PACKAGE = $*Package -doxygen_misc_constructs.%: INCLUDES = -I../$(srcdir)/.. # Rules for the different types of tests %.cpptest: From 95caf875960d53adf4e79fcb5e157760d94ecfb8 Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Thu, 24 May 2018 19:28:15 +0100 Subject: [PATCH 300/314] PEP8 conformance for comment verifier module --- Examples/test-suite/python/autodoc_runme.py | 4 +-- ...commentVerifier.py => comment_verifier.py} | 0 .../test-suite/python/doxygen_alias_runme.py | 4 +-- .../python/doxygen_basic_notranslate_runme.py | 16 +++++----- .../python/doxygen_basic_translate_runme.py | 18 +++++------ .../test-suite/python/doxygen_ignore_runme.py | 4 +-- .../python/doxygen_misc_constructs_runme.py | 30 +++++++++---------- .../python/doxygen_parsing_runme.py | 22 +++++++------- .../doxygen_translate_all_tags_runme.py | 22 +++++++------- .../python/doxygen_translate_links_runme.py | 4 +-- .../python/doxygen_translate_runme.py | 10 +++---- 11 files changed, 67 insertions(+), 67 deletions(-) rename Examples/test-suite/python/{commentVerifier.py => comment_verifier.py} (100%) diff --git a/Examples/test-suite/python/autodoc_runme.py b/Examples/test-suite/python/autodoc_runme.py index 7635f6c4a..11e499d25 100644 --- a/Examples/test-suite/python/autodoc_runme.py +++ b/Examples/test-suite/python/autodoc_runme.py @@ -1,5 +1,5 @@ from autodoc import * -import commentVerifier +import comment_verifier import inspect import sys @@ -8,7 +8,7 @@ def check(got, expected, expected_builtin=None, skip=False): expect = expected if is_python_builtin() and expected_builtin != None: expect = expected_builtin - commentVerifier.check(got, expect) + comment_verifier.check(got, expect) def is_new_style_class(cls): return hasattr(cls, "__class__") diff --git a/Examples/test-suite/python/commentVerifier.py b/Examples/test-suite/python/comment_verifier.py similarity index 100% rename from Examples/test-suite/python/commentVerifier.py rename to Examples/test-suite/python/comment_verifier.py diff --git a/Examples/test-suite/python/doxygen_alias_runme.py b/Examples/test-suite/python/doxygen_alias_runme.py index 4117f00e5..ad580f719 100644 --- a/Examples/test-suite/python/doxygen_alias_runme.py +++ b/Examples/test-suite/python/doxygen_alias_runme.py @@ -2,9 +2,9 @@ import doxygen_alias import inspect -import commentVerifier +import comment_verifier -commentVerifier.check(inspect.getdoc(doxygen_alias.make_something), +comment_verifier.check(inspect.getdoc(doxygen_alias.make_something), """\ A function returning something. diff --git a/Examples/test-suite/python/doxygen_basic_notranslate_runme.py b/Examples/test-suite/python/doxygen_basic_notranslate_runme.py index bf2703c21..17c03e32d 100644 --- a/Examples/test-suite/python/doxygen_basic_notranslate_runme.py +++ b/Examples/test-suite/python/doxygen_basic_notranslate_runme.py @@ -4,9 +4,9 @@ import doxygen_basic_notranslate import inspect import string import sys -import commentVerifier +import comment_verifier -commentVerifier.check(inspect.getdoc(doxygen_basic_notranslate.function), +comment_verifier.check(inspect.getdoc(doxygen_basic_notranslate.function), r"""\brief Brief description. @@ -16,12 +16,12 @@ The comment text \sa function2""" ) -commentVerifier.check(inspect.getdoc(doxygen_basic_notranslate.function2), +comment_verifier.check(inspect.getdoc(doxygen_basic_notranslate.function2), r"""A test of a very very very very very very very very very very very very very very very very very very very very very long comment string.""" ) -commentVerifier.check(inspect.getdoc(doxygen_basic_notranslate.function3), +comment_verifier.check(inspect.getdoc(doxygen_basic_notranslate.function3), r"""*Overload 1:* A test for overloaded functions @@ -35,7 +35,7 @@ A test for overloaded functions This is function \b two""" ) -commentVerifier.check(inspect.getdoc(doxygen_basic_notranslate.function4), +comment_verifier.check(inspect.getdoc(doxygen_basic_notranslate.function4), r"""A test of some mixed tag usage \if CONDITION This \a code fragment shows us something \. @@ -51,14 +51,14 @@ int main() { while(true); } \endcode \endif""" ) -commentVerifier.check(inspect.getdoc(doxygen_basic_notranslate.function5), +comment_verifier.check(inspect.getdoc(doxygen_basic_notranslate.function5), r"""This is a post comment. """ ) -commentVerifier.check(inspect.getdoc(doxygen_basic_notranslate.function6), +comment_verifier.check(inspect.getdoc(doxygen_basic_notranslate.function6), r"""Test for default args @param a Some parameter, default is 42""" ) -commentVerifier.check(inspect.getdoc(doxygen_basic_notranslate.function7), +comment_verifier.check(inspect.getdoc(doxygen_basic_notranslate.function7), r"""Test for a parameter with difficult type (mostly for python) @param a Very strange param""" diff --git a/Examples/test-suite/python/doxygen_basic_translate_runme.py b/Examples/test-suite/python/doxygen_basic_translate_runme.py index f566086e1..1be6b6b07 100644 --- a/Examples/test-suite/python/doxygen_basic_translate_runme.py +++ b/Examples/test-suite/python/doxygen_basic_translate_runme.py @@ -4,9 +4,9 @@ import doxygen_basic_translate import inspect import string import sys -import commentVerifier +import comment_verifier -commentVerifier.check(inspect.getdoc(doxygen_basic_translate.function), +comment_verifier.check(inspect.getdoc(doxygen_basic_translate.function), """\ Brief description. @@ -19,12 +19,12 @@ Author: Some author See also: function2""" ) -commentVerifier.check(inspect.getdoc(doxygen_basic_translate.function2), +comment_verifier.check(inspect.getdoc(doxygen_basic_translate.function2), """\ A test of a very very very very very very very very very very very very very very very very very very very very very long comment string.""" ) -commentVerifier.check(inspect.getdoc(doxygen_basic_translate.function3), +comment_verifier.check(inspect.getdoc(doxygen_basic_translate.function3), """*Overload 1:* A test for overloaded functions @@ -37,7 +37,7 @@ This is function **one** A test for overloaded functions This is function **two**""" ) -commentVerifier.check(inspect.getdoc(doxygen_basic_translate.function4), +comment_verifier.check(inspect.getdoc(doxygen_basic_translate.function4), """\ A test of some mixed tag usage If: CONDITION { @@ -56,16 +56,16 @@ Warning: This may not work as expected }""" ) -commentVerifier.check(inspect.getdoc(doxygen_basic_translate.function5), +comment_verifier.check(inspect.getdoc(doxygen_basic_translate.function5), """This is a post comment.""" ) -commentVerifier.check(inspect.getdoc(doxygen_basic_translate.function6), +comment_verifier.check(inspect.getdoc(doxygen_basic_translate.function6), """\ Test for default args :type a: int :param a: Some parameter, default is 42""" ) -commentVerifier.check(inspect.getdoc(doxygen_basic_translate.function7), +comment_verifier.check(inspect.getdoc(doxygen_basic_translate.function7), """\ Test for a parameter with difficult type (mostly for python) @@ -73,7 +73,7 @@ Test for a parameter with difficult type :param a: Very strange param""" ) -commentVerifier.check(inspect.getdoc(doxygen_basic_translate.Atan2), +comment_verifier.check(inspect.getdoc(doxygen_basic_translate.Atan2), """\ Multiple parameters test. diff --git a/Examples/test-suite/python/doxygen_ignore_runme.py b/Examples/test-suite/python/doxygen_ignore_runme.py index 9e2e73da7..33329d2de 100644 --- a/Examples/test-suite/python/doxygen_ignore_runme.py +++ b/Examples/test-suite/python/doxygen_ignore_runme.py @@ -2,9 +2,9 @@ import doxygen_ignore import inspect -import commentVerifier +import comment_verifier -commentVerifier.check(inspect.getdoc(doxygen_ignore.func), +comment_verifier.check(inspect.getdoc(doxygen_ignore.func), """\ A contrived example of ignoring too many commands in one comment. diff --git a/Examples/test-suite/python/doxygen_misc_constructs_runme.py b/Examples/test-suite/python/doxygen_misc_constructs_runme.py index 316d7e69b..32ee912fd 100644 --- a/Examples/test-suite/python/doxygen_misc_constructs_runme.py +++ b/Examples/test-suite/python/doxygen_misc_constructs_runme.py @@ -4,10 +4,10 @@ import doxygen_misc_constructs import inspect import string import sys -import commentVerifier +import comment_verifier -commentVerifier.check(inspect.getdoc(doxygen_misc_constructs.getAddress), +comment_verifier.check(inspect.getdoc(doxygen_misc_constructs.getAddress), r"""Returns address of file line. :type fileName: int @@ -19,7 +19,7 @@ commentVerifier.check(inspect.getdoc(doxygen_misc_constructs.getAddress), Connection::getId() """) -commentVerifier.check(inspect.getdoc(doxygen_misc_constructs.CConnectionConfig), +comment_verifier.check(inspect.getdoc(doxygen_misc_constructs.CConnectionConfig), r"""This class contains information for connection to winIDEA. Its methods return reference to self, so we can use it like this: @@ -34,26 +34,26 @@ used for unspecified parameters. advancedWinIDEALaunching.py Python example.""") -commentVerifier.check(inspect.getdoc(doxygen_misc_constructs.waitTime), +comment_verifier.check(inspect.getdoc(doxygen_misc_constructs.waitTime), r"""Determines how long the ``isystem.connect`` should wait for running instances to respond. Only one of ``lfWaitXXX`` flags from IConnect::ELaunchFlags may be specified.""" ) -commentVerifier.check(inspect.getdoc(doxygen_misc_constructs.getConnection), +comment_verifier.check(inspect.getdoc(doxygen_misc_constructs.getConnection), r"""This function returns connection id.""" ) -commentVerifier.check(inspect.getdoc(doxygen_misc_constructs.getFirstLetter), +comment_verifier.check(inspect.getdoc(doxygen_misc_constructs.getFirstLetter), r'' ) -commentVerifier.check(inspect.getdoc(doxygen_misc_constructs.ClassWithNestedEnum), +comment_verifier.check(inspect.getdoc(doxygen_misc_constructs.ClassWithNestedEnum), r"""Class description.""" ) -commentVerifier.check(inspect.getdoc(doxygen_misc_constructs.showList), +comment_verifier.check(inspect.getdoc(doxygen_misc_constructs.showList), r"""An example of a list in a documentation comment. - The first item of the list. @@ -66,24 +66,24 @@ commentVerifier.check(inspect.getdoc(doxygen_misc_constructs.showList), And this is not a list item any more.""" ) -commentVerifier.check(inspect.getdoc(doxygen_misc_constructs.isNoSpaceValidA), +comment_verifier.check(inspect.getdoc(doxygen_misc_constructs.isNoSpaceValidA), r"""This comment without space after '*' is valid in Doxygen.""" ) -commentVerifier.check(inspect.getdoc(doxygen_misc_constructs.isNoSpaceValidB), +comment_verifier.check(inspect.getdoc(doxygen_misc_constructs.isNoSpaceValidB), r""".This comment without space after '*' is valid in Doxygen.""" ) -commentVerifier.check(inspect.getdoc(doxygen_misc_constructs.isNoSpaceValidC), +comment_verifier.check(inspect.getdoc(doxygen_misc_constructs.isNoSpaceValidC), r'' ) -commentVerifier.check(inspect.getdoc(doxygen_misc_constructs.backslashA), +comment_verifier.check(inspect.getdoc(doxygen_misc_constructs.backslashA), r"""Backslash following``word`` is a valid doxygen command. Output contains 'followingword' with 'word' in code font.""" ) -commentVerifier.check(inspect.getdoc(doxygen_misc_constructs.backslashB), +comment_verifier.check(inspect.getdoc(doxygen_misc_constructs.backslashB), r"""Doxy command without trailing space is ignored - nothing appears on output. Standalone \ and '\' get to output. Standalone @ and '@' get to output. @@ -98,7 +98,7 @@ Commands for escaped symbols: $ @ \ & ~ < > # % " . :: @text ::text""" ) -commentVerifier.check(inspect.getdoc(doxygen_misc_constructs.backslashC), +comment_verifier.check(inspect.getdoc(doxygen_misc_constructs.backslashC), r"""Backslash e at end of *line* froze SWIG *with* old comment parser. @@ -107,7 +107,7 @@ See also: MyClass::fun(char, ) -commentVerifier.check(inspect.getdoc(doxygen_misc_constructs.cycle), +comment_verifier.check(inspect.getdoc(doxygen_misc_constructs.cycle), r"""The next line contains expression: ['retVal < 10', 'g_counter == 23 && g_mode & 3'] diff --git a/Examples/test-suite/python/doxygen_parsing_runme.py b/Examples/test-suite/python/doxygen_parsing_runme.py index 22ad83020..20e840df5 100644 --- a/Examples/test-suite/python/doxygen_parsing_runme.py +++ b/Examples/test-suite/python/doxygen_parsing_runme.py @@ -5,20 +5,20 @@ import inspect import string import os import sys -import commentVerifier +import comment_verifier -commentVerifier.check(inspect.getdoc(doxygen_parsing.someFunction), +comment_verifier.check(inspect.getdoc(doxygen_parsing.someFunction), "The function comment") -commentVerifier.check(inspect.getdoc(doxygen_parsing.SomeClass), +comment_verifier.check(inspect.getdoc(doxygen_parsing.SomeClass), "The class comment") -commentVerifier.check(inspect.getdoc(doxygen_parsing.SomeStruct), +comment_verifier.check(inspect.getdoc(doxygen_parsing.SomeStruct), "The struct comment") # There doesn't seem to be any way to specify the doc string for __init__ when # using "-builtin" (see http://stackoverflow.com/q/11913492/15275), so skip # this test in this case. if str(os.environ.get('SWIG_FEATURES')).find('-builtin') == -1: - commentVerifier.check(inspect.getdoc(doxygen_parsing.SomeAnotherClass.__init__), + comment_verifier.check(inspect.getdoc(doxygen_parsing.SomeAnotherClass.__init__), r"""*Overload 1:* First overloaded constructor. @@ -27,11 +27,11 @@ First overloaded constructor. *Overload 2:* Second overloaded constructor.""") -commentVerifier.check(inspect.getdoc(doxygen_parsing.SomeAnotherClass.classMethod), +comment_verifier.check(inspect.getdoc(doxygen_parsing.SomeAnotherClass.classMethod), r"""The class method comment. SomeAnotherClass#classMethodExtended(int, int) a link text""") -commentVerifier.check(inspect.getdoc(doxygen_parsing.SomeAnotherClass.classMethodExtended), +comment_verifier.check(inspect.getdoc(doxygen_parsing.SomeAnotherClass.classMethodExtended), r"""The class method with parameter :type a: int @@ -39,7 +39,7 @@ commentVerifier.check(inspect.getdoc(doxygen_parsing.SomeAnotherClass.classMetho :type b: int :param b: Parameter b""" ) -commentVerifier.check(inspect.getdoc(doxygen_parsing.SomeAnotherClass.classMethodExtended2), +comment_verifier.check(inspect.getdoc(doxygen_parsing.SomeAnotherClass.classMethodExtended2), r"""The class method with parameter :type a: int @@ -47,9 +47,9 @@ commentVerifier.check(inspect.getdoc(doxygen_parsing.SomeAnotherClass.classMetho :type b: int :param b: Parameter b""" ) -commentVerifier.check(inspect.getdoc(doxygen_parsing.SomeAnotherStruct.structMethod), +comment_verifier.check(inspect.getdoc(doxygen_parsing.SomeAnotherStruct.structMethod), r"""The struct method comment""") -commentVerifier.check(inspect.getdoc(doxygen_parsing.SomeAnotherStruct.structMethodExtended), +comment_verifier.check(inspect.getdoc(doxygen_parsing.SomeAnotherStruct.structMethodExtended), r"""The struct method with parameter :type a: int @@ -57,7 +57,7 @@ commentVerifier.check(inspect.getdoc(doxygen_parsing.SomeAnotherStruct.structMet :type b: int :param b: Parameter b""" ) -commentVerifier.check(inspect.getdoc(doxygen_parsing.SomeAnotherStruct.structMethodExtended2), +comment_verifier.check(inspect.getdoc(doxygen_parsing.SomeAnotherStruct.structMethodExtended2), r"""The struct method with parameter :type a: int diff --git a/Examples/test-suite/python/doxygen_translate_all_tags_runme.py b/Examples/test-suite/python/doxygen_translate_all_tags_runme.py index f26c44328..ed66f4bcd 100644 --- a/Examples/test-suite/python/doxygen_translate_all_tags_runme.py +++ b/Examples/test-suite/python/doxygen_translate_all_tags_runme.py @@ -4,10 +4,10 @@ import doxygen_translate_all_tags import inspect import string import sys -import commentVerifier +import comment_verifier -commentVerifier.check(inspect.getdoc(doxygen_translate_all_tags.func01), +comment_verifier.check(inspect.getdoc(doxygen_translate_all_tags.func01), r"""*Hello* @@ -41,7 +41,7 @@ Not everything works right now... some test code""") -commentVerifier.check(inspect.getdoc(doxygen_translate_all_tags.func02), +comment_verifier.check(inspect.getdoc(doxygen_translate_all_tags.func02), r"""Conditional comment: SOMECONDITION Some conditional comment End of conditional comment. @@ -65,7 +65,7 @@ Deprecated: Now use another function This is very large and detailed description of some thing""") -commentVerifier.check(inspect.getdoc(doxygen_translate_all_tags.func03), +comment_verifier.check(inspect.getdoc(doxygen_translate_all_tags.func03), r"""Comment for **func03()**. @@ -85,7 +85,7 @@ emphazedWord Example: someFile.txt Some details on using the example""") -commentVerifier.check(inspect.getdoc(doxygen_translate_all_tags.func04), +comment_verifier.check(inspect.getdoc(doxygen_translate_all_tags.func04), r""":raises: SuperError @@ -116,7 +116,7 @@ r""":raises: SuperError This will only appear in hmtl""") -commentVerifier.check(inspect.getdoc(doxygen_translate_all_tags.func05), +comment_verifier.check(inspect.getdoc(doxygen_translate_all_tags.func05), r"""If: ANOTHERCONDITION { First part of comment If: SECONDCONDITION { @@ -150,7 +150,7 @@ Image: testImage.bmp("Hello, world!") Some text describing invariant.""") -commentVerifier.check(inspect.getdoc(doxygen_translate_all_tags.func06), +comment_verifier.check(inspect.getdoc(doxygen_translate_all_tags.func06), r"""Comment for **func06()**. @@ -175,7 +175,7 @@ someMember Some description follows This will only appear in man""") -commentVerifier.check(inspect.getdoc(doxygen_translate_all_tags.func07), +comment_verifier.check(inspect.getdoc(doxygen_translate_all_tags.func07), r"""Comment for **func07()**. @@ -204,7 +204,7 @@ Maybe even multiline :type a: int :param a: the first param""") -commentVerifier.check(inspect.getdoc(doxygen_translate_all_tags.func08), +comment_verifier.check(inspect.getdoc(doxygen_translate_all_tags.func08), r"""Text after anchor. @@ -239,7 +239,7 @@ Another remarks section :rtype: void :return: may return""") -commentVerifier.check(inspect.getdoc(doxygen_translate_all_tags.func09), +comment_verifier.check(inspect.getdoc(doxygen_translate_all_tags.func09), r"""This will only appear in RTF @@ -274,7 +274,7 @@ Since: version 0.0.0.1 :raises: RuntimeError""") -commentVerifier.check(inspect.getdoc(doxygen_translate_all_tags.func10), +comment_verifier.check(inspect.getdoc(doxygen_translate_all_tags.func10), r"""TODO: Some very important task :type b: float diff --git a/Examples/test-suite/python/doxygen_translate_links_runme.py b/Examples/test-suite/python/doxygen_translate_links_runme.py index f0df1ebc1..b7e2b73fa 100644 --- a/Examples/test-suite/python/doxygen_translate_links_runme.py +++ b/Examples/test-suite/python/doxygen_translate_links_runme.py @@ -4,10 +4,10 @@ import doxygen_translate_links import inspect import string import sys -import commentVerifier +import comment_verifier -commentVerifier.check(inspect.getdoc(doxygen_translate_links.function), +comment_verifier.check(inspect.getdoc(doxygen_translate_links.function), r"""Testing typenames converting in @ link superFunc(int,std::string) diff --git a/Examples/test-suite/python/doxygen_translate_runme.py b/Examples/test-suite/python/doxygen_translate_runme.py index 9a2ce53a2..cbdde5fec 100644 --- a/Examples/test-suite/python/doxygen_translate_runme.py +++ b/Examples/test-suite/python/doxygen_translate_runme.py @@ -4,10 +4,10 @@ import doxygen_translate import inspect import string import sys -import commentVerifier +import comment_verifier -commentVerifier.check(inspect.getdoc(doxygen_translate.function), +comment_verifier.check(inspect.getdoc(doxygen_translate.function), r"""*Hello* * some list item @@ -140,7 +140,7 @@ And here goes simple text""" -commentVerifier.check(inspect.getdoc(doxygen_translate.htmlFunction), +comment_verifier.check(inspect.getdoc(doxygen_translate.htmlFunction), r"""Test for html tags. See Doxygen doc for list of tags recognized by Doxygen. This is link ("http://acme.com/index.html") @@ -224,7 +224,7 @@ Starts a piece of text displayed in a typewriter font. underlined \b bold text - doxy commands are ignored inside 'htmlonly' section """) -commentVerifier.check(inspect.getdoc(doxygen_translate.htmlTableFunction), +comment_verifier.check(inspect.getdoc(doxygen_translate.htmlTableFunction), r"""The meaning of flags: :type byFlags: int @@ -240,7 +240,7 @@ r"""The meaning of flags: ``htmlTable...`` functions.""") -commentVerifier.check(inspect.getdoc(doxygen_translate.htmlEntitiesFunction), +comment_verifier.check(inspect.getdoc(doxygen_translate.htmlEntitiesFunction), r"""All entities are treated as commands (C) TM (R) should work also From 7d1578e58cd57199e5f9c48b38afefaa2ac89bf5 Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Thu, 24 May 2018 20:00:03 +0100 Subject: [PATCH 301/314] Add omitted doxygen_parsing_enums testcase Still needs a Python runtime test --- Examples/test-suite/common.mk | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Examples/test-suite/common.mk b/Examples/test-suite/common.mk index e94ff7b02..520c1bbfe 100644 --- a/Examples/test-suite/common.mk +++ b/Examples/test-suite/common.mk @@ -607,15 +607,16 @@ $(eval HAS_DOXYGEN := $($(LANGUAGE)_HAS_DOXYGEN)) ifdef HAS_DOXYGEN DOXYGEN_TEST_CASES += \ - doxygen_parsing \ doxygen_alias \ - doxygen_ignore \ - doxygen_basic_translate \ doxygen_basic_notranslate \ + doxygen_basic_translate \ + doxygen_ignore \ + doxygen_misc_constructs \ + doxygen_parsing \ + doxygen_parsing_enums \ doxygen_translate \ doxygen_translate_all_tags \ doxygen_translate_links \ - doxygen_misc_constructs \ $(DOXYGEN_TEST_CASES:=.cpptest): SWIGOPT += -doxygen From 8344aec3a3cd999636f7908667024d5e13de8338 Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Fri, 25 May 2018 08:27:47 +0100 Subject: [PATCH 302/314] Java enums output format fixes Restore generated Java enum code output to what it was pre-doxygen code changes. Improves code with doxygen comments too. --- Source/Modules/java.cxx | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Source/Modules/java.cxx b/Source/Modules/java.cxx index 4a895f308..7a4bc8214 100644 --- a/Source/Modules/java.cxx +++ b/Source/Modules/java.cxx @@ -1373,9 +1373,7 @@ public: } Printv(f_enum, typemapLookup(n, "javaimports", typemap_lookup_type, WARN_NONE), // Import statements - "\n\n", NIL); - - Printv(f_enum, enum_code, "\n", NIL); + "\n", enum_code, "\n", NIL); Printf(f_enum, "\n"); Delete(f_enum); @@ -1469,6 +1467,11 @@ public: if (!addSymbol(symname, n, scope)) return SWIG_ERROR; + if ((enum_feature == ProperEnum) && parent_name && !unnamedinstance) { + if (!GetFlag(n, "firstenumitem")) + Printf(enum_code, ",\n"); + } + // Translate and write javadoc comment if flagged if (doxygen && doxygenTranslator->hasDocumentation(n)) { String *doxygen_comments = doxygenTranslator->getDocumentation(n); @@ -1481,14 +1484,12 @@ public: if ((enum_feature == ProperEnum) && parent_name && !unnamedinstance) { // Wrap (non-anonymous) C/C++ enum with a proper Java enum // Emit the enum item. - Printf(enum_code, " %s", symname); if (Getattr(n, "enumvalue")) { String *value = enumValue(n); Printf(enum_code, "(%s)", value); Delete(value); } - Printf(enum_code, ",\n"); } else { // Wrap C/C++ enums with constant integers or use the typesafe enum pattern SwigType *typemap_lookup_type = parent_name ? parent_name : NewString("enum "); From 448691cfa8bc408bb7b38aba59ad2d66f5f48579 Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Fri, 25 May 2018 23:18:57 +0100 Subject: [PATCH 303/314] Another merge fix from doxygen branches --- Examples/test-suite/python/Makefile.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Examples/test-suite/python/Makefile.in b/Examples/test-suite/python/Makefile.in index b26253329..e2aad7c8b 100644 --- a/Examples/test-suite/python/Makefile.in +++ b/Examples/test-suite/python/Makefile.in @@ -167,7 +167,7 @@ convert_testcase = \ $(MAKE) $(SCRIPTDIR)/$(py_runme); \ fi -$(SCRIPTDIR)/$(SCRIPTPREFIX)%$(SCRIPTSUFFIX): $(abspath $(srcdir)/$(SCRIPTPREFIX)%$(PY2SCRIPTSUFFIX)) +$(SCRIPTDIR)/$(SCRIPTPREFIX)%$(SCRIPTSUFFIX): $(srcdir)/$(SCRIPTPREFIX)%$(PY2SCRIPTSUFFIX) test x$< = x$@ || cp $< $@ || exit 1 test x$(PY3) = x || $(PY2TO3) -w $@ >/dev/null 2>&1 || exit 1 From d1e0912ac0397bd0c2be697799069c5a6c581ea5 Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Fri, 25 May 2018 23:35:06 +0100 Subject: [PATCH 304/314] Correct source code headers --- Source/DoxygenTranslator/src/DoxygenCommands.h | 12 ++++++++++++ Source/DoxygenTranslator/src/DoxygenEntity.cpp | 4 ++-- Source/DoxygenTranslator/src/DoxygenEntity.h | 2 +- Source/DoxygenTranslator/src/DoxygenParser.cpp | 4 ++-- Source/DoxygenTranslator/src/DoxygenParser.h | 2 +- Source/DoxygenTranslator/src/DoxygenTranslator.cpp | 4 ++-- Source/DoxygenTranslator/src/DoxygenTranslator.h | 2 +- Source/DoxygenTranslator/src/JavaDocConverter.cpp | 4 ++-- Source/DoxygenTranslator/src/JavaDocConverter.h | 2 +- Source/DoxygenTranslator/src/PyDocConverter.cpp | 4 ++-- Source/DoxygenTranslator/src/PyDocConverter.h | 2 +- 11 files changed, 27 insertions(+), 15 deletions(-) diff --git a/Source/DoxygenTranslator/src/DoxygenCommands.h b/Source/DoxygenTranslator/src/DoxygenCommands.h index 0be6a1851..eca148a50 100644 --- a/Source/DoxygenTranslator/src/DoxygenCommands.h +++ b/Source/DoxygenTranslator/src/DoxygenCommands.h @@ -1,3 +1,15 @@ +/* ----------------------------------------------------------------------------- + * This file is part of SWIG, which is licensed as a whole under version 3 + * (or any later version) of the GNU General Public License. Some additional + * terms also apply to certain portions of SWIG. The full details of the SWIG + * license and copyrights can be found in the LICENSE and COPYRIGHT files + * included with the SWIG source code as distributed by the SWIG developers + * and at http://www.swig.org/legal.html. + * + * DoxygenCommands.h + * + * Part of the Doxygen comment translation module of SWIG. + * ----------------------------------------------------------------------------- */ #ifndef DOXYGENCOMMANDS_H #define DOXYGENCOMMANDS_H diff --git a/Source/DoxygenTranslator/src/DoxygenEntity.cpp b/Source/DoxygenTranslator/src/DoxygenEntity.cpp index 98329e84f..7e977ee9b 100644 --- a/Source/DoxygenTranslator/src/DoxygenEntity.cpp +++ b/Source/DoxygenTranslator/src/DoxygenEntity.cpp @@ -1,5 +1,5 @@ -/* ----------------------------------------------------------------------------- - * This file is part of SWIG, which is licensed as a whole under version 3 +/* ----------------------------------------------------------------------------- + * This file is part of SWIG, which is licensed as a whole under version 3 * (or any later version) of the GNU General Public License. Some additional * terms also apply to certain portions of SWIG. The full details of the SWIG * license and copyrights can be found in the LICENSE and COPYRIGHT files diff --git a/Source/DoxygenTranslator/src/DoxygenEntity.h b/Source/DoxygenTranslator/src/DoxygenEntity.h index 29a0e2076..3c243462c 100644 --- a/Source/DoxygenTranslator/src/DoxygenEntity.h +++ b/Source/DoxygenTranslator/src/DoxygenEntity.h @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------------- - * This file is part of SWIG, which is licensed as a whole under version 3 + * This file is part of SWIG, which is licensed as a whole under version 3 * (or any later version) of the GNU General Public License. Some additional * terms also apply to certain portions of SWIG. The full details of the SWIG * license and copyrights can be found in the LICENSE and COPYRIGHT files diff --git a/Source/DoxygenTranslator/src/DoxygenParser.cpp b/Source/DoxygenTranslator/src/DoxygenParser.cpp index c14cdb9fd..4c7bcdd1c 100644 --- a/Source/DoxygenTranslator/src/DoxygenParser.cpp +++ b/Source/DoxygenTranslator/src/DoxygenParser.cpp @@ -1,5 +1,5 @@ -/* ----------------------------------------------------------------------------- - * This file is part of SWIG, which is licensed as a whole under version 3 +/* ----------------------------------------------------------------------------- + * This file is part of SWIG, which is licensed as a whole under version 3 * (or any later version) of the GNU General Public License. Some additional * terms also apply to certain portions of SWIG. The full details of the SWIG * license and copyrights can be found in the LICENSE and COPYRIGHT files diff --git a/Source/DoxygenTranslator/src/DoxygenParser.h b/Source/DoxygenTranslator/src/DoxygenParser.h index 35204e670..ec5e24cc2 100644 --- a/Source/DoxygenTranslator/src/DoxygenParser.h +++ b/Source/DoxygenTranslator/src/DoxygenParser.h @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------------- - * This file is part of SWIG, which is licensed as a whole under version 3 + * This file is part of SWIG, which is licensed as a whole under version 3 * (or any later version) of the GNU General Public License. Some additional * terms also apply to certain portions of SWIG. The full details of the SWIG * license and copyrights can be found in the LICENSE and COPYRIGHT files diff --git a/Source/DoxygenTranslator/src/DoxygenTranslator.cpp b/Source/DoxygenTranslator/src/DoxygenTranslator.cpp index 111822660..bd5963973 100644 --- a/Source/DoxygenTranslator/src/DoxygenTranslator.cpp +++ b/Source/DoxygenTranslator/src/DoxygenTranslator.cpp @@ -1,5 +1,5 @@ -/* ----------------------------------------------------------------------------- - * This file is part of SWIG, which is licensed as a whole under version 3 +/* ----------------------------------------------------------------------------- + * This file is part of SWIG, which is licensed as a whole under version 3 * (or any later version) of the GNU General Public License. Some additional * terms also apply to certain portions of SWIG. The full details of the SWIG * license and copyrights can be found in the LICENSE and COPYRIGHT files diff --git a/Source/DoxygenTranslator/src/DoxygenTranslator.h b/Source/DoxygenTranslator/src/DoxygenTranslator.h index ae7c211ba..35e521898 100644 --- a/Source/DoxygenTranslator/src/DoxygenTranslator.h +++ b/Source/DoxygenTranslator/src/DoxygenTranslator.h @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------------- - * This file is part of SWIG, which is licensed as a whole under version 3 + * This file is part of SWIG, which is licensed as a whole under version 3 * (or any later version) of the GNU General Public License. Some additional * terms also apply to certain portions of SWIG. The full details of the SWIG * license and copyrights can be found in the LICENSE and COPYRIGHT files diff --git a/Source/DoxygenTranslator/src/JavaDocConverter.cpp b/Source/DoxygenTranslator/src/JavaDocConverter.cpp index 90da0eb1a..c2fd8577e 100644 --- a/Source/DoxygenTranslator/src/JavaDocConverter.cpp +++ b/Source/DoxygenTranslator/src/JavaDocConverter.cpp @@ -1,5 +1,5 @@ -/* ----------------------------------------------------------------------------- - * This file is part of SWIG, which is licensed as a whole under version 3 +/* ----------------------------------------------------------------------------- + * This file is part of SWIG, which is licensed as a whole under version 3 * (or any later version) of the GNU General Public License. Some additional * terms also apply to certain portions of SWIG. The full details of the SWIG * license and copyrights can be found in the LICENSE and COPYRIGHT files diff --git a/Source/DoxygenTranslator/src/JavaDocConverter.h b/Source/DoxygenTranslator/src/JavaDocConverter.h index df579e625..100a77818 100644 --- a/Source/DoxygenTranslator/src/JavaDocConverter.h +++ b/Source/DoxygenTranslator/src/JavaDocConverter.h @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------------- - * This file is part of SWIG, which is licensed as a whole under version 3 + * This file is part of SWIG, which is licensed as a whole under version 3 * (or any later version) of the GNU General Public License. Some additional * terms also apply to certain portions of SWIG. The full details of the SWIG * license and copyrights can be found in the LICENSE and COPYRIGHT files diff --git a/Source/DoxygenTranslator/src/PyDocConverter.cpp b/Source/DoxygenTranslator/src/PyDocConverter.cpp index b6aaa2d91..5edf7fa18 100644 --- a/Source/DoxygenTranslator/src/PyDocConverter.cpp +++ b/Source/DoxygenTranslator/src/PyDocConverter.cpp @@ -1,5 +1,5 @@ -/* ----------------------------------------------------------------------------- - * This file is part of SWIG, which is licensed as a whole under version 3 +/* ----------------------------------------------------------------------------- + * This file is part of SWIG, which is licensed as a whole under version 3 * (or any later version) of the GNU General Public License. Some additional * terms also apply to certain portions of SWIG. The full details of the SWIG * license and copyrights can be found in the LICENSE and COPYRIGHT files diff --git a/Source/DoxygenTranslator/src/PyDocConverter.h b/Source/DoxygenTranslator/src/PyDocConverter.h index b78d81ed3..88e8f1f91 100644 --- a/Source/DoxygenTranslator/src/PyDocConverter.h +++ b/Source/DoxygenTranslator/src/PyDocConverter.h @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------------- - * This file is part of SWIG, which is licensed as a whole under version 3 + * This file is part of SWIG, which is licensed as a whole under version 3 * (or any later version) of the GNU General Public License. Some additional * terms also apply to certain portions of SWIG. The full details of the SWIG * license and copyrights can be found in the LICENSE and COPYRIGHT files From 823465649714f37b6e929c239542f43d950bea4c Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Fri, 25 May 2018 23:35:28 +0100 Subject: [PATCH 305/314] Correct python example headers --- Examples/test-suite/python/doxygen_alias_runme.py | 2 -- Examples/test-suite/python/doxygen_basic_notranslate_runme.py | 2 -- Examples/test-suite/python/doxygen_basic_translate_runme.py | 2 -- Examples/test-suite/python/doxygen_ignore_runme.py | 2 -- Examples/test-suite/python/doxygen_misc_constructs_runme.py | 2 -- Examples/test-suite/python/doxygen_parsing_runme.py | 2 -- Examples/test-suite/python/doxygen_translate_all_tags_runme.py | 2 -- Examples/test-suite/python/doxygen_translate_links_runme.py | 2 -- Examples/test-suite/python/doxygen_translate_runme.py | 2 -- 9 files changed, 18 deletions(-) diff --git a/Examples/test-suite/python/doxygen_alias_runme.py b/Examples/test-suite/python/doxygen_alias_runme.py index ad580f719..505261bcd 100644 --- a/Examples/test-suite/python/doxygen_alias_runme.py +++ b/Examples/test-suite/python/doxygen_alias_runme.py @@ -1,5 +1,3 @@ -#!/usr/bin/python - import doxygen_alias import inspect import comment_verifier diff --git a/Examples/test-suite/python/doxygen_basic_notranslate_runme.py b/Examples/test-suite/python/doxygen_basic_notranslate_runme.py index 17c03e32d..81ac99975 100644 --- a/Examples/test-suite/python/doxygen_basic_notranslate_runme.py +++ b/Examples/test-suite/python/doxygen_basic_notranslate_runme.py @@ -1,5 +1,3 @@ -#!/usr/bin/python - import doxygen_basic_notranslate import inspect import string diff --git a/Examples/test-suite/python/doxygen_basic_translate_runme.py b/Examples/test-suite/python/doxygen_basic_translate_runme.py index 1be6b6b07..e664e06f6 100644 --- a/Examples/test-suite/python/doxygen_basic_translate_runme.py +++ b/Examples/test-suite/python/doxygen_basic_translate_runme.py @@ -1,5 +1,3 @@ -#!/usr/bin/python - import doxygen_basic_translate import inspect import string diff --git a/Examples/test-suite/python/doxygen_ignore_runme.py b/Examples/test-suite/python/doxygen_ignore_runme.py index 33329d2de..9a7b2e5df 100644 --- a/Examples/test-suite/python/doxygen_ignore_runme.py +++ b/Examples/test-suite/python/doxygen_ignore_runme.py @@ -1,5 +1,3 @@ -#!/usr/bin/python - import doxygen_ignore import inspect import comment_verifier diff --git a/Examples/test-suite/python/doxygen_misc_constructs_runme.py b/Examples/test-suite/python/doxygen_misc_constructs_runme.py index 32ee912fd..c441c3dfe 100644 --- a/Examples/test-suite/python/doxygen_misc_constructs_runme.py +++ b/Examples/test-suite/python/doxygen_misc_constructs_runme.py @@ -1,5 +1,3 @@ -#!/usr/bin/python - import doxygen_misc_constructs import inspect import string diff --git a/Examples/test-suite/python/doxygen_parsing_runme.py b/Examples/test-suite/python/doxygen_parsing_runme.py index 20e840df5..14579281d 100644 --- a/Examples/test-suite/python/doxygen_parsing_runme.py +++ b/Examples/test-suite/python/doxygen_parsing_runme.py @@ -1,5 +1,3 @@ -#!/usr/bin/python - import doxygen_parsing import inspect import string diff --git a/Examples/test-suite/python/doxygen_translate_all_tags_runme.py b/Examples/test-suite/python/doxygen_translate_all_tags_runme.py index ed66f4bcd..53d087e69 100644 --- a/Examples/test-suite/python/doxygen_translate_all_tags_runme.py +++ b/Examples/test-suite/python/doxygen_translate_all_tags_runme.py @@ -1,5 +1,3 @@ -#!/usr/bin/python - import doxygen_translate_all_tags import inspect import string diff --git a/Examples/test-suite/python/doxygen_translate_links_runme.py b/Examples/test-suite/python/doxygen_translate_links_runme.py index b7e2b73fa..89f276f6e 100644 --- a/Examples/test-suite/python/doxygen_translate_links_runme.py +++ b/Examples/test-suite/python/doxygen_translate_links_runme.py @@ -1,5 +1,3 @@ -#!/usr/bin/python - import doxygen_translate_links import inspect import string diff --git a/Examples/test-suite/python/doxygen_translate_runme.py b/Examples/test-suite/python/doxygen_translate_runme.py index cbdde5fec..2d0840a1f 100644 --- a/Examples/test-suite/python/doxygen_translate_runme.py +++ b/Examples/test-suite/python/doxygen_translate_runme.py @@ -1,5 +1,3 @@ -#!/usr/bin/python - import doxygen_translate import inspect import string From 0ae73a67ff4ceed3a70991fbd05c7f93305f31be Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Fri, 25 May 2018 23:36:24 +0100 Subject: [PATCH 306/314] More merge fixes from doxygen branches --- Examples/php/reference/runme-proxy.php4 | 79 ------------------------ Examples/php/variables/runme.php4.old | 80 ------------------------- 2 files changed, 159 deletions(-) delete mode 100644 Examples/php/reference/runme-proxy.php4 delete mode 100644 Examples/php/variables/runme.php4.old diff --git a/Examples/php/reference/runme-proxy.php4 b/Examples/php/reference/runme-proxy.php4 deleted file mode 100644 index 9d216f78b..000000000 --- a/Examples/php/reference/runme-proxy.php4 +++ /dev/null @@ -1,79 +0,0 @@ -print() . "\n"; -print " Created b: $b " . $b->print() . "\n"; - -# ----- Call an overloaded operator ----- - -# This calls the wrapper we placed around -# -# operator+(const Vector &a, const Vector &) -# -# It returns a new allocated object. - -print "Adding a+b\n"; -$c = addv($a,$b); -print " a+b =". $c->print()."\n"; - -# Note: Unless we free the result, a memory leak will occur -$c = 0; - -# ----- Create a vector array ----- - -# Note: Using the high-level interface here -print "Creating an array of vectors\n"; -$va = new VectorArray(10); - -print " va: $va size=".$va->size()."\n"; - -# ----- Set some values in the array ----- - -# These operators copy the value of $a and $b to the vector array -$va->set(0,$a); -$va->set(1,$b); - -$va->get(0); -# This will work, but it will cause a memory leak! - -$va->set(2,addv($a,$b)); - -# The non-leaky way to do it - -$c = addv($a,$b); -$va->set(3,$c); -$c = NULL; - -# Get some values from the array - -print "Getting some array values\n"; -for ($i = 0; $i < 5; $i++) { -print "do $i\n"; - $v = $va->get($i); - print " va($i) = ". $v->print(). "\n"; -} - -# Watch under resource meter to check on this -#print "Making sure we don't leak memory.\n"; -#for ($i = 0; $i < 1000000; $i++) { -# $c = VectorArray_get($va,$i % 10); -#} - -# ----- Clean up ----- -print "Cleaning up\n"; -# wants fixing FIXME -#delete_VectorArray($va); -#delete_Vector($a); -#delete_Vector($b); - -?> diff --git a/Examples/php/variables/runme.php4.old b/Examples/php/variables/runme.php4.old deleted file mode 100644 index 9a6bfb386..000000000 --- a/Examples/php/variables/runme.php4.old +++ /dev/null @@ -1,80 +0,0 @@ - - From ac85784a76066870b47ea624ccd155098ec0c4ee Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Sat, 26 May 2018 12:52:52 +0100 Subject: [PATCH 307/314] Doxygen source rename Source/DoxygenTranslator/src directory is renamed Source/Doxygen Renamed files in this directory to short names using lowercase as is the convention for the rest of the SWIG source. C++ extension is also .cxx like other SWIG source code. I used doxy as the prefix for most file renames because without this Doxygen/parser.* would be easily confused with CParse/parser.* so Doxygen/doxyparser.* is renamed from DoxygenTranslator/src/DoxygenParser.* --- Doc/Devel/plan-gsoc-2012.txt | 2 +- Doc/Manual/Doxygen.html | 2 +- .../doxycommands.h} | 2 +- .../doxyentity.cxx} | 4 ++-- .../DoxygenEntity.h => Doxygen/doxyentity.h} | 2 +- .../doxyparser.cxx} | 8 +++---- .../DoxygenParser.h => Doxygen/doxyparser.h} | 4 ++-- .../doxytranslator.cxx} | 4 ++-- .../doxytranslator.h} | 6 ++--- .../javadoc.cxx} | 8 +++---- .../JavaDocConverter.h => Doxygen/javadoc.h} | 4 ++-- .../PyDocConverter.cpp => Doxygen/pydoc.cxx} | 6 ++--- .../src/PyDocConverter.h => Doxygen/pydoc.h} | 6 ++--- Source/Makefile.am | 24 +++++++++---------- Source/Modules/java.cxx | 2 +- Source/Modules/python.cxx | 2 +- 16 files changed, 43 insertions(+), 43 deletions(-) rename Source/{DoxygenTranslator/src/DoxygenCommands.h => Doxygen/doxycommands.h} (99%) rename Source/{DoxygenTranslator/src/DoxygenEntity.cpp => Doxygen/doxyentity.cxx} (97%) rename Source/{DoxygenTranslator/src/DoxygenEntity.h => Doxygen/doxyentity.h} (98%) rename Source/{DoxygenTranslator/src/DoxygenParser.cpp => Doxygen/doxyparser.cxx} (99%) rename Source/{DoxygenTranslator/src/DoxygenParser.h => Doxygen/doxyparser.h} (99%) rename Source/{DoxygenTranslator/src/DoxygenTranslator.cpp => Doxygen/doxytranslator.cxx} (96%) rename Source/{DoxygenTranslator/src/DoxygenTranslator.h => Doxygen/doxytranslator.h} (96%) rename Source/{DoxygenTranslator/src/JavaDocConverter.cpp => Doxygen/javadoc.cxx} (99%) rename Source/{DoxygenTranslator/src/JavaDocConverter.h => Doxygen/javadoc.h} (99%) rename Source/{DoxygenTranslator/src/PyDocConverter.cpp => Doxygen/pydoc.cxx} (99%) rename Source/{DoxygenTranslator/src/PyDocConverter.h => Doxygen/pydoc.h} (98%) diff --git a/Doc/Devel/plan-gsoc-2012.txt b/Doc/Devel/plan-gsoc-2012.txt index 51d387d3c..ac764fb2a 100644 --- a/Doc/Devel/plan-gsoc-2012.txt +++ b/Doc/Devel/plan-gsoc-2012.txt @@ -321,7 +321,7 @@ make doxygen_tricky_constructs.cpptest -s Refactoring =========== -All the code in directory _DoxygenTranslator_ should be refactored: +All the code in directory _Doxygen_ should be refactored: -OK- all methods should be class members -OK- most static methods should be normal members -OK- replace C arrays of strings and sequential searches with STL data diff --git a/Doc/Manual/Doxygen.html b/Doc/Manual/Doxygen.html index 08d1aef94..842f146d8 100644 --- a/Doc/Manual/Doxygen.html +++ b/Doc/Manual/Doxygen.html @@ -1741,7 +1741,7 @@ Searching for "doxygen" in the java.cxx module can give you a good idea of the p The basic gist is that anywhere a comment may reside on a node, there needs to be a catch for it in front of where that function, class, or other object is written out to a target language file. The other half of extension is building a target documentation language comment generator that handles one blob at a time. However, this is relatively simple and nowhere near as complex as the wrapper generating modules in SWIG. -See DoxygenTranslator/JavaDocConverter.cpp for a good example. +See Source/Doxygen/javadoc.cxx for a good example. The target language module passes the Doxygen Translator the blob to translate, and receives back the translated text.

    diff --git a/Source/DoxygenTranslator/src/DoxygenCommands.h b/Source/Doxygen/doxycommands.h similarity index 99% rename from Source/DoxygenTranslator/src/DoxygenCommands.h rename to Source/Doxygen/doxycommands.h index eca148a50..1f7b5fa5b 100644 --- a/Source/DoxygenTranslator/src/DoxygenCommands.h +++ b/Source/Doxygen/doxycommands.h @@ -6,7 +6,7 @@ * included with the SWIG source code as distributed by the SWIG developers * and at http://www.swig.org/legal.html. * - * DoxygenCommands.h + * doxycommands.h * * Part of the Doxygen comment translation module of SWIG. * ----------------------------------------------------------------------------- */ diff --git a/Source/DoxygenTranslator/src/DoxygenEntity.cpp b/Source/Doxygen/doxyentity.cxx similarity index 97% rename from Source/DoxygenTranslator/src/DoxygenEntity.cpp rename to Source/Doxygen/doxyentity.cxx index 7e977ee9b..8b9f65736 100644 --- a/Source/DoxygenTranslator/src/DoxygenEntity.cpp +++ b/Source/Doxygen/doxyentity.cxx @@ -6,12 +6,12 @@ * included with the SWIG source code as distributed by the SWIG developers * and at http://www.swig.org/legal.html. * - * DoxygenEntity.cpp + * doxyentity.cxx * * Part of the Doxygen comment translation module of SWIG. * ----------------------------------------------------------------------------- */ -#include "DoxygenEntity.h" +#include "doxyentity.h" #include using std::cout; diff --git a/Source/DoxygenTranslator/src/DoxygenEntity.h b/Source/Doxygen/doxyentity.h similarity index 98% rename from Source/DoxygenTranslator/src/DoxygenEntity.h rename to Source/Doxygen/doxyentity.h index 3c243462c..93737e604 100644 --- a/Source/DoxygenTranslator/src/DoxygenEntity.h +++ b/Source/Doxygen/doxyentity.h @@ -6,7 +6,7 @@ * included with the SWIG source code as distributed by the SWIG developers * and at http://www.swig.org/legal.html. * - * DoxygenEntity.h + * doxyentity.h * * Part of the Doxygen comment translation module of SWIG. * ----------------------------------------------------------------------------- */ diff --git a/Source/DoxygenTranslator/src/DoxygenParser.cpp b/Source/Doxygen/doxyparser.cxx similarity index 99% rename from Source/DoxygenTranslator/src/DoxygenParser.cpp rename to Source/Doxygen/doxyparser.cxx index 4c7bcdd1c..558b0401f 100644 --- a/Source/DoxygenTranslator/src/DoxygenParser.cpp +++ b/Source/Doxygen/doxyparser.cxx @@ -6,11 +6,11 @@ * included with the SWIG source code as distributed by the SWIG developers * and at http://www.swig.org/legal.html. * - * DoxygenParser.cpp + * doxyparser.cxx * ----------------------------------------------------------------------------- */ -#include "DoxygenParser.h" -#include "DoxygenCommands.h" +#include "doxyparser.h" +#include "doxycommands.h" #include "swig.h" #include "swigwarn.h" @@ -46,7 +46,7 @@ void DoxygenParser::fillTables() { if (doxygenCommands.size()) return; - // fill in tables with data from DoxygenCommands.h + // fill in tables with data from doxycommands.h for (int i = 0; i < simpleCommandsSize; i++) doxygenCommands[simpleCommands[i]] = SIMPLECOMMAND; diff --git a/Source/DoxygenTranslator/src/DoxygenParser.h b/Source/Doxygen/doxyparser.h similarity index 99% rename from Source/DoxygenTranslator/src/DoxygenParser.h rename to Source/Doxygen/doxyparser.h index ec5e24cc2..96c71d22f 100644 --- a/Source/DoxygenTranslator/src/DoxygenParser.h +++ b/Source/Doxygen/doxyparser.h @@ -6,7 +6,7 @@ * included with the SWIG source code as distributed by the SWIG developers * and at http://www.swig.org/legal.html. * - * DoxygenParser.h + * doxyparser.h * ----------------------------------------------------------------------------- */ #ifndef DOXYGENPARSER_H_ @@ -19,7 +19,7 @@ #include "swig.h" -#include "DoxygenEntity.h" +#include "doxyentity.h" class DoxygenParser { private: diff --git a/Source/DoxygenTranslator/src/DoxygenTranslator.cpp b/Source/Doxygen/doxytranslator.cxx similarity index 96% rename from Source/DoxygenTranslator/src/DoxygenTranslator.cpp rename to Source/Doxygen/doxytranslator.cxx index bd5963973..2684adcea 100644 --- a/Source/DoxygenTranslator/src/DoxygenTranslator.cpp +++ b/Source/Doxygen/doxytranslator.cxx @@ -6,13 +6,13 @@ * included with the SWIG source code as distributed by the SWIG developers * and at http://www.swig.org/legal.html. * - * DoxygenTranslator.cpp + * doxytranslator.cxx * * Module to return documentation for nodes formatted for various documentation * systems. * ----------------------------------------------------------------------------- */ -#include "DoxygenTranslator.h" +#include "doxytranslator.h" DoxygenTranslator::DoxygenTranslator(int flags) : m_flags(flags), parser((flags &debug_parser) != 0) { } diff --git a/Source/DoxygenTranslator/src/DoxygenTranslator.h b/Source/Doxygen/doxytranslator.h similarity index 96% rename from Source/DoxygenTranslator/src/DoxygenTranslator.h rename to Source/Doxygen/doxytranslator.h index 35e521898..ffc378a7b 100644 --- a/Source/DoxygenTranslator/src/DoxygenTranslator.h +++ b/Source/Doxygen/doxytranslator.h @@ -6,7 +6,7 @@ * included with the SWIG source code as distributed by the SWIG developers * and at http://www.swig.org/legal.html. * - * DoxygenTranslator.h + * doxytranslator.h * * Module to return documentation for nodes formatted for various documentation * systems. @@ -16,8 +16,8 @@ #define DOXYGENTRANSLATOR_H_ #include "swig.h" -#include "DoxygenEntity.h" -#include "DoxygenParser.h" +#include "doxyentity.h" +#include "doxyparser.h" #include #include diff --git a/Source/DoxygenTranslator/src/JavaDocConverter.cpp b/Source/Doxygen/javadoc.cxx similarity index 99% rename from Source/DoxygenTranslator/src/JavaDocConverter.cpp rename to Source/Doxygen/javadoc.cxx index c2fd8577e..3b81c55a5 100644 --- a/Source/DoxygenTranslator/src/JavaDocConverter.cpp +++ b/Source/Doxygen/javadoc.cxx @@ -6,15 +6,15 @@ * included with the SWIG source code as distributed by the SWIG developers * and at http://www.swig.org/legal.html. * - * JavaDocConverter.cpp + * javadoc.cxx * ----------------------------------------------------------------------------- */ -#include "JavaDocConverter.h" -#include "DoxygenParser.h" +#include "javadoc.h" +#include "doxyparser.h" #include #include #include -#include "../../Modules/swigmod.h" +#include "swigmod.h" #define APPROX_LINE_LENGTH 64 // characters per line allowed #define TAB_SIZE 8 // current tab size in spaces //TODO {@link} {@linkplain} {@docRoot}, and other useful doxy commands that are not a javadoc tag diff --git a/Source/DoxygenTranslator/src/JavaDocConverter.h b/Source/Doxygen/javadoc.h similarity index 99% rename from Source/DoxygenTranslator/src/JavaDocConverter.h rename to Source/Doxygen/javadoc.h index 100a77818..6feff5295 100644 --- a/Source/DoxygenTranslator/src/JavaDocConverter.h +++ b/Source/Doxygen/javadoc.h @@ -6,7 +6,7 @@ * included with the SWIG source code as distributed by the SWIG developers * and at http://www.swig.org/legal.html. * - * JavaDocConverter.h + * javadoc.h * * Module to return documentation for nodes formatted for JavaDoc * ----------------------------------------------------------------------------- */ @@ -14,7 +14,7 @@ #ifndef JAVADOCCONVERTER_H_ #define JAVADOCCONVERTER_H_ -#include "DoxygenTranslator.h" +#include "doxytranslator.h" #include /* diff --git a/Source/DoxygenTranslator/src/PyDocConverter.cpp b/Source/Doxygen/pydoc.cxx similarity index 99% rename from Source/DoxygenTranslator/src/PyDocConverter.cpp rename to Source/Doxygen/pydoc.cxx index 5edf7fa18..0f8484d6b 100644 --- a/Source/DoxygenTranslator/src/PyDocConverter.cpp +++ b/Source/Doxygen/pydoc.cxx @@ -6,13 +6,13 @@ * included with the SWIG source code as distributed by the SWIG developers * and at http://www.swig.org/legal.html. * - * PyDocConverter.cpp + * pydoc.cxx * * Module to return documentation for nodes formatted for PyDoc * ----------------------------------------------------------------------------- */ -#include "PyDocConverter.h" -#include "DoxygenParser.h" +#include "pydoc.h" +#include "doxyparser.h" #include #include #include diff --git a/Source/DoxygenTranslator/src/PyDocConverter.h b/Source/Doxygen/pydoc.h similarity index 98% rename from Source/DoxygenTranslator/src/PyDocConverter.h rename to Source/Doxygen/pydoc.h index 88e8f1f91..8f432fd18 100644 --- a/Source/DoxygenTranslator/src/PyDocConverter.h +++ b/Source/Doxygen/pydoc.h @@ -6,7 +6,7 @@ * included with the SWIG source code as distributed by the SWIG developers * and at http://www.swig.org/legal.html. * - * PyDocConverter.h + * pydoc.h * * Module to return documentation for nodes formatted for PyDoc * ----------------------------------------------------------------------------- */ @@ -17,8 +17,8 @@ #include #include #include "swig.h" -#include "DoxygenEntity.h" -#include "DoxygenTranslator.h" +#include "doxyentity.h" +#include "doxytranslator.h" #define DOC_STRING_LENGTH 64 // characters per line allowed #define DOC_PARAM_STRING_LENGTH 30 // characters reserved for param name / type diff --git a/Source/Makefile.am b/Source/Makefile.am index b1d6359b0..df3d4b75f 100644 --- a/Source/Makefile.am +++ b/Source/Makefile.am @@ -34,6 +34,16 @@ eswig_SOURCES = CParse/cscanner.c \ DOH/memory.c \ DOH/string.c \ DOH/void.c \ + Doxygen/doxyentity.cxx \ + Doxygen/doxyentity.h \ + Doxygen/doxyparser.cxx \ + Doxygen/doxyparser.h \ + Doxygen/doxytranslator.cxx \ + Doxygen/doxytranslator.h \ + Doxygen/javadoc.cxx \ + Doxygen/javadoc.h \ + Doxygen/pydoc.cxx \ + Doxygen/pydoc.h \ Modules/allegrocl.cxx \ Modules/allocate.cxx \ Modules/browser.cxx \ @@ -91,20 +101,10 @@ eswig_SOURCES = CParse/cscanner.c \ Swig/stype.c \ Swig/symbol.c \ Swig/tree.c \ - Swig/typeobj.c \ Swig/typemap.c \ + Swig/typeobj.c \ Swig/typesys.c \ - Swig/wrapfunc.c \ - DoxygenTranslator/src/DoxygenEntity.h\ - DoxygenTranslator/src/DoxygenEntity.cpp\ - DoxygenTranslator/src/DoxygenParser.h\ - DoxygenTranslator/src/DoxygenParser.cpp\ - DoxygenTranslator/src/DoxygenTranslator.h\ - DoxygenTranslator/src/DoxygenTranslator.cpp\ - DoxygenTranslator/src/JavaDocConverter.h\ - DoxygenTranslator/src/JavaDocConverter.cpp\ - DoxygenTranslator/src/PyDocConverter.h\ - DoxygenTranslator/src/PyDocConverter.cpp + Swig/wrapfunc.c bin_PROGRAMS = eswig eswig_LDADD = @SWIGLIBS@ diff --git a/Source/Modules/java.cxx b/Source/Modules/java.cxx index 7a4bc8214..12da307cf 100644 --- a/Source/Modules/java.cxx +++ b/Source/Modules/java.cxx @@ -15,7 +15,7 @@ #include // for INT_MAX #include "cparse.h" #include -#include "../DoxygenTranslator/src/JavaDocConverter.h" +#include "../Doxygen/javadoc.h" /* Hash type used for upcalls from C/C++ */ typedef DOH UpcallData; diff --git a/Source/Modules/python.cxx b/Source/Modules/python.cxx index 036124837..79edb6532 100644 --- a/Source/Modules/python.cxx +++ b/Source/Modules/python.cxx @@ -17,7 +17,7 @@ #include #include #include -#include "../DoxygenTranslator/src/PyDocConverter.h" +#include "../Doxygen/pydoc.h" #include #include From ec2cb809cd57b26ad2468894d7266c2ff7ddadc1 Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Tue, 29 May 2018 06:59:26 +0100 Subject: [PATCH 308/314] Add Doxygen to include paths --- Source/Makefile.am | 1 + Source/Modules/java.cxx | 2 +- Source/Modules/python.cxx | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Source/Makefile.am b/Source/Makefile.am index df3d4b75f..845fc33fd 100644 --- a/Source/Makefile.am +++ b/Source/Makefile.am @@ -13,6 +13,7 @@ AM_CPPFLAGS = -I$(BUILD_SOURCE_DIR)/Include \ -I$(SOURCE_DIR)/Include \ -I$(SOURCE_DIR)/DOH \ -I$(SOURCE_DIR)/CParse \ + -I$(SOURCE_DIR)/Doxygen \ -I$(SOURCE_DIR)/Preprocessor \ -I$(SOURCE_DIR)/Swig \ -I$(SOURCE_DIR)/Modules diff --git a/Source/Modules/java.cxx b/Source/Modules/java.cxx index 12da307cf..0d42ba7d5 100644 --- a/Source/Modules/java.cxx +++ b/Source/Modules/java.cxx @@ -15,7 +15,7 @@ #include // for INT_MAX #include "cparse.h" #include -#include "../Doxygen/javadoc.h" +#include "javadoc.h" /* Hash type used for upcalls from C/C++ */ typedef DOH UpcallData; diff --git a/Source/Modules/python.cxx b/Source/Modules/python.cxx index 79edb6532..fae1f66e1 100644 --- a/Source/Modules/python.cxx +++ b/Source/Modules/python.cxx @@ -17,7 +17,7 @@ #include #include #include -#include "../Doxygen/pydoc.h" +#include "pydoc.h" #include #include From 12e7926ee29d8749545bd2b5a17e5eda72f7ab14 Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Thu, 31 May 2018 20:13:52 +0100 Subject: [PATCH 309/314] Doxygen example Replace the unnecessarily large number of doxygen examples with one doxygen example. --- .../doxygencomments/java/callback/Makefile | 18 -- .../doxygencomments/java/callback/example.cxx | 4 - .../doxygencomments/java/callback/example.h | 27 --- .../doxygencomments/java/callback/example.i | 14 -- .../doxygencomments/java/callback/index.html | 20 -- .../doxygencomments/java/callback/main.java | 56 ----- Examples/doxygencomments/java/check.list | 15 -- Examples/doxygencomments/java/class/Makefile | 18 -- .../doxygencomments/java/class/example.cxx | 28 --- Examples/doxygencomments/java/class/example.h | 51 ----- Examples/doxygencomments/java/class/example.i | 10 - .../doxygencomments/java/class/index.html | 197 ------------------ Examples/doxygencomments/java/class/main.java | 70 ------- .../doxygencomments/java/constants/Makefile | 18 -- .../doxygencomments/java/constants/example.i | 30 --- .../doxygencomments/java/constants/index.html | 52 ----- .../doxygencomments/java/constants/main.java | 44 ---- Examples/doxygencomments/java/enum/Makefile | 18 -- .../doxygencomments/java/enum/example.cxx | 37 ---- Examples/doxygencomments/java/enum/example.h | 23 -- Examples/doxygencomments/java/enum/example.i | 14 -- Examples/doxygencomments/java/enum/index.html | 29 --- Examples/doxygencomments/java/enum/main.java | 38 ---- Examples/doxygencomments/java/extend/Makefile | 18 -- .../doxygencomments/java/extend/example.cxx | 4 - .../doxygencomments/java/extend/example.h | 67 ------ .../doxygencomments/java/extend/example.i | 15 -- .../doxygencomments/java/extend/index.html | 19 -- .../doxygencomments/java/extend/main.java | 88 -------- .../doxygencomments/java/funcptr/Makefile | 18 -- .../doxygencomments/java/funcptr/example.c | 19 -- .../doxygencomments/java/funcptr/example.h | 10 - .../doxygencomments/java/funcptr/example.i | 16 -- .../doxygencomments/java/funcptr/index.html | 91 -------- .../doxygencomments/java/funcptr/main.java | 33 --- Examples/doxygencomments/java/index.html | 65 ------ .../doxygencomments/java/multimap/Makefile | 18 -- .../doxygencomments/java/multimap/example.c | 53 ----- .../doxygencomments/java/multimap/example.dsp | 158 -------------- .../doxygencomments/java/multimap/example.i | 109 ---------- .../doxygencomments/java/multimap/main.java | 40 ---- Examples/doxygencomments/java/native/Makefile | 18 -- .../doxygencomments/java/native/example.i | 67 ------ .../doxygencomments/java/native/index.html | 33 --- .../doxygencomments/java/native/main.java | 19 -- .../doxygencomments/java/pointer/Makefile | 18 -- .../doxygencomments/java/pointer/example.c | 16 -- .../doxygencomments/java/pointer/example.i | 38 ---- .../doxygencomments/java/pointer/index.html | 165 --------------- .../doxygencomments/java/pointer/main.java | 55 ----- .../doxygencomments/java/reference/Makefile | 18 -- .../java/reference/example.cxx | 46 ---- .../doxygencomments/java/reference/example.h | 26 --- .../doxygencomments/java/reference/example.i | 58 ------ .../doxygencomments/java/reference/index.html | 147 ------------- .../doxygencomments/java/reference/main.java | 79 ------- Examples/doxygencomments/java/simple/Makefile | 18 -- .../doxygencomments/java/simple/example.c | 18 -- .../doxygencomments/java/simple/example.dsp | 158 -------------- .../doxygencomments/java/simple/example.i | 11 - .../doxygencomments/java/simple/index.html | 108 ---------- .../doxygencomments/java/simple/main.java | 32 --- .../doxygencomments/java/template/Makefile | 18 -- .../doxygencomments/java/template/example.h | 39 ---- .../doxygencomments/java/template/example.i | 17 -- .../doxygencomments/java/template/index.html | 102 --------- .../doxygencomments/java/template/main.java | 45 ---- .../doxygencomments/java/typemap/Makefile | 18 -- .../doxygencomments/java/typemap/example.i | 101 --------- .../doxygencomments/java/typemap/index.html | 32 --- .../doxygencomments/java/typemap/main.java | 26 --- .../doxygencomments/java/variables/Makefile | 18 -- .../doxygencomments/java/variables/example.c | 91 -------- .../doxygencomments/java/variables/example.h | 6 - .../doxygencomments/java/variables/example.i | 57 ----- .../doxygencomments/java/variables/index.html | 85 -------- .../doxygencomments/java/variables/main.java | 97 --------- Examples/java/check.list | 1 + Examples/java/doxygen/Makefile | 21 ++ Examples/java/doxygen/example.cxx | 48 +++++ .../java/class => java/doxygen}/example.dsp | 4 +- Examples/java/doxygen/example.h | 107 ++++++++++ Examples/java/doxygen/example.i | 17 ++ Examples/java/doxygen/runme.java | 63 ++++++ 84 files changed, 259 insertions(+), 3574 deletions(-) delete mode 100644 Examples/doxygencomments/java/callback/Makefile delete mode 100644 Examples/doxygencomments/java/callback/example.cxx delete mode 100644 Examples/doxygencomments/java/callback/example.h delete mode 100644 Examples/doxygencomments/java/callback/example.i delete mode 100644 Examples/doxygencomments/java/callback/index.html delete mode 100644 Examples/doxygencomments/java/callback/main.java delete mode 100644 Examples/doxygencomments/java/check.list delete mode 100644 Examples/doxygencomments/java/class/Makefile delete mode 100644 Examples/doxygencomments/java/class/example.cxx delete mode 100644 Examples/doxygencomments/java/class/example.h delete mode 100644 Examples/doxygencomments/java/class/example.i delete mode 100644 Examples/doxygencomments/java/class/index.html delete mode 100644 Examples/doxygencomments/java/class/main.java delete mode 100644 Examples/doxygencomments/java/constants/Makefile delete mode 100644 Examples/doxygencomments/java/constants/example.i delete mode 100644 Examples/doxygencomments/java/constants/index.html delete mode 100644 Examples/doxygencomments/java/constants/main.java delete mode 100644 Examples/doxygencomments/java/enum/Makefile delete mode 100644 Examples/doxygencomments/java/enum/example.cxx delete mode 100644 Examples/doxygencomments/java/enum/example.h delete mode 100644 Examples/doxygencomments/java/enum/example.i delete mode 100644 Examples/doxygencomments/java/enum/index.html delete mode 100644 Examples/doxygencomments/java/enum/main.java delete mode 100644 Examples/doxygencomments/java/extend/Makefile delete mode 100644 Examples/doxygencomments/java/extend/example.cxx delete mode 100644 Examples/doxygencomments/java/extend/example.h delete mode 100644 Examples/doxygencomments/java/extend/example.i delete mode 100644 Examples/doxygencomments/java/extend/index.html delete mode 100644 Examples/doxygencomments/java/extend/main.java delete mode 100644 Examples/doxygencomments/java/funcptr/Makefile delete mode 100644 Examples/doxygencomments/java/funcptr/example.c delete mode 100644 Examples/doxygencomments/java/funcptr/example.h delete mode 100644 Examples/doxygencomments/java/funcptr/example.i delete mode 100644 Examples/doxygencomments/java/funcptr/index.html delete mode 100644 Examples/doxygencomments/java/funcptr/main.java delete mode 100644 Examples/doxygencomments/java/index.html delete mode 100644 Examples/doxygencomments/java/multimap/Makefile delete mode 100644 Examples/doxygencomments/java/multimap/example.c delete mode 100644 Examples/doxygencomments/java/multimap/example.dsp delete mode 100644 Examples/doxygencomments/java/multimap/example.i delete mode 100644 Examples/doxygencomments/java/multimap/main.java delete mode 100644 Examples/doxygencomments/java/native/Makefile delete mode 100644 Examples/doxygencomments/java/native/example.i delete mode 100644 Examples/doxygencomments/java/native/index.html delete mode 100644 Examples/doxygencomments/java/native/main.java delete mode 100644 Examples/doxygencomments/java/pointer/Makefile delete mode 100644 Examples/doxygencomments/java/pointer/example.c delete mode 100644 Examples/doxygencomments/java/pointer/example.i delete mode 100644 Examples/doxygencomments/java/pointer/index.html delete mode 100644 Examples/doxygencomments/java/pointer/main.java delete mode 100644 Examples/doxygencomments/java/reference/Makefile delete mode 100644 Examples/doxygencomments/java/reference/example.cxx delete mode 100644 Examples/doxygencomments/java/reference/example.h delete mode 100644 Examples/doxygencomments/java/reference/example.i delete mode 100644 Examples/doxygencomments/java/reference/index.html delete mode 100644 Examples/doxygencomments/java/reference/main.java delete mode 100644 Examples/doxygencomments/java/simple/Makefile delete mode 100644 Examples/doxygencomments/java/simple/example.c delete mode 100644 Examples/doxygencomments/java/simple/example.dsp delete mode 100644 Examples/doxygencomments/java/simple/example.i delete mode 100644 Examples/doxygencomments/java/simple/index.html delete mode 100644 Examples/doxygencomments/java/simple/main.java delete mode 100644 Examples/doxygencomments/java/template/Makefile delete mode 100644 Examples/doxygencomments/java/template/example.h delete mode 100644 Examples/doxygencomments/java/template/example.i delete mode 100644 Examples/doxygencomments/java/template/index.html delete mode 100644 Examples/doxygencomments/java/template/main.java delete mode 100644 Examples/doxygencomments/java/typemap/Makefile delete mode 100644 Examples/doxygencomments/java/typemap/example.i delete mode 100644 Examples/doxygencomments/java/typemap/index.html delete mode 100644 Examples/doxygencomments/java/typemap/main.java delete mode 100644 Examples/doxygencomments/java/variables/Makefile delete mode 100644 Examples/doxygencomments/java/variables/example.c delete mode 100644 Examples/doxygencomments/java/variables/example.h delete mode 100644 Examples/doxygencomments/java/variables/example.i delete mode 100644 Examples/doxygencomments/java/variables/index.html delete mode 100644 Examples/doxygencomments/java/variables/main.java create mode 100644 Examples/java/doxygen/Makefile create mode 100644 Examples/java/doxygen/example.cxx rename Examples/{doxygencomments/java/class => java/doxygen}/example.dsp (95%) create mode 100644 Examples/java/doxygen/example.h create mode 100644 Examples/java/doxygen/example.i create mode 100644 Examples/java/doxygen/runme.java diff --git a/Examples/doxygencomments/java/callback/Makefile b/Examples/doxygencomments/java/callback/Makefile deleted file mode 100644 index 14c301703..000000000 --- a/Examples/doxygencomments/java/callback/Makefile +++ /dev/null @@ -1,18 +0,0 @@ -TOP = ../.. -SWIG = $(TOP)/../preinst-swig -CXXSRCS = example.cxx -TARGET = example -INTERFACE = example.i -SWIGOPT = - -all:: java - -java:: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ - SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' java_cpp - javac *.java - -clean:: - $(MAKE) -f $(TOP)/Makefile java_clean - -check: all diff --git a/Examples/doxygencomments/java/callback/example.cxx b/Examples/doxygencomments/java/callback/example.cxx deleted file mode 100644 index 450d75608..000000000 --- a/Examples/doxygencomments/java/callback/example.cxx +++ /dev/null @@ -1,4 +0,0 @@ -/* File : example.cxx */ - -#include "example.h" - diff --git a/Examples/doxygencomments/java/callback/example.h b/Examples/doxygencomments/java/callback/example.h deleted file mode 100644 index a0c5fc4d2..000000000 --- a/Examples/doxygencomments/java/callback/example.h +++ /dev/null @@ -1,27 +0,0 @@ -/* File : example.h */ - -#include -#include - -/*! Let's document class CALLBACK! - /author Alfred - */ -class Callback { -public: - /** Information about Callback */ - virtual ~Callback() { std::cout << "Callback::~Callback()" << std:: endl; } - virtual void run() { std::cout << "Callback::run()" << std::endl; } -}; - -/** Let's document class Caller! */ -class Caller { -private: - Callback *_callback; -public: - Caller(): _callback(0) {} - ~Caller() { delCallback(); }/**< Deletes Callback */ - void delCallback() { delete _callback; _callback = 0; } - void setCallback(Callback *cb) { delCallback(); _callback = cb; } - void call() { if (_callback) _callback->run(); } -}; - diff --git a/Examples/doxygencomments/java/callback/example.i b/Examples/doxygencomments/java/callback/example.i deleted file mode 100644 index 5dae4e7c1..000000000 --- a/Examples/doxygencomments/java/callback/example.i +++ /dev/null @@ -1,14 +0,0 @@ -/* File : example.i */ -/** Let's document module Example! */ -%module(directors="1") example -%{ -#include "example.h" -%} - -%include "std_string.i" - -/* turn on director wrapping Callback */ -%feature("director") Callback; - -%include "example.h" - diff --git a/Examples/doxygencomments/java/callback/index.html b/Examples/doxygencomments/java/callback/index.html deleted file mode 100644 index c25452018..000000000 --- a/Examples/doxygencomments/java/callback/index.html +++ /dev/null @@ -1,20 +0,0 @@ - - -SWIG:Examples:java:callback - - - - - -SWIG/Examples/python/extend/ -


    - -

    Implementing C++ callbacks in Java

    - -

    -This example illustrates how to use directors to implement C++ callbacks in Java. -

    - -
    - - diff --git a/Examples/doxygencomments/java/callback/main.java b/Examples/doxygencomments/java/callback/main.java deleted file mode 100644 index 4800f8cc9..000000000 --- a/Examples/doxygencomments/java/callback/main.java +++ /dev/null @@ -1,56 +0,0 @@ -public class main -{ - static { - try { - System.loadLibrary("example"); - } catch (UnsatisfiedLinkError e) { - System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e); - System.exit(1); - } - } - - public static void main(String[] args) - { - System.out.println("Adding and calling a normal C++ callback"); - System.out.println("----------------------------------------"); - - Caller caller = new Caller(); - Callback callback = new Callback(); - - caller.setCallback(callback); - caller.call(); - caller.delCallback(); - - callback = new JavaCallback(); - - System.out.println(); - System.out.println("Adding and calling a Java callback"); - System.out.println("------------------------------------"); - - caller.setCallback(callback); - caller.call(); - caller.delCallback(); - - // Test that a double delete does not occur as the object has already been deleted from the C++ layer. - // Note that the garbage collector can also call the delete() method via the finalizer (callback.finalize()) - // at any point after here. - callback.delete(); - - System.out.println(); - System.out.println("java exit"); - } -} - -class JavaCallback extends Callback -{ - public JavaCallback() - { - super(); - } - - public void run() - { - System.out.println("JavaCallback.run()"); - } -} - diff --git a/Examples/doxygencomments/java/check.list b/Examples/doxygencomments/java/check.list deleted file mode 100644 index 9728342f2..000000000 --- a/Examples/doxygencomments/java/check.list +++ /dev/null @@ -1,15 +0,0 @@ -# see top-level Makefile.in -callback -class -constants -enum -extend -funcptr -multimap -native -pointer -reference -simple -template -typemap -variables diff --git a/Examples/doxygencomments/java/class/Makefile b/Examples/doxygencomments/java/class/Makefile deleted file mode 100644 index 14c301703..000000000 --- a/Examples/doxygencomments/java/class/Makefile +++ /dev/null @@ -1,18 +0,0 @@ -TOP = ../.. -SWIG = $(TOP)/../preinst-swig -CXXSRCS = example.cxx -TARGET = example -INTERFACE = example.i -SWIGOPT = - -all:: java - -java:: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ - SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' java_cpp - javac *.java - -clean:: - $(MAKE) -f $(TOP)/Makefile java_clean - -check: all diff --git a/Examples/doxygencomments/java/class/example.cxx b/Examples/doxygencomments/java/class/example.cxx deleted file mode 100644 index 1e8e203dd..000000000 --- a/Examples/doxygencomments/java/class/example.cxx +++ /dev/null @@ -1,28 +0,0 @@ -/* File : example.c */ - -#include "example.h" -#define M_PI 3.14159265358979323846 - -/* Move the shape to a new location */ -void Shape::move(double dx, double dy) { - x += dx; - y += dy; -} - -int Shape::nshapes = 0; - -double Circle::area(void) { - return M_PI*radius*radius; -} - -double Circle::perimeter(void) { - return 2*M_PI*radius; -} - -double Square::area(void) { - return width*width; -} - -double Square::perimeter(void) { - return 4*width; -} diff --git a/Examples/doxygencomments/java/class/example.h b/Examples/doxygencomments/java/class/example.h deleted file mode 100644 index ce9af23d3..000000000 --- a/Examples/doxygencomments/java/class/example.h +++ /dev/null @@ -1,51 +0,0 @@ -/*! \file example.h -comments on example.h */ - -/*! This is describing class Shape - \author Bob - \exception some sort of exception - \see OtherShapes() - */ - -class Shape { -public: - Shape() { - nshapes++; - } - virtual ~Shape() { - nshapes--; - }; - double x, y; /*!< Important variables */ - void move(double dx, double dy); - virtual double area(void) = 0; /*!< \return the area \exception exception description */ - virtual double perimeter(void) = 0; /*!< \exception exception description - \return the perimeter */ - static int nshapes; /*!< Details about nshapes. */ -}; -/*! This is describing class Circle */ -class Circle : public Shape { -private: - double radius; -public: - Circle(double r) : radius(r) { }; - virtual double area(void); /*!< \return the area \exception exception description */ - virtual double perimeter(void); /*!< \exception exception description - \return the perimeter */ -}; - -/*! This is describing class square */ -class Square : public Shape { -private: - double width; -public: - Square(double w) : width(w) { }; /*!< Create square - /param w the width - /exception some description */ - virtual double area(void); - virtual double perimeter(void); -}; - - - - - diff --git a/Examples/doxygencomments/java/class/example.i b/Examples/doxygencomments/java/class/example.i deleted file mode 100644 index 05c0ca2ab..000000000 --- a/Examples/doxygencomments/java/class/example.i +++ /dev/null @@ -1,10 +0,0 @@ -/** File : example.i */ -%module example - -%{ -#include "example.h" -%} - -/* Let's just grab the original header file here */ -%include "example.h" - diff --git a/Examples/doxygencomments/java/class/index.html b/Examples/doxygencomments/java/class/index.html deleted file mode 100644 index e9db7e94a..000000000 --- a/Examples/doxygencomments/java/class/index.html +++ /dev/null @@ -1,197 +0,0 @@ - - -SWIG:Examples:java:class - - - - - -SWIG/Examples/java/class/ -
    - -

    Wrapping a simple C++ class

    - -

    -This example illustrates the high level form of C++ class wrapping performed -by SWIG. In this case, a C++ class has a proxy Java class, which -provides access to C++ class members. - -

    The C++ Code

    - -Suppose you have some C++ classes described by the following (and admittedly lame) -header file: - -
    -
    -/* File : example.h */
    -
    -class Shape {
    -public:
    -  Shape() {
    -    nshapes++;
    -  }
    -  virtual ~Shape() {
    -    nshapes--;
    -  };
    -  double  x, y;   
    -  void    move(double dx, double dy);
    -  virtual double area() = 0;
    -  virtual double perimeter() = 0;
    -  static  int nshapes;
    -};
    -
    -class Circle : public Shape {
    -private:
    -  double radius;
    -public:
    -  Circle(double r) : radius(r) { };
    -  virtual double area();
    -  virtual double perimeter();
    -};
    -
    -class Square : public Shape {
    -private:
    -  double width;
    -public:
    -  Square(double w) : width(w) { };
    -  virtual double area();
    -  virtual double perimeter();
    -};
    -
    -
    - -

    The SWIG interface

    - -A simple SWIG interface for this can be built by simply grabbing the header file -like this: - -
    -
    -/* File : example.i */
    -%module example
    -
    -%{
    -#include "example.h"
    -%}
    -
    -/* Let's just grab the original header file here */
    -%include "example.h"
    -
    -
    - -Note: when creating a C++ extension, you must run SWIG with the -c++ option like this: -
    -
    -% swig -c++ -java example.i
    -
    -
    - -

    A sample Java program

    - -Click here to see a Java program that calls the C++ functions from Java. - -

    Key points

    - -
      -
    • To create a new object, you call a constructor like this: - -
      -
      -Circle c = new Circle(10);
      -
      -
      - -

      -

    • To access member data, a pair of accessor functions are used. -For example: - -
      -
      -c.setX(15);        // Set member data
      -x = c.getX();      // Get member data
      -
      -
      - -

      -

    • To invoke a member function, you simply do this - -
      -
      -System.out.println( "The area is " + c.area() );
      -
      -
      - -

      -

    • To invoke a destructor, simply do this - -
      -
      -c.delete();     // Deletes a shape
      -
      -
      - -

      -

    • Static member variables are wrapped with java static get and set access functions. For example: - -
      -
      -n = Shape.getNshapes();     // Get a static data member
      -Shape.setNshapes(13);       // Set a static data member
      -
      -
      - -
    - -

    General Comments

    - -
      -
    • This high-level interface using proxy classes is not the only way to handle C++ code. -A low level interface using c functions to access member variables and member functions is the alternative SWIG -approach. This entails passing around the c pointer or c++ 'this' pointer and as such it is not difficult to crash the JVM. -The abstraction of the underlying pointer by the java proxy classes far better fits the java programming paradigm. - -

      -

    • SWIG *does* know how to properly perform upcasting of objects in an inheritance -hierarchy (including multiple inheritance). However Java classes can only derive from one base class so multiple inheritance -is not implemented. Java classes can implement more than one interface so there is scope for improvement in the future. - -

      -

    • A wide variety of C++ features are not currently supported by SWIG. Here is the -short and incomplete list: - -

      -

        -
      • Overloaded methods and functions. SWIG wrappers don't know how to resolve name -conflicts so you must give an alternative name to any overloaded method name using the -%name directive like this: - -
        -
        -void foo(int a);  
        -%name(foo2) void foo(double a, double b);
        -
        -
        - -

        -

      • Overloaded operators. Not supported at all. The only workaround for this is -to write a helper function. For example: - -
        -
        -%inline %{
        -    Vector *vector_add(Vector *a, Vector *b) {
        -          ... whatever ...
        -    }
        -%}
        -
        -
        - -

        -

      • Namespaces. Not supported at all. Won't be supported until SWIG2.0 (if at all). - -
      -
    - -
    - - diff --git a/Examples/doxygencomments/java/class/main.java b/Examples/doxygencomments/java/class/main.java deleted file mode 100644 index 8ef35db6d..000000000 --- a/Examples/doxygencomments/java/class/main.java +++ /dev/null @@ -1,70 +0,0 @@ -// This example illustrates how C++ classes can be used from Java using SWIG. -// The Java class gets mapped onto the C++ class and behaves as if it is a Java class. - -public class main { - static { - try { - System.loadLibrary("example"); - } catch (UnsatisfiedLinkError e) { - System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e); - System.exit(1); - } - } - - public static void main(String argv[]) - { - // ----- Object creation ----- - - System.out.println( "Creating some objects:" ); - Circle c = new Circle(10); - System.out.println( " Created circle " + c ); - Square s = new Square(10); - System.out.println( " Created square " + s ); - - // ----- Access a static member ----- - - System.out.println( "\nA total of " + Shape.getNshapes() + " shapes were created" ); - - // ----- Member data access ----- - - // Notice how we can do this using functions specific to - // the 'Circle' class. - c.setX(20); - c.setY(30); - - // Now use the same functions in the base class - Shape shape = s; - shape.setX(-10); - shape.setY(5); - - System.out.println( "\nHere is their current position:" ); - System.out.println( " Circle = (" + c.getX() + " " + c.getY() + ")" ); - System.out.println( " Square = (" + s.getX() + " " + s.getY() + ")" ); - - // ----- Call some methods ----- - - System.out.println( "\nHere are some properties of the shapes:" ); - Shape[] shapes = {c,s}; - for (int i=0; i - -SWIG:Examples:java:constants - - - - -SWIG/Examples/java/constants/ -
    - -

    Wrapping C Constants

    - -

    -When SWIG encounters C preprocessor macros and C declarations that look like constants, -it creates Java constant with an identical value. Click here -to see a SWIG interface with some constant declarations in it. - - -

    Accessing Constants from Java

    -Click here for the section on constants in the SWIG and Java documentation. -

    - -Click here to see a Java program that prints out the values -of the constants contained in the above file.

    -

    Key points

    -
      -
    • The values of preprocessor macros are converted into Java constants. -
    • Types are inferred by syntax (e.g., "3" is an integer and "3.5" is a float). -
    • Character constants such as 'x' are converted into Java strings. -
    • C string literals such as "Hello World" are converted into Java strings. -
    • Macros that are not fully defined are simply ignored. For example: -
      -
      -#define EXTERN extern
      -
      -
      -is ignored because SWIG has no idea what type of variable this would be. - -

      -

    • Expressions are allowed provided that all of their components are defined. Otherwise, the constant is ignored. - -
    • Certain C declarations involving 'const' are also turned into Java constants. -
    • The constants that appear in a SWIG interface file do not have to appear in any sort -of matching C source file since the creation of a constant does not require linkage -to a stored value (i.e., a value held in a C global variable or memory location). -
    - -
    - - - - diff --git a/Examples/doxygencomments/java/constants/main.java b/Examples/doxygencomments/java/constants/main.java deleted file mode 100644 index 7130c3d70..000000000 --- a/Examples/doxygencomments/java/constants/main.java +++ /dev/null @@ -1,44 +0,0 @@ -import java.lang.reflect.*; - -public class main { - static { - try { - System.loadLibrary("example"); - } catch (UnsatisfiedLinkError e) { - System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e); - System.exit(1); - } - } - - public static void main(String argv[]) - { - System.out.println("ICONST = " + example.ICONST + " (should be 42)"); - System.out.println("FCONST = " + example.FCONST + " (should be 2.1828)"); - System.out.println("CCONST = " + example.CCONST + " (should be 'x')"); - System.out.println("CCONST2 = " + example.CCONST2 + " (this should be on a new line)"); - System.out.println("SCONST = " + example.SCONST + " (should be 'Hello World')"); - System.out.println("SCONST2 = " + example.SCONST2 + " (should be '\"Hello World\"')"); - System.out.println("EXPR = " + example.EXPR + " (should be 48.5484)"); - System.out.println("iconst = " + example.iconst + " (should be 37)"); - System.out.println("fconst = " + example.fconst + " (should be 3.14)"); - -// Use reflection to check if these variables are defined: - try - { - System.out.println("EXTERN = " + example.class.getField("EXTERN") + " (Arg! This shouldn't print anything)"); - } - catch (NoSuchFieldException e) - { - System.out.println("EXTERN isn't defined (good)"); - } - - try - { - System.out.println("FOO = " + example.class.getField("FOO") + " (Arg! This shouldn't print anything)"); - } - catch (NoSuchFieldException e) - { - System.out.println("FOO isn't defined (good)"); - } - } -} diff --git a/Examples/doxygencomments/java/enum/Makefile b/Examples/doxygencomments/java/enum/Makefile deleted file mode 100644 index 14c301703..000000000 --- a/Examples/doxygencomments/java/enum/Makefile +++ /dev/null @@ -1,18 +0,0 @@ -TOP = ../.. -SWIG = $(TOP)/../preinst-swig -CXXSRCS = example.cxx -TARGET = example -INTERFACE = example.i -SWIGOPT = - -all:: java - -java:: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ - SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' java_cpp - javac *.java - -clean:: - $(MAKE) -f $(TOP)/Makefile java_clean - -check: all diff --git a/Examples/doxygencomments/java/enum/example.cxx b/Examples/doxygencomments/java/enum/example.cxx deleted file mode 100644 index df7bb6328..000000000 --- a/Examples/doxygencomments/java/enum/example.cxx +++ /dev/null @@ -1,37 +0,0 @@ -/* File : example.cxx */ - -#include "example.h" -#include - -void Foo::enum_test(speed s) { - if (s == IMPULSE) { - printf("IMPULSE speed\n"); - } else if (s == WARP) { - printf("WARP speed\n"); - } else if (s == LUDICROUS) { - printf("LUDICROUS speed\n"); - } else { - printf("Unknown speed\n"); - } -} - -void enum_test(color c, Foo::speed s) { - if (c == RED) { - printf("color = RED, "); - } else if (c == BLUE) { - printf("color = BLUE, "); - } else if (c == GREEN) { - printf("color = GREEN, "); - } else { - printf("color = Unknown color!, "); - } - if (s == Foo::IMPULSE) { - printf("speed = IMPULSE speed\n"); - } else if (s == Foo::WARP) { - printf("speed = WARP speed\n"); - } else if (s == Foo::LUDICROUS) { - printf("speed = LUDICROUS speed\n"); - } else { - printf("speed = Unknown speed!\n"); - } -} diff --git a/Examples/doxygencomments/java/enum/example.h b/Examples/doxygencomments/java/enum/example.h deleted file mode 100644 index 2142d8240..000000000 --- a/Examples/doxygencomments/java/enum/example.h +++ /dev/null @@ -1,23 +0,0 @@ - - -/** This is a block describing enum - */ - -enum color { RED, BLUE, GREEN }; - -/*! This is describing class foo - */ - -class Foo { - public: - Foo() { } - enum speed { IMPULSE=10, WARP=20, LUDICROUS=30 }; - void enum_test(speed s); -}; - -/*! This is describing enum test -//! \param c the color c -//! \param s the speed - */ - -void enum_test(color c, Foo::speed s); diff --git a/Examples/doxygencomments/java/enum/example.i b/Examples/doxygencomments/java/enum/example.i deleted file mode 100644 index 1f1f9d526..000000000 --- a/Examples/doxygencomments/java/enum/example.i +++ /dev/null @@ -1,14 +0,0 @@ -/** File : example.i */ -%module example - -%{ -#include "example.h" -%} - -/** Force the generated Java code to use the C enum values rather than making a JNI call */ -%javaconst(1); - -/** Let's just grab the original header file here */ - -%include "example.h" - diff --git a/Examples/doxygencomments/java/enum/index.html b/Examples/doxygencomments/java/enum/index.html deleted file mode 100644 index 52c06c5d1..000000000 --- a/Examples/doxygencomments/java/enum/index.html +++ /dev/null @@ -1,29 +0,0 @@ - - -SWIG:Examples:java:enum - - - - - -SWIG/Examples/java/enum/ -
    - -

    Wrapping enumerations

    - -

    -This example tests SWIG's ability to wrap enumerations. -SWIG wraps enums in numerous different ways. The default approach is to wrap -each enum with the typesafe enum pattern. Enums are handled as integers in the JNI layer. -See the documentation for the other approaches for wrapping enums. - - -

    - -
    - - diff --git a/Examples/doxygencomments/java/enum/main.java b/Examples/doxygencomments/java/enum/main.java deleted file mode 100644 index 8646e0087..000000000 --- a/Examples/doxygencomments/java/enum/main.java +++ /dev/null @@ -1,38 +0,0 @@ - -public class main { - static { - try { - System.loadLibrary("example"); - } catch (UnsatisfiedLinkError e) { - System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e); - System.exit(1); - } - } - - public static void main(String argv[]) - { - // Print out the value of some enums - System.out.println("*** color ***"); - System.out.println(" " + color.RED + " = " + color.RED.swigValue()); - System.out.println(" " + color.BLUE + " = " + color.BLUE.swigValue()); - System.out.println(" " + color.GREEN + " = " + color.GREEN.swigValue()); - - System.out.println("\n*** Foo::speed ***"); - System.out.println(" Foo::" + Foo.speed.IMPULSE + " = " + Foo.speed.IMPULSE.swigValue()); - System.out.println(" Foo::" + Foo.speed.WARP + " = " + Foo.speed.WARP.swigValue()); - System.out.println(" Foo::" + Foo.speed.LUDICROUS + " = " + Foo.speed.LUDICROUS.swigValue()); - - System.out.println("\nTesting use of enums with functions\n"); - - example.enum_test(color.RED, Foo.speed.IMPULSE); - example.enum_test(color.BLUE, Foo.speed.WARP); - example.enum_test(color.GREEN, Foo.speed.LUDICROUS); - - System.out.println( "\nTesting use of enum with class method" ); - Foo f = new Foo(); - - f.enum_test(Foo.speed.IMPULSE); - f.enum_test(Foo.speed.WARP); - f.enum_test(Foo.speed.LUDICROUS); - } -} diff --git a/Examples/doxygencomments/java/extend/Makefile b/Examples/doxygencomments/java/extend/Makefile deleted file mode 100644 index 14c301703..000000000 --- a/Examples/doxygencomments/java/extend/Makefile +++ /dev/null @@ -1,18 +0,0 @@ -TOP = ../.. -SWIG = $(TOP)/../preinst-swig -CXXSRCS = example.cxx -TARGET = example -INTERFACE = example.i -SWIGOPT = - -all:: java - -java:: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ - SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' java_cpp - javac *.java - -clean:: - $(MAKE) -f $(TOP)/Makefile java_clean - -check: all diff --git a/Examples/doxygencomments/java/extend/example.cxx b/Examples/doxygencomments/java/extend/example.cxx deleted file mode 100644 index 450d75608..000000000 --- a/Examples/doxygencomments/java/extend/example.cxx +++ /dev/null @@ -1,4 +0,0 @@ -/* File : example.cxx */ - -#include "example.h" - diff --git a/Examples/doxygencomments/java/extend/example.h b/Examples/doxygencomments/java/extend/example.h deleted file mode 100644 index 9b882fd59..000000000 --- a/Examples/doxygencomments/java/extend/example.h +++ /dev/null @@ -1,67 +0,0 @@ -/* File : example.h */ - -#include -#include -#include -#include -#include - -/**This is describiing class Employee - /author Bob */ -class Employee { -private: - std::string name; -public: - /** Employee - \param n name of Employee - \throws some exception */ - Employee(const char* n): name(n) {} -/**This is describing method getTitle */ - virtual std::string getTitle() { return getPosition() + " " + getName(); } - virtual std::string getName() { return name; } - virtual std::string getPosition() const { return "Employee"; } - virtual ~Employee() { printf("~Employee() @ %p\n", this); } -}; - -/**This is describing class Manager */ -class Manager: public Employee { -public: - Manager(const char* n): Employee(n) {} - virtual std::string getPosition() const { return "Manager"; } -}; - - -class EmployeeList { - std::vector list; -public: - /** Initialises Employee List */ - EmployeeList() { - list.push_back(new Employee("Bob")); - list.push_back(new Employee("Jane")); - list.push_back(new Manager("Ted")); - } - /** Add employee - * \param p employee p - * \return void */ - void addEmployee(Employee *p) { - list.push_back(p); - std::cout << "New employee added. Current employees are:" << std::endl; - std::vector::iterator i; - for (i=list.begin(); i!=list.end(); i++) { - std::cout << " " << (*i)->getTitle() << std::endl; - } - } -/**This is describing class get item */ - const Employee *get_item(int i) { - return list[i]; - } - ~EmployeeList() { - std::vector::iterator i; - std::cout << "~EmployeeList, deleting " << list.size() << " employees." << std::endl; - for (i=list.begin(); i!=list.end(); i++) { - delete *i; - } - std::cout << "~EmployeeList empty." << std::endl; - } -}; - diff --git a/Examples/doxygencomments/java/extend/example.i b/Examples/doxygencomments/java/extend/example.i deleted file mode 100644 index c8ec32e09..000000000 --- a/Examples/doxygencomments/java/extend/example.i +++ /dev/null @@ -1,15 +0,0 @@ -/* File : example.i */ -%module(directors="1") example -%{ -#include "example.h" -%} - -%include "std_vector.i" -%include "std_string.i" - -/* turn on director wrapping for Manager */ -%feature("director") Employee; -%feature("director") Manager; - -%include "example.h" - diff --git a/Examples/doxygencomments/java/extend/index.html b/Examples/doxygencomments/java/extend/index.html deleted file mode 100644 index c7c2c127d..000000000 --- a/Examples/doxygencomments/java/extend/index.html +++ /dev/null @@ -1,19 +0,0 @@ - - -SWIG:Examples:java:extend - - - - - -SWIG/Examples/java/extend/ -
    - -

    Extending a simple C++ class in Java

    - -

    -This example illustrates the extending of a C++ class with cross language polymorphism. - -


    - - diff --git a/Examples/doxygencomments/java/extend/main.java b/Examples/doxygencomments/java/extend/main.java deleted file mode 100644 index ee3a94ed0..000000000 --- a/Examples/doxygencomments/java/extend/main.java +++ /dev/null @@ -1,88 +0,0 @@ -// This file illustrates the cross language polymorphism using directors. - - -// CEO class, which overrides Employee::getPosition(). - -class CEO extends Manager { - public CEO(String name) { - super(name); - } - public String getPosition() { - return "CEO"; - } - // Public method to stop the SWIG proxy base class from thinking it owns the underlying C++ memory. - public void disownMemory() { - swigCMemOwn = false; - } -} - - -public class main { - static { - try { - System.loadLibrary("example"); - } catch (UnsatisfiedLinkError e) { - System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e); - System.exit(1); - } - } - - public static void main(String argv[]) - { - - // Create an instance of CEO, a class derived from the Java proxy of the - // underlying C++ class. The calls to getName() and getPosition() are standard, - // the call to getTitle() uses the director wrappers to call CEO.getPosition(). - - CEO e = new CEO("Alice"); - System.out.println( e.getName() + " is a " + e.getPosition() ); - System.out.println( "Just call her \"" + e.getTitle() + "\"" ); - System.out.println( "----------------------" ); - - - // Create a new EmployeeList instance. This class does not have a C++ - // director wrapper, but can be used freely with other classes that do. - - EmployeeList list = new EmployeeList(); - - // EmployeeList owns its items, so we must surrender ownership of objects we add. - e.disownMemory(); - list.addEmployee(e); - System.out.println( "----------------------" ); - - // Now we access the first four items in list (three are C++ objects that - // EmployeeList's constructor adds, the last is our CEO). The virtual - // methods of all these instances are treated the same. For items 0, 1, and - // 2, all methods resolve in C++. For item 3, our CEO, getTitle calls - // getPosition which resolves in Java. The call to getPosition is - // slightly different, however, because of the overidden getPosition() call, since - // now the object reference has been "laundered" by passing through - // EmployeeList as an Employee*. Previously, Java resolved the call - // immediately in CEO, but now Java thinks the object is an instance of - // class Employee. So the call passes through the - // Employee proxy class and on to the C wrappers and C++ director, - // eventually ending up back at the Java CEO implementation of getPosition(). - // The call to getTitle() for item 3 runs the C++ Employee::getTitle() - // method, which in turn calls getPosition(). This virtual method call - // passes down through the C++ director class to the Java implementation - // in CEO. All this routing takes place transparently. - - System.out.println( "(position, title) for items 0-3:" ); - - System.out.println( " " + list.get_item(0).getPosition() + ", \"" + list.get_item(0).getTitle() + "\"" ); - System.out.println( " " + list.get_item(1).getPosition() + ", \"" + list.get_item(1).getTitle() + "\"" ); - System.out.println( " " + list.get_item(2).getPosition() + ", \"" + list.get_item(2).getTitle() + "\"" ); - System.out.println( " " + list.get_item(3).getPosition() + ", \"" + list.get_item(3).getTitle() + "\"" ); - System.out.println( "----------------------" ); - - // Time to delete the EmployeeList, which will delete all the Employee* - // items it contains. The last item is our CEO, which gets destroyed as well. - list.delete(); - System.out.println( "----------------------" ); - - // All done. - - System.out.println( "java exit" ); - - } -} diff --git a/Examples/doxygencomments/java/funcptr/Makefile b/Examples/doxygencomments/java/funcptr/Makefile deleted file mode 100644 index 968c92c6c..000000000 --- a/Examples/doxygencomments/java/funcptr/Makefile +++ /dev/null @@ -1,18 +0,0 @@ -TOP = ../.. -SWIG = $(TOP)/../preinst-swig -SRCS = example.c -TARGET = example -INTERFACE = example.i -SWIGOPT = - -all:: java - -java:: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ - SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' java - javac *.java - -clean:: - $(MAKE) -f $(TOP)/Makefile java_clean - -check: all diff --git a/Examples/doxygencomments/java/funcptr/example.c b/Examples/doxygencomments/java/funcptr/example.c deleted file mode 100644 index 5c4a3dabf..000000000 --- a/Examples/doxygencomments/java/funcptr/example.c +++ /dev/null @@ -1,19 +0,0 @@ -/* File : example.c */ - -int do_op(int a, int b, int (*op)(int,int)) { - return (*op)(a,b); -} - -int add(int a, int b) { - return a+b; -} - -int sub(int a, int b) { - return a-b; -} - -int mul(int a, int b) { - return a*b; -} - -int (*funcvar)(int,int) = add; diff --git a/Examples/doxygencomments/java/funcptr/example.h b/Examples/doxygencomments/java/funcptr/example.h deleted file mode 100644 index 5285737a3..000000000 --- a/Examples/doxygencomments/java/funcptr/example.h +++ /dev/null @@ -1,10 +0,0 @@ -/* file: example.h */ - -extern int do_op(int,int, int (*op)(int,int)); -/*! Describing function add */ -extern int add(int,int); -extern int sub(int,int); -extern int mul(int,int); - -extern int (*funcvar)(int,int); - diff --git a/Examples/doxygencomments/java/funcptr/example.i b/Examples/doxygencomments/java/funcptr/example.i deleted file mode 100644 index 82c3c2201..000000000 --- a/Examples/doxygencomments/java/funcptr/example.i +++ /dev/null @@ -1,16 +0,0 @@ -/* File : example.i */ -%module example -%{ -#include "example.h" -%} - -/** Wrap a function taking a pointer to a function */ -extern int do_op(int a, int b, int (*op)(int, int)); - -/** Now install a bunch of "ops" as constants */ -%constant int (*ADD)(int,int) = add; -%constant int (*SUB)(int,int) = sub; -%constant int (*MUL)(int,int) = mul; - -extern int (*funcvar)(int,int); - diff --git a/Examples/doxygencomments/java/funcptr/index.html b/Examples/doxygencomments/java/funcptr/index.html deleted file mode 100644 index 0ad2be1cf..000000000 --- a/Examples/doxygencomments/java/funcptr/index.html +++ /dev/null @@ -1,91 +0,0 @@ - - -SWIG:Examples:java:funcptr - - - - - -SWIG/Examples/java/funcptr/ -
    - -

    Pointers to Functions

    - -

    -Okay, just what in the heck does SWIG do with a declaration like this? - -

    -
    -int do_op(int a, int b, int (*op)(int, int));
    -
    -
    - -Well, it creates a wrapper as usual. Of course, that does raise some -questions about the third argument (the pointer to a function). - -

    -In this case, SWIG will wrap the function pointer as it does for all other -pointers. However, in order to actually call this function from a Java program, -you will need to pass some kind of C function pointer object. In C, -this is easy, you just supply a function name as an argument like this: - -

    -
    -/* Some callback function */
    -int add(int a, int b) {
    -   return a+b;
    -} 
    -...
    -int r = do_op(x,y,add);
    -
    -
    - -To make this work with SWIG, you will need to do a little extra work. Specifically, -you need to create some function pointer objects using the %constant directive like this: - -
    -
    -%constant(int (*)(int,int)) ADD = add;
    -
    -
    - -Now, in a Java program, you would do this: - -
    -
    -int r = do_op(x,y, example.ADD)
    -
    -
    -where example is the module name. - -

    An Example

    - -Here are some files that illustrate this with a simple example: - - - -

    Notes

    - -
      -
    • The value of a function pointer must correspond to a function written in C or C++. -It is not possible to pass an arbitrary Java function in as a substitute for a C -function pointer. - -

      -

    • A Java function can be used as a C/C++ callback if you write some -clever typemaps and are very careful about how you create your extension. -This is an advanced topic not covered here. -
    - -
    - - - - - - diff --git a/Examples/doxygencomments/java/funcptr/main.java b/Examples/doxygencomments/java/funcptr/main.java deleted file mode 100644 index cf81f92b4..000000000 --- a/Examples/doxygencomments/java/funcptr/main.java +++ /dev/null @@ -1,33 +0,0 @@ - -public class main { - - static { - try { - System.loadLibrary("example"); - } catch (UnsatisfiedLinkError e) { - System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e); - System.exit(1); - } - } - - public static void main(String argv[]) { - - - int a = 37; - int b = 42; - - // Now call our C function with a bunch of callbacks - - System.out.println( "Trying some C callback functions" ); - System.out.println( " a = " + a ); - System.out.println( " b = " + b ); - System.out.println( " ADD(a,b) = " + example.do_op(a,b,example.ADD) ); - System.out.println( " SUB(a,b) = " + example.do_op(a,b,example.SUB) ); - System.out.println( " MUL(a,b) = " + example.do_op(a,b,example.MUL) ); - - System.out.println( "Here is what the C callback function classes are called in Java" ); - System.out.println( " ADD = " + example.ADD.getClass().getName() ); - System.out.println( " SUB = " + example.SUB.getClass().getName() ); - System.out.println( " MUL = " + example.MUL.getClass().getName() ); - } -} diff --git a/Examples/doxygencomments/java/index.html b/Examples/doxygencomments/java/index.html deleted file mode 100644 index d98f9a393..000000000 --- a/Examples/doxygencomments/java/index.html +++ /dev/null @@ -1,65 +0,0 @@ - - -SWIG:Examples:java - - - -

    SWIG Java Examples

    - -

    -The following examples illustrate the use of SWIG with Java. - -

      -
    • simple. A minimal example showing how SWIG can -be used to wrap a C function, a global variable, and a constant. -
    • native. Comparing the manual and the SWIG approach to calling native code. -
    • typemap. Modifying the Java module's default behaviour by using typemaps. -
    • constants. This shows how preprocessor macros and -certain C declarations are turned into constants. -
    • variables. An example showing how to access C global variables. -
    • enum. Wrapping enumerations. -
    • class. How to wrap a simple C++ class. -
    • reference. C++ references. -
    • pointer. Simple pointer handling. -
    • template. C++ templates. -
    • funcptr. Pointers to functions. -
    • callback. C++ callbacks using directors. -
    • extend. Polymorphism using directors. -
    - -

    Running the examples

    -Please see the Windows page in the main manual for information on using the examples on Windows.

    - -On Unix most of the examples work by making the Makefile before executing the program main.java. The Makefile will output the swig generated JNI c code as well as the Java wrapper classes. Additionally the JNI c/c++ code is compiled into the shared object (dynamic link library) which is needed for dynamic linking to the native code. The Makefiles also compile the Java files using javac. -

    -Ensure that the dynamic link library file is in the appropriate path before executing the Java program. For example in Unix, libexample.so must be in the LD_LIBRARY_PATH. -

    -A Unix example: -

    -
    -$ make
    -$ export LD_LIBRARY_PATH=. #ksh 
    -$ java main
    -
    -
    -

    - - - -

    Compatibility

    - -The examples have been extensively tested on the following platforms: - -
      -
    • Solaris -
    • Linux -
    • Cygwin -
    • Windows -
    - -Your mileage may vary. If you experience a problem, please let us know by -contacting us on the mailing lists. - - - - diff --git a/Examples/doxygencomments/java/multimap/Makefile b/Examples/doxygencomments/java/multimap/Makefile deleted file mode 100644 index 968c92c6c..000000000 --- a/Examples/doxygencomments/java/multimap/Makefile +++ /dev/null @@ -1,18 +0,0 @@ -TOP = ../.. -SWIG = $(TOP)/../preinst-swig -SRCS = example.c -TARGET = example -INTERFACE = example.i -SWIGOPT = - -all:: java - -java:: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ - SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' java - javac *.java - -clean:: - $(MAKE) -f $(TOP)/Makefile java_clean - -check: all diff --git a/Examples/doxygencomments/java/multimap/example.c b/Examples/doxygencomments/java/multimap/example.c deleted file mode 100644 index b8360fa8a..000000000 --- a/Examples/doxygencomments/java/multimap/example.c +++ /dev/null @@ -1,53 +0,0 @@ -/* File : example.c */ -#include -#include -#include - -/* Compute the greatest common divisor of positive integers */ -int gcd(int x, int y) { - int g; - g = y; - while (x > 0) { - g = x; - x = y % x; - y = g; - } - return g; -} - -int gcdmain(int argc, char *argv[]) { - int x,y; - if (argc != 3) { - printf("usage: gcd x y\n"); - return -1; - } - x = atoi(argv[1]); - y = atoi(argv[2]); - printf("gcd(%d,%d) = %d\n", x,y,gcd(x,y)); - return 0; -} - -int count(char *bytes, int len, char c) { - int i; - int count = 0; - for (i = 0; i < len; i++) { - if (bytes[i] == c) count++; - } - return count; -} - -void capitalize(char *str, int len) { - int i; - for (i = 0; i < len; i++) { - str[i] = (char)toupper(str[i]); - } -} - -void circle(double x, double y) { - double a = x*x + y*y; - if (a > 1.0) { - printf("Bad points %g, %g\n", x,y); - } else { - printf("Good points %g, %g\n", x,y); - } -} diff --git a/Examples/doxygencomments/java/multimap/example.dsp b/Examples/doxygencomments/java/multimap/example.dsp deleted file mode 100644 index 8e1f8415e..000000000 --- a/Examples/doxygencomments/java/multimap/example.dsp +++ /dev/null @@ -1,158 +0,0 @@ -# Microsoft Developer Studio Project File - Name="example" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=example - Win32 Release -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "example.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "example.mak" CFG="example - Win32 Release" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "example - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "example - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "example - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "EXAMPLE_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "$(JAVA_INCLUDE)" /I "$(JAVA_INCLUDE)\win32" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "EXAMPLE_EXPORTS" /YX /FD /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x809 /d "_DEBUG" -# ADD RSC /l 0x809 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /dll /debug /machine:I386 /out:"example.dll" /pdbtype:sept -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Desc=Java compile post-build step -PostBuild_Cmds=echo on "%JAVA_BIN%\javac" *.java -# End Special Build Tool - -!ELSEIF "$(CFG)" == "example - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "EXAMPLE_EXPORTS" /YX /FD /c -# ADD CPP /nologo /MT /W3 /GX /O2 /I "$(JAVA_INCLUDE)" /I "$(JAVA_INCLUDE)\win32" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "EXAMPLE_EXPORTS" /YX /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x809 /d "NDEBUG" -# ADD RSC /l 0x809 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /dll /machine:I386 /out:"example.dll" -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Desc=Java compile post-build step -PostBuild_Cmds=echo on "%JAVA_BIN%\javac" *.java -# End Special Build Tool - -!ENDIF - -# Begin Target - -# Name "example - Win32 Debug" -# Name "example - Win32 Release" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\example.c -# End Source File -# Begin Source File - -SOURCE=.\example_wrap.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# End Group -# Begin Source File - -SOURCE=.\example.i - -!IF "$(CFG)" == "example - Win32 Debug" - -# Begin Custom Build -InputPath=.\example.i -InputName=example - -"$(InputName)_wrap.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - echo In order to function correctly, please ensure the following environment variables are correctly set: - echo JAVA_INCLUDE: %JAVA_INCLUDE% - echo JAVA_BIN: %JAVA_BIN% - echo on - ..\..\..\swig.exe -java $(InputPath) - -# End Custom Build - -!ELSEIF "$(CFG)" == "example - Win32 Release" - -# Begin Custom Build -InputPath=.\example.i -InputName=example - -"$(InputName)_wrap.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - echo In order to function correctly, please ensure the following environment variables are correctly set: - echo JAVA_INCLUDE: %JAVA_INCLUDE% - echo JAVA_BIN: %JAVA_BIN% - echo on - ..\..\..\swig.exe -java $(InputPath) - -# End Custom Build - -!ENDIF - -# End Source File -# End Target -# End Project diff --git a/Examples/doxygencomments/java/multimap/example.i b/Examples/doxygencomments/java/multimap/example.i deleted file mode 100644 index 8d67282a5..000000000 --- a/Examples/doxygencomments/java/multimap/example.i +++ /dev/null @@ -1,109 +0,0 @@ -/* File : example.i */ -%module example - -%{ -extern int gcd(int x, int y); -extern int gcdmain(int argc, char *argv[]); -extern int count(char *bytes, int len, char c); -extern void capitalize (char *str, int len); -extern void circle (double cx, double cy); -extern int squareCubed (int n, int *OUTPUT); -%} - -extern int gcd(int x, int y); - -%typemap(jni) (int argc, char *argv[]) "jobjectArray" -%typemap(jtype) (int argc, char *argv[]) "String[]" -%typemap(jstype) (int argc, char *argv[]) "String[]" - -%typemap(javain) (int argc, char *argv[]) "$javainput" - -%typemap(in) (int argc, char *argv[]) (jstring *jsarray) { -int i; - - $1 = (*jenv)->GetArrayLength(jenv, $input); - if ($1 == 0) { - SWIG_JavaThrowException(jenv, SWIG_JavaIndexOutOfBoundsException, "Array must contain at least 1 element"); - return $null; - } - $2 = (char **) malloc(($1+1)*sizeof(char *)); - jsarray = (jstring *) malloc($1*sizeof(jstring)); - for (i = 0; i < $1; i++) { - jsarray[i] = (jstring) (*jenv)->GetObjectArrayElement(jenv, $input, i); - $2[i] = (char *) (*jenv)->GetStringUTFChars(jenv, jsarray[i], 0); - } - $2[i] = 0; -} - -%typemap(argout) (int argc, char *argv[]) "" /* override char *[] default */ - -%typemap(freearg) (int argc, char *argv[]) { -int i; - for (i = 0; i < $1; i++) { - (*jenv)->ReleaseStringUTFChars(jenv, jsarray$argnum[i], $2[i]); - } - free($2); -} - -extern int gcdmain(int argc, char *argv[]); - -%typemap(jni) (char *bytes, int len) "jstring" -%typemap(jtype) (char *bytes, int len) "String" -%typemap(jstype) (char *bytes, int len) "String" - -%typemap(javain) (char *bytes, int len) "$javainput" - -%typemap(in) (char *bytes, int len) { - $1 = ($1_type)(*jenv)->GetStringUTFChars(jenv, $input, 0); - $2 = (*jenv)->GetStringUTFLength(jenv, $input); -} - -%typemap(freearg) (char *bytes, int len) %{ - (*jenv)->ReleaseStringUTFChars(jenv, $input, $1); -%} - -extern int count(char *bytes, int len, char c); - -/* This example shows how to wrap a function that mutates a c string. A one - * element Java string array is used so that the string can be returned modified.*/ - -%typemap(jni) (char *str, int len) "jobjectArray" -%typemap(jtype) (char *str, int len) "String[]" -%typemap(jstype) (char *str, int len) "String[]" - -%typemap(javain) (char *str, int len) "$javainput" - -%typemap(in) (char *str, int len) (jstring js) { - int index = 0; - js = (jstring) (*jenv)->GetObjectArrayElement(jenv, $input, index); - $1 = (char *) (*jenv)->GetStringUTFChars(jenv, js, 0); - $2 = (*jenv)->GetStringUTFLength(jenv, js); -} - -/* Return the mutated string as a modified element in the array. */ -%typemap(argout) (char *str, int len) { - jstring newstring = (*jenv)->NewStringUTF(jenv, $1); - (*jenv)->SetObjectArrayElement(jenv, $input, 0, newstring); -} - -/* Release memory */ -%typemap(freearg) (char *str, int len) { - (*jenv)->ReleaseStringUTFChars(jenv, js$argnum, $1); -} - -extern void capitalize(char *str, int len); - -/* A multi-valued constraint. Force two arguments to lie - inside the unit circle */ - -%typemap(check) (double cx, double cy) { - double a = $1*$1 + $2*$2; - if (a > 1.0) { - SWIG_JavaThrowException(jenv, SWIG_JavaIllegalArgumentException, "$1_name and $2_name must be in unit circle"); - return; - } -} - -extern void circle(double cx, double cy); - - diff --git a/Examples/doxygencomments/java/multimap/main.java b/Examples/doxygencomments/java/multimap/main.java deleted file mode 100644 index 331ac6b89..000000000 --- a/Examples/doxygencomments/java/multimap/main.java +++ /dev/null @@ -1,40 +0,0 @@ - -public class main { - - static { - try { - System.loadLibrary("example"); - } catch (UnsatisfiedLinkError e) { - System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e); - System.exit(1); - } - } - - public static void main(String argv[]) { - - // Call our gcd() function - int x = 42; - int y = 105; - int g = example.gcd(x,y); - System.out.println("The gcd of " + x + " and " + y + " is " + g); - - // Call the gcdmain() function - String[] args = {"gcdmain","42","105"}; - example.gcdmain(args); - - // Call the count function - System.out.println(example.count("Hello World", 'l')); - - // Call the capitalize function - String[] capitalizeMe = {"hello world"}; - example.capitalize(capitalizeMe); - System.out.println(capitalizeMe[0]); - } -} - - - - - - - diff --git a/Examples/doxygencomments/java/native/Makefile b/Examples/doxygencomments/java/native/Makefile deleted file mode 100644 index 92afbd4d0..000000000 --- a/Examples/doxygencomments/java/native/Makefile +++ /dev/null @@ -1,18 +0,0 @@ -TOP = ../.. -SWIG = $(TOP)/../preinst-swig -SRCS = -TARGET = example -INTERFACE = example.i -SWIGOPT = - -all:: java - -java:: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ - SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' java - javac *.java - -clean:: - $(MAKE) -f $(TOP)/Makefile java_clean - -check: all diff --git a/Examples/doxygencomments/java/native/example.i b/Examples/doxygencomments/java/native/example.i deleted file mode 100644 index 21bcf528c..000000000 --- a/Examples/doxygencomments/java/native/example.i +++ /dev/null @@ -1,67 +0,0 @@ -/* File : example.i */ -%module example - -%{ -#include - -/*! Structure Point */ -typedef struct point { - int x; - int y; -} Point; - -/*! Point_create Description - /param x integer x - /param y some integer y - /return a point */ - -Point *point_create(int x, int y) { - Point *p = (Point *) malloc(sizeof(Point)); - p->x = x; - p->y = y; - - return p; -} - -/*! Point_create Description - /param format the format - /param p some p - /return a character string of the point p */ - -static char *point_toString(char *format, Point *p) { - static char buf[80]; - - sprintf(buf, format, p->x, p->y); - - return buf; -} - -/* this function will be wrapped by SWIG */ -char *point_toString1(Point *p) { - return point_toString("(%d,%d)", p); -} - -/* this one we wrapped manually*/ -JNIEXPORT jstring JNICALL Java_exampleJNI_point_1toString2(JNIEnv *jenv, jclass jcls, jlong jpoint) { - Point * p; - jstring result; - - (void)jcls; - - p = *(Point **)&jpoint; - - result = (*jenv)->NewStringUTF(jenv, point_toString("[%d,%d]", p)); - - return result; -} -%} - - -Point *point_create(int x, int y); -char *point_toString1(Point *p); - -/* give access to free() for memory cleanup of the malloc'd Point */ -extern void free(void *memblock); - -%native(point_toString2) char *point_toString2(Point *p); - diff --git a/Examples/doxygencomments/java/native/index.html b/Examples/doxygencomments/java/native/index.html deleted file mode 100644 index 7ecf129ce..000000000 --- a/Examples/doxygencomments/java/native/index.html +++ /dev/null @@ -1,33 +0,0 @@ - - -SWIG:Examples:java:native - - - - - -SWIG/Examples/java/native/ -
    - -

    SWIG wrapped and manually wrapped functions in Java

    - -Click here for the relevant section in the SWIG and Java documentation. -

    -This example compares wrapping a c global function using the manual way and the SWIG way. -

    - -
      -
    • example.i. Interface file comparing code wrapped by SWIG and wrapped manually. -
    • main.java. Sample Java program showing calls to both manually wrapped and SWIG wrapped c functions. -
    - -

    Notes

    - -
      -
    • SWIG writes all the awkward JNI code for you. You just have to tell SWIG which functions to wrap. -
    • If memory is allocated in c it needs to be free'd. A function, such as free(), can be provided with access from Java to free the memory. -
    - -
    - - diff --git a/Examples/doxygencomments/java/native/main.java b/Examples/doxygencomments/java/native/main.java deleted file mode 100644 index f4760bb3d..000000000 --- a/Examples/doxygencomments/java/native/main.java +++ /dev/null @@ -1,19 +0,0 @@ - -public class main { - - static { - try { - System.loadLibrary("example"); - } catch (UnsatisfiedLinkError e) { - System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e); - System.exit(1); - } - } - - public static void main(String argv[]) { - SWIGTYPE_p_Point p = example.point_create(1, 2); - System.out.println("auto wrapped : " + example.point_toString1(p)); - System.out.println("manual wrapped: " + example.point_toString2(p)); - example.free(new SWIGTYPE_p_void(SWIGTYPE_p_Point.getCPtr(p), false)); //clean up c allocated memory - } -} diff --git a/Examples/doxygencomments/java/pointer/Makefile b/Examples/doxygencomments/java/pointer/Makefile deleted file mode 100644 index 968c92c6c..000000000 --- a/Examples/doxygencomments/java/pointer/Makefile +++ /dev/null @@ -1,18 +0,0 @@ -TOP = ../.. -SWIG = $(TOP)/../preinst-swig -SRCS = example.c -TARGET = example -INTERFACE = example.i -SWIGOPT = - -all:: java - -java:: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ - SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' java - javac *.java - -clean:: - $(MAKE) -f $(TOP)/Makefile java_clean - -check: all diff --git a/Examples/doxygencomments/java/pointer/example.c b/Examples/doxygencomments/java/pointer/example.c deleted file mode 100644 index b877d9a5b..000000000 --- a/Examples/doxygencomments/java/pointer/example.c +++ /dev/null @@ -1,16 +0,0 @@ -/* File : example.c */ - -void add(int *x, int *y, int *result) { - *result = *x + *y; -} - -void sub(int *x, int *y, int *result) { - *result = *x - *y; -} - -int divide(int n, int d, int *r) { - int q; - q = n/d; - *r = n - q*d; - return q; -} diff --git a/Examples/doxygencomments/java/pointer/example.i b/Examples/doxygencomments/java/pointer/example.i deleted file mode 100644 index 7ac3b8cf8..000000000 --- a/Examples/doxygencomments/java/pointer/example.i +++ /dev/null @@ -1,38 +0,0 @@ -/* File : example.i */ -%module example - -%{ -extern void add(int *, int *, int *); -extern void sub(int *, int *, int *); -extern int divide(int, int, int *); -%} - -/** This example illustrates a couple of different techniques - for manipulating C pointers */ - -/* First we'll use the pointer library */ - -/*! function add - \param x some int x - \param y some int y - \param result some result - */ -extern void add(int *x, int *y, int *result); -%include cpointer.i -%pointer_functions(int, intp); - -/* Next we'll use some typemaps */ - -%include typemaps.i -extern void sub(int *INPUT, int *INPUT, int *OUTPUT); - -/* Next we'll use typemaps and the %apply directive */ - -%apply int *OUTPUT { int *r }; -extern int divide(int n, int d, int *r); - - - - - - diff --git a/Examples/doxygencomments/java/pointer/index.html b/Examples/doxygencomments/java/pointer/index.html deleted file mode 100644 index c30d549e6..000000000 --- a/Examples/doxygencomments/java/pointer/index.html +++ /dev/null @@ -1,165 +0,0 @@ - - -SWIG:Examples:java:pointer - - - - -SWIG/Examples/java/pointer/ -
    - -

    Simple Pointer Handling

    - -

    -This example illustrates a couple of techniques for handling -simple pointers in SWIG. The prototypical example is a C function -that operates on pointers such as this: - -

    -
    -void add(int *x, int *y, int *r) { 
    -    *r = *x + *y;
    -}
    -
    -
    - -By default, SWIG wraps this function exactly as specified and creates -an interface that expects pointer objects for arguments. -SWIG wraps a C pointer with a type wrapper class, for example, SWIGTYPE_p_int for an int*. -The only problem is how does one go about creating these objects from a Java program? -

    - - -

    Possible Solutions

    - -
      -
    • Write some helper functions to explicitly create objects. For -example: - -
      -
      -int *new_int(int ivalue) {
      -  int *i = (int *) malloc(sizeof(ivalue));
      -  *i = ivalue;
      -  return i;
      -}
      -int get_int(int *i) {
      -  return *i;
      -}
      -
      -void delete_int(int *i) {
      -  free(i);
      -}
      -
      -
      - -

      -

    • The SWIG pointer library provides an easier way.
      -For example, in the interface file -you would do this: - -
      -
      -%include cpointer.i
      -%pointer_functions(int, intp);
      -
      -
      - -and from Java you would use pointers like this: - -
      -
      -SWIGTYPE_p_int a = example.new_intp();
      -SWIGTYPE_p_int b = example.new_intp();
      -SWIGTYPE_p_int c = example.new_intp();
      -example.intp_assign(a,37);
      -example.intp_assign(b,42);
      -
      -// Note that getCPtr() has package access by default
      -System.out.println("     a =" + Long.toHexString(SWIGTYPE_p_int.getCPtr(a)));
      -System.out.println("     b =" + Long.toHexString(SWIGTYPE_p_int.getCPtr(b)));
      -System.out.println("     c =" + Long.toHexString(SWIGTYPE_p_int.getCPtr(c)));
      -
      -// Call the add() function with some pointers
      -example.add(a,b,c);
      -
      -// Now get the result
      -int res = example.intp_value(c);
      -System.out.println("     37 + 42 =" + res);
      -
      -// Clean up the pointers
      -example.delete_intp(a);
      -example.delete_intp(b);
      -example.delete_intp(c);
      -
      -
      - -

      -

    • Use the SWIG typemap library. This library allows you to completely -change the way arguments are processed by SWIG. For example: - -
      -
      -%include "typemaps.i"
      -void add(int *INPUT, int *INPUT, int *OUTPUT);
      -
      -
      - -And in a Java program: - -
      -
      -int[] r = {0};
      -example.sub(37,42,r);
      -System.out.println("Result =" + r[0]);
      -
      -
      -Needless to say, this is substantially easier although a bit unusual. - -

      -

    • A final alternative is to use the typemaps library in combination -with the %apply directive. This allows you to change the names of parameters -that behave as input or output parameters. For example: - -
      -
      -%include "typemaps.i"
      -%apply int *INPUT {int *x, int *y};
      -%apply int *OUTPUT {int *r};
      -
      -void add(int *x, int *y, int *r);
      -void sub(int *x, int *y, int *r);
      -void mul(int *x, int *y, int *r);
      -... etc ...
      -
      -
      - -
    - -

    Example

    - -The following example illustrates the use of these features for pointer -extraction. - - - -

    Notes

    - -
      -
    • Since pointers are used for so many different things (arrays, output values, -etc...) the complexity of pointer handling can be as complicated as you want to -make it. - -

      -

    • More documentation on the typemaps.i and cpointer.i library files can be -found in the SWIG user manual. The files also contain documentation. - -
    - -
    - - diff --git a/Examples/doxygencomments/java/pointer/main.java b/Examples/doxygencomments/java/pointer/main.java deleted file mode 100644 index e96e02eaa..000000000 --- a/Examples/doxygencomments/java/pointer/main.java +++ /dev/null @@ -1,55 +0,0 @@ - -public class main { - - static { - try { - System.loadLibrary("example"); - } catch (UnsatisfiedLinkError e) { - System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e); - System.exit(1); - } - } - - public static void main(String argv[]) { - - // First create some objects using the pointer library. - System.out.println("Testing the pointer library"); - SWIGTYPE_p_int a = example.new_intp(); - SWIGTYPE_p_int b = example.new_intp(); - SWIGTYPE_p_int c = example.new_intp(); - example.intp_assign(a,37); - example.intp_assign(b,42); - - // Note that getCPtr() has package access by default - System.out.println(" a =" + Long.toHexString(SWIGTYPE_p_int.getCPtr(a))); - System.out.println(" b =" + Long.toHexString(SWIGTYPE_p_int.getCPtr(b))); - System.out.println(" c =" + Long.toHexString(SWIGTYPE_p_int.getCPtr(c))); - - // Call the add() function with some pointers - example.add(a,b,c); - - // Now get the result - int res = example.intp_value(c); - System.out.println(" 37 + 42 =" + res); - - // Clean up the pointers - example.delete_intp(a); - example.delete_intp(b); - example.delete_intp(c); - - // Now try the typemap library - // Now it is no longer necessary to manufacture pointers. - // Instead we use a single element array which in Java is modifiable. - - System.out.println("Trying the typemap library"); - int[] r = {0}; - example.sub(37,42,r); - System.out.println(" 37 - 42 = " + r[0]); - - // Now try the version with return value - - System.out.println("Testing return value"); - int q = example.divide(42,37,r); - System.out.println(" 42/37 = " + q + " remainder " + r[0]); - } -} diff --git a/Examples/doxygencomments/java/reference/Makefile b/Examples/doxygencomments/java/reference/Makefile deleted file mode 100644 index 14c301703..000000000 --- a/Examples/doxygencomments/java/reference/Makefile +++ /dev/null @@ -1,18 +0,0 @@ -TOP = ../.. -SWIG = $(TOP)/../preinst-swig -CXXSRCS = example.cxx -TARGET = example -INTERFACE = example.i -SWIGOPT = - -all:: java - -java:: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ - SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' java_cpp - javac *.java - -clean:: - $(MAKE) -f $(TOP)/Makefile java_clean - -check: all diff --git a/Examples/doxygencomments/java/reference/example.cxx b/Examples/doxygencomments/java/reference/example.cxx deleted file mode 100644 index 8a513bf49..000000000 --- a/Examples/doxygencomments/java/reference/example.cxx +++ /dev/null @@ -1,46 +0,0 @@ -/* File : example.cxx */ - -/* Deal with Microsoft's attempt at deprecating C standard runtime functions */ -#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) -# define _CRT_SECURE_NO_DEPRECATE -#endif - -#include "example.h" -#include -#include - -Vector operator+(const Vector &a, const Vector &b) { - Vector r; - r.x = a.x + b.x; - r.y = a.y + b.y; - r.z = a.z + b.z; - return r; -} - -char *Vector::print() { - static char temp[512]; - sprintf(temp,"Vector %p (%g,%g,%g)", this, x,y,z); - return temp; -} - -VectorArray::VectorArray(int size) { - items = new Vector[size]; - maxsize = size; -} - -VectorArray::~VectorArray() { - delete [] items; -} - -Vector &VectorArray::operator[](int index) { - if ((index < 0) || (index >= maxsize)) { - printf("Panic! Array index out of bounds.\n"); - exit(1); - } - return items[index]; -} - -int VectorArray::size() { - return maxsize; -} - diff --git a/Examples/doxygencomments/java/reference/example.h b/Examples/doxygencomments/java/reference/example.h deleted file mode 100644 index 4915adb1b..000000000 --- a/Examples/doxygencomments/java/reference/example.h +++ /dev/null @@ -1,26 +0,0 @@ -/* File : example.h */ - -class Vector { -private: - double x,y,z; -public: - Vector() : x(0), y(0), z(0) { }; - Vector(double x, double y, double z) : x(x), y(y), z(z) { }; - friend Vector operator+(const Vector &a, const Vector &b); - char *print(); -}; - -class VectorArray { -private: - Vector *items; - int maxsize; -public: - VectorArray(int maxsize); - ~VectorArray(); - Vector &operator[](int); - int size(); -}; - - - - diff --git a/Examples/doxygencomments/java/reference/example.i b/Examples/doxygencomments/java/reference/example.i deleted file mode 100644 index 8e4d05239..000000000 --- a/Examples/doxygencomments/java/reference/example.i +++ /dev/null @@ -1,58 +0,0 @@ -/* File : example.i */ - -/* This file has a few "typical" uses of C++ references. */ - -%module example - -%{ -#include "example.h" -%} - -/*! Class vector description - \author Fred - \exception something random - \since 1.0 - \name ignoreme - \see something */ -class Vector { -public: - Vector(double x, double y, double z); - ~Vector(); - char *print(); -}; - -/** This helper function calls an overloaded operator */ -%inline %{ -Vector addv(Vector &a, Vector &b) { - return a+b; -} -%} - -/*! Class Vector Array - \exception something random - \since 1.3 - \see something - \author Fred */ -class VectorArray { -public: - VectorArray(int maxsize); - ~VectorArray(); - int size(); - - /* This wrapper provides an alternative to the [] operator */ - %extend { - Vector &get(int index) { - return (*$self)[index]; - } - void set(int index, Vector &a) { - (*$self)[index] = a; - } - } -}; - - - - - - - diff --git a/Examples/doxygencomments/java/reference/index.html b/Examples/doxygencomments/java/reference/index.html deleted file mode 100644 index 64b129cbb..000000000 --- a/Examples/doxygencomments/java/reference/index.html +++ /dev/null @@ -1,147 +0,0 @@ - - -SWIG:Examples:java:reference - - - - - -SWIG/Examples/java/reference/ -
    - -

    C++ Reference Handling

    - -

    -This example tests SWIG's handling of C++ references. Since C++ -references are closely related to pointers (as both refer to a -location in memory), SWIG simply collapses all references into -pointers when creating wrappers. - -

    Some examples

    - -References are most commonly used as function parameter. For example, -you might have an operator like this: - -
    -
    -Vector operator+(const Vector &a, const Vector &b) {
    -   Vector result;
    -   result.x = a.x + b.x;
    -   result.y = a.y + b.y;
    -   result.z = a.z + b.z;
    -   return result;
    -}
    -
    -
    - -or a function: - -
    -
    -Vector addv(const Vector &a, const Vector &b) {
    -   Vector result;
    -   result.x = a.x + b.x;
    -   result.y = a.y + b.y;
    -   result.z = a.z + b.z;
    -   return result;
    -}
    -
    -
    - -In these cases, SWIG transforms everything into a pointer and creates a wrapper -that looks like this: - -
    -
    -Vector wrap_addv(Vector *a, Vector *b) {
    -    return addv(*a,*b);
    -}
    -
    -
    - -Occasionally, a reference is used as a return value of a function -when the return result is to be used as an lvalue in an expression. -The prototypical example is an operator like this: - -
    -
    -Vector &operator[](int index);
    -
    -
    - -or a method: - -
    -
    -Vector &get(int index);
    -
    -
    - -For functions returning references, a wrapper like this is created: - -
    -
    -Vector *wrap_Object_get(Object *self, int index) {
    -    Vector &result = self->get(index);
    -    return &result;
    -}
    -
    -
    - -The following header file contains some class -definitions with some operators and use of references. - -

    SWIG Interface

    - -SWIG does NOT support overloaded operators so it can not directly build -an interface to the classes in the above file. However, a number of workarounds -can be made. For example, an overloaded operator can be stuck behind a function -call such as the addv() function above. Array access can be handled -with a pair of set/get functions like this: - -
    -
    -class VectorArray {
    -public:
    - ...
    -   %addmethods {
    -    Vector &get(int index) {
    -      return (*self)[index];
    -    }
    -    void set(int index, Vector &a) {
    -      (*self)[index] = a;
    -    }
    -   }
    -   ...
    -}
    -
    -
    - -Click here to see a SWIG interface file with these additions. - -

    Sample Java program

    - -Click here to see a Java program that manipulates some C++ references. - -

    Notes:

    - -
      -
    • C++ references primarily provide notational convenience for C++ -source code. However, Java only supports the 'x.a' -notation so it doesn't much matter. - -

      -

    • When a program returns a reference, a pointer is returned. -Unlike return by value, memory is not allocated to hold the -return result. - -

      -

    • SWIG has particular trouble handling various combinations of references -and pointers. This is side effect of an old parsing scheme and -type representation that will be replaced in future versions. - -
    - -
    - - diff --git a/Examples/doxygencomments/java/reference/main.java b/Examples/doxygencomments/java/reference/main.java deleted file mode 100644 index 4fd354761..000000000 --- a/Examples/doxygencomments/java/reference/main.java +++ /dev/null @@ -1,79 +0,0 @@ -// This example illustrates the manipulation of C++ references in Java. - -public class main { - static { - try { - System.loadLibrary("example"); - } catch (UnsatisfiedLinkError e) { - System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e); - System.exit(1); - } - } - - public static void main(String argv[]) - { - System.out.println( "Creating some objects:" ); - Vector a = new Vector(3,4,5); - Vector b = new Vector(10,11,12); - - System.out.println( " Created " + a.print() ); - System.out.println( " Created " + b.print() ); - - // ----- Call an overloaded operator ----- - - // This calls the wrapper we placed around - // - // operator+(const Vector &a, const Vector &) - // - // It returns a new allocated object. - - System.out.println( "Adding a+b" ); - Vector c = example.addv(a,b); - System.out.println( " a+b = " + c.print() ); - - // Note: Unless we free the result, a memory leak will occur if the -noproxy commandline - // is used as the proxy classes define finalizers which call the delete() method. When - // -noproxy is not specified the memory management is controlled by the garbage collector. - // You can still call delete(). It will free the c++ memory immediately, but not the - // Java memory! You then must be careful not to call any member functions as it will - // use a NULL c pointer on the underlying c++ object. We set the Java object to null - // which will then throw a Java exception should we attempt to use it again. - c.delete(); - c = null; - - // ----- Create a vector array ----- - - System.out.println( "Creating an array of vectors" ); - VectorArray va = new VectorArray(10); - System.out.println( " va = " + va.toString() ); - - // ----- Set some values in the array ----- - - // These operators copy the value of Vector a and Vector b to the vector array - va.set(0,a); - va.set(1,b); - - // This works, but it would cause a memory leak if -noproxy was used! - - va.set(2,example.addv(a,b)); - - - // Get some values from the array - - System.out.println( "Getting some array values" ); - for (int i=0; i<5; i++) - System.out.println( " va(" + i + ") = " + va.get(i).print() ); - - // Watch under resource meter to check on this - System.out.println( "Making sure we don't leak memory." ); - for (int i=0; i<1000000; i++) - c = va.get(i%10); - - // ----- Clean up ----- - // This could be omitted. The garbage collector would then clean up for us. - System.out.println( "Cleaning up" ); - va.delete(); - a.delete(); - b.delete(); - } -} diff --git a/Examples/doxygencomments/java/simple/Makefile b/Examples/doxygencomments/java/simple/Makefile deleted file mode 100644 index 968c92c6c..000000000 --- a/Examples/doxygencomments/java/simple/Makefile +++ /dev/null @@ -1,18 +0,0 @@ -TOP = ../.. -SWIG = $(TOP)/../preinst-swig -SRCS = example.c -TARGET = example -INTERFACE = example.i -SWIGOPT = - -all:: java - -java:: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ - SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' java - javac *.java - -clean:: - $(MAKE) -f $(TOP)/Makefile java_clean - -check: all diff --git a/Examples/doxygencomments/java/simple/example.c b/Examples/doxygencomments/java/simple/example.c deleted file mode 100644 index 1c2af789c..000000000 --- a/Examples/doxygencomments/java/simple/example.c +++ /dev/null @@ -1,18 +0,0 @@ -/* File : example.c */ - -/* A global variable */ -double Foo = 3.0; - -/* Compute the greatest common divisor of positive integers */ -int gcd(int x, int y) { - int g; - g = y; - while (x > 0) { - g = x; - x = y % x; - y = g; - } - return g; -} - - diff --git a/Examples/doxygencomments/java/simple/example.dsp b/Examples/doxygencomments/java/simple/example.dsp deleted file mode 100644 index 8e1f8415e..000000000 --- a/Examples/doxygencomments/java/simple/example.dsp +++ /dev/null @@ -1,158 +0,0 @@ -# Microsoft Developer Studio Project File - Name="example" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=example - Win32 Release -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "example.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "example.mak" CFG="example - Win32 Release" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "example - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "example - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "example - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "EXAMPLE_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "$(JAVA_INCLUDE)" /I "$(JAVA_INCLUDE)\win32" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "EXAMPLE_EXPORTS" /YX /FD /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x809 /d "_DEBUG" -# ADD RSC /l 0x809 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /dll /debug /machine:I386 /out:"example.dll" /pdbtype:sept -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Desc=Java compile post-build step -PostBuild_Cmds=echo on "%JAVA_BIN%\javac" *.java -# End Special Build Tool - -!ELSEIF "$(CFG)" == "example - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "EXAMPLE_EXPORTS" /YX /FD /c -# ADD CPP /nologo /MT /W3 /GX /O2 /I "$(JAVA_INCLUDE)" /I "$(JAVA_INCLUDE)\win32" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "EXAMPLE_EXPORTS" /YX /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x809 /d "NDEBUG" -# ADD RSC /l 0x809 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /dll /machine:I386 /out:"example.dll" -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Desc=Java compile post-build step -PostBuild_Cmds=echo on "%JAVA_BIN%\javac" *.java -# End Special Build Tool - -!ENDIF - -# Begin Target - -# Name "example - Win32 Debug" -# Name "example - Win32 Release" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\example.c -# End Source File -# Begin Source File - -SOURCE=.\example_wrap.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# End Group -# Begin Source File - -SOURCE=.\example.i - -!IF "$(CFG)" == "example - Win32 Debug" - -# Begin Custom Build -InputPath=.\example.i -InputName=example - -"$(InputName)_wrap.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - echo In order to function correctly, please ensure the following environment variables are correctly set: - echo JAVA_INCLUDE: %JAVA_INCLUDE% - echo JAVA_BIN: %JAVA_BIN% - echo on - ..\..\..\swig.exe -java $(InputPath) - -# End Custom Build - -!ELSEIF "$(CFG)" == "example - Win32 Release" - -# Begin Custom Build -InputPath=.\example.i -InputName=example - -"$(InputName)_wrap.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - echo In order to function correctly, please ensure the following environment variables are correctly set: - echo JAVA_INCLUDE: %JAVA_INCLUDE% - echo JAVA_BIN: %JAVA_BIN% - echo on - ..\..\..\swig.exe -java $(InputPath) - -# End Custom Build - -!ENDIF - -# End Source File -# End Target -# End Project diff --git a/Examples/doxygencomments/java/simple/example.i b/Examples/doxygencomments/java/simple/example.i deleted file mode 100644 index d10fe5e19..000000000 --- a/Examples/doxygencomments/java/simple/example.i +++ /dev/null @@ -1,11 +0,0 @@ -/* File : example.i */ -%module example - -%inline %{ -/*! Function foo - \param x int x - \param y int y - \return the gcd */ -extern int gcd(int x, int y); -extern double Foo; /*!< description of double foo */ -%} diff --git a/Examples/doxygencomments/java/simple/index.html b/Examples/doxygencomments/java/simple/index.html deleted file mode 100644 index a363327fe..000000000 --- a/Examples/doxygencomments/java/simple/index.html +++ /dev/null @@ -1,108 +0,0 @@ - - -SWIG:Examples:java:simple - - - - - -SWIG/Examples/java/simple/ -
    - -

    Simple Java Example

    - -

    -This example illustrates how you can hook Java to a very simple C program containing -a function and a global variable. - -

    The C Code

    - -Suppose you have the following C code: - -
    -
    -/* File : example.c */
    -
    -/* A global variable */
    -double Foo = 3.0;
    -
    -/* Compute the greatest common divisor of positive integers */
    -int gcd(int x, int y) {
    -  int g;
    -  g = y;
    -  while (x > 0) {
    -    g = x;
    -    x = y % x;
    -    y = g;
    -  }
    -  return g;
    -}
    -
    -
    - -

    The SWIG interface

    - -Here is a simple SWIG interface file: - -
    -
    -/* File: example.i */
    -%module example
    -
    -extern int gcd(int x, int y);
    -extern double Foo;
    -
    -
    - -

    Compilation

    - -
      -
    1. swig -java example.i -

      -

    2. Compile example_wrap.c and example.c -to create the extension libexample.so (unix). -
    - -

    Using the extension

    - -Click here to see a program that calls our C functions from Java. -

    -Compile the java files example.java and main.java -to create the class files example.class and main.class before running main in the JVM. Ensure that the libexample.so file is in your LD_LIBRARY_PATH before running. For example: -

    -
    -export LD_LIBRARY_PATH=. #ksh 
    -javac *.java
    -java main
    -
    -
    - -

    Key points

    - -
      -
    • Use the loadLibrary statement from java to load and access the generated java classes. For example: -
      -
      -System.loadLibrary("example");
      -
      -
      - -
    • C functions work just like Java functions. For example: -
      -
      -int g = example.gcd(42,105);
      -
      -
      - -
    • C global variables are accessed through get and set functions in the module class. For example: -
      -
      -double a = example.get_Foo();
      -example.set_Foo(20.0);
      -
      -
      -
    - -
    - - diff --git a/Examples/doxygencomments/java/simple/main.java b/Examples/doxygencomments/java/simple/main.java deleted file mode 100644 index 6d224a4dc..000000000 --- a/Examples/doxygencomments/java/simple/main.java +++ /dev/null @@ -1,32 +0,0 @@ - -public class main { - - static { - try { - System.loadLibrary("example"); - } catch (UnsatisfiedLinkError e) { - System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e); - System.exit(1); - } - } - - public static void main(String argv[]) { - // Call our gcd() function - - int x = 42; - int y = 105; - int g = example.gcd(x,y); - System.out.println("The gcd of " + x + " and " + y + " is " + g); - - // Manipulate the Foo global variable - - // Output its current value - System.out.println("Foo = " + example.getFoo()); - - // Change its value - example.setFoo(3.1415926); - - // See if the change took effect - System.out.println("Foo = " + example.getFoo()); - } -} diff --git a/Examples/doxygencomments/java/template/Makefile b/Examples/doxygencomments/java/template/Makefile deleted file mode 100644 index 2b3d35c6a..000000000 --- a/Examples/doxygencomments/java/template/Makefile +++ /dev/null @@ -1,18 +0,0 @@ -TOP = ../.. -SWIG = $(TOP)/../preinst-swig -CXXSRCS = -TARGET = example -INTERFACE = example.i -SWIGOPT = - -all:: java - -java:: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ - SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' java_cpp - javac *.java - -clean:: - $(MAKE) -f $(TOP)/Makefile java_clean - -check: all diff --git a/Examples/doxygencomments/java/template/example.h b/Examples/doxygencomments/java/template/example.h deleted file mode 100644 index 9ec711391..000000000 --- a/Examples/doxygencomments/java/template/example.h +++ /dev/null @@ -1,39 +0,0 @@ -/* File : example.h */ - -// Some template definitions - -/*! Template class T - \author cmfoil - \sa something something */ - -template T max(T a, T b) { return a>b ? a : b; } - -/*! Template class Vector - \author cmfoil - \sa something something */ -template class vector { - T *v; - int sz; - public: - vector(int _sz) { - v = new T[_sz]; - sz = _sz; - } - T &get(int index) { - return v[index]; - } - void set(int index, T &val) { - v[index] = val; - } /*!< Something about set */ -#ifdef SWIG - %extend { - T getitem(int index) { - return $self->get(index); - }/*!< Something about get item */ - void setitem(int index, T val) { - $self->set(index,val); - } - } -#endif -}; - diff --git a/Examples/doxygencomments/java/template/example.i b/Examples/doxygencomments/java/template/example.i deleted file mode 100644 index 8f94c4da1..000000000 --- a/Examples/doxygencomments/java/template/example.i +++ /dev/null @@ -1,17 +0,0 @@ -/* File : example.i */ -%module example - -%{ -#include "example.h" -%} - -/* Let's just grab the original header file here */ -%include "example.h" - -/* Now instantiate some specific template declarations */ - -%template(maxint) max; -%template(maxdouble) max; -%template(vecint) vector; -%template(vecdouble) vector; - diff --git a/Examples/doxygencomments/java/template/index.html b/Examples/doxygencomments/java/template/index.html deleted file mode 100644 index 1aebd4c2a..000000000 --- a/Examples/doxygencomments/java/template/index.html +++ /dev/null @@ -1,102 +0,0 @@ - - -SWIG:Examples:java:template - - - - - -SWIG/Examples/java/template/ -
    - -

    C++ template support

    - -

    -This example illustrates how C++ templates can be used from Java using SWIG. - -

    The C++ Code

    - -Lets take a templated function and a templated class as follows: - -
    -
    -/* File : example.h */
    -
    -// Some template definitions
    -
    -template T max(T a, T b) { return  a>b ? a : b; }
    -
    -template class vector {
    -  T *v;
    -  int sz;
    - public:
    -  vector(int _sz) {
    -    v = new T[_sz];
    -    sz = _sz;
    -  }
    -  T &get(int index) {
    -    return v[index];
    -  }
    -  void set(int index, T &val) {
    -    v[index] = val;
    -  }
    -#ifdef SWIG
    -  %addmethods {
    -    T getitem(int index) {
    -      return self->get(index);
    -    }
    -    void setitem(int index, T val) {
    -      self->set(index,val);
    -    }
    -  }
    -#endif
    -};
    -
    -
    -The %addmethods is used for a neater interface from Java as the functions get and set use C++ references to primitive types. These are tricky to use from Java as they end up as a pointer in Java (Java long). - -

    The SWIG interface

    - -A simple SWIG interface for this can be built by simply grabbing the header file -like this: - -
    -
    -/* File : example.i */
    -%module example
    -
    -%{
    -#include "example.h"
    -%}
    -
    -/* Let's just grab the original header file here */
    -%include "example.h"
    -
    -/* Now instantiate some specific template declarations */
    -
    -%template(maxint) max;
    -%template(maxdouble) max;
    -%template(vecint) vector;
    -%template(vecdouble) vector;
    -
    -
    - -Note that SWIG parses the templated function max and templated class vector and so knows about them. However to generate code for use from Java, SWIG has to be told which class/type to use as the template parameter. The SWIG directive %template is used for this. - -

    A sample Java program

    - -Click here to see a Java program that calls the C++ functions from Java. - -

    Notes

    -Use templated classes just like you would any other SWIG generated Java class. Use the classnames specified by the %template directive. - -
    -
    -vecdouble dv = new vecdouble(1000);
    -dv.setitem(i, 12.34));
    -
    -
    - -
    - - diff --git a/Examples/doxygencomments/java/template/main.java b/Examples/doxygencomments/java/template/main.java deleted file mode 100644 index 9129fcf2a..000000000 --- a/Examples/doxygencomments/java/template/main.java +++ /dev/null @@ -1,45 +0,0 @@ -// This example illustrates how C++ templates can be used from Java. - -public class main { - static { - try { - System.loadLibrary("example"); - } catch (UnsatisfiedLinkError e) { - System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e); - System.exit(1); - } - } - - public static void main(String argv[]) - { - // Call some templated functions - System.out.println(example.maxint(3,7)); - System.out.println(example.maxdouble(3.14,2.18)); - - // Create some class - - vecint iv = new vecint(100); - vecdouble dv = new vecdouble(1000); - - for (int i=0; i<100; i++) - iv.setitem(i,2*i); - - for (int i=0; i<1000; i++) - dv.setitem(i, 1.0/(i+1)); - - { - int sum = 0; - for (int i=0; i<100; i++) - sum = sum + iv.getitem(i); - - System.out.println(sum); - } - - { - double sum = 0.0; - for (int i=0; i<1000; i++) - sum = sum + dv.getitem(i); - System.out.println(sum); - } - } -} diff --git a/Examples/doxygencomments/java/typemap/Makefile b/Examples/doxygencomments/java/typemap/Makefile deleted file mode 100644 index 92afbd4d0..000000000 --- a/Examples/doxygencomments/java/typemap/Makefile +++ /dev/null @@ -1,18 +0,0 @@ -TOP = ../.. -SWIG = $(TOP)/../preinst-swig -SRCS = -TARGET = example -INTERFACE = example.i -SWIGOPT = - -all:: java - -java:: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ - SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' java - javac *.java - -clean:: - $(MAKE) -f $(TOP)/Makefile java_clean - -check: all diff --git a/Examples/doxygencomments/java/typemap/example.i b/Examples/doxygencomments/java/typemap/example.i deleted file mode 100644 index 7c97e6673..000000000 --- a/Examples/doxygencomments/java/typemap/example.i +++ /dev/null @@ -1,101 +0,0 @@ -/* File : example.i */ -%module example -%{ -/* - example of a function that returns a value in the char * argument - normally used like: - - char buf[bigenough]; - f1(buf); -*/ - -void f1(char *s) { - if(s != NULL) { - sprintf(s, "hello world"); - } -} - -void f2(char *s) { - f1(s); -} - -void f3(char *s) { - f1(s); -} - -%} - -/* default behaviour is that of input arg, Java cannot return a value in a - * string argument, so any changes made by f1(char*) will not be seen in the Java - * string passed to the f1 function. -*/ -void f1(char *s); - -%include various.i - -/* use the BYTE argout typemap to get around this. Changes in the string by - * f2 can be seen in Java. */ -void f2(char *BYTE); - - - -/* Alternative approach uses a StringBuffer typemap for argout */ - -/* Define the types to use in the generated JNI C code and Java code */ -%typemap(jni) char *SBUF "jobject" -%typemap(jtype) char *SBUF "StringBuffer" -%typemap(jstype) char *SBUF "StringBuffer" - -/* How to convert Java(JNI) type to requested C type */ -%typemap(in) char *SBUF { - - $1 = NULL; - if($input != NULL) { - /* Get the String from the StringBuffer */ - jmethodID setLengthID; - jclass sbufClass = (*jenv)->GetObjectClass(jenv, $input); - jmethodID toStringID = (*jenv)->GetMethodID(jenv, sbufClass, "toString", "()Ljava/lang/String;"); - jstring js = (jstring) (*jenv)->CallObjectMethod(jenv, $input, toStringID); - - /* Convert the String to a C string */ - const char *pCharStr = (*jenv)->GetStringUTFChars(jenv, js, 0); - - /* Take a copy of the C string as the typemap is for a non const C string */ - jmethodID capacityID = (*jenv)->GetMethodID(jenv, sbufClass, "capacity", "()I"); - jint capacity = (*jenv)->CallIntMethod(jenv, $input, capacityID); - $1 = (char *) malloc(capacity+1); - strcpy($1, pCharStr); - - /* Release the UTF string we obtained with GetStringUTFChars */ - (*jenv)->ReleaseStringUTFChars(jenv, js, pCharStr); - - /* Zero the original StringBuffer, so we can replace it with the result */ - setLengthID = (*jenv)->GetMethodID(jenv, sbufClass, "setLength", "(I)V"); - (*jenv)->CallVoidMethod(jenv, $input, setLengthID, (jint) 0); - } -} - -/* How to convert the C type to the Java(JNI) type */ -%typemap(argout) char *SBUF { - - if($1 != NULL) { - /* Append the result to the empty StringBuffer */ - jstring newString = (*jenv)->NewStringUTF(jenv, $1); - jclass sbufClass = (*jenv)->GetObjectClass(jenv, $input); - jmethodID appendStringID = (*jenv)->GetMethodID(jenv, sbufClass, "append", "(Ljava/lang/String;)Ljava/lang/StringBuffer;"); - (*jenv)->CallObjectMethod(jenv, $input, appendStringID, newString); - - /* Clean up the string object, no longer needed */ - free($1); - $1 = NULL; - } -} -/* Prevent the default freearg typemap from being used */ -%typemap(freearg) char *SBUF "" - -/* Convert the jstype to jtype typemap type */ -%typemap(javain) char *SBUF "$javainput" - -/* apply the new typemap to our function */ -void f3(char *SBUF); - diff --git a/Examples/doxygencomments/java/typemap/index.html b/Examples/doxygencomments/java/typemap/index.html deleted file mode 100644 index 486aa8e79..000000000 --- a/Examples/doxygencomments/java/typemap/index.html +++ /dev/null @@ -1,32 +0,0 @@ - - -SWIG:Examples:java:typemap - - - - - -SWIG/Examples/java/typemap/ -
    - -

    Typemaps in Java

    - -

    -This example shows how typemaps can be used to modify the default behaviour of the Java SWIG module. - -

    - -

    Notes

    - -
      -
    • Shows how to pass strings to Java from c and visa versa. -
    • Typemaps can modify the default behaviour of the Java SWIG module. -
    • The default c to java mapping can be modified using typemaps. -
    - -
    - - diff --git a/Examples/doxygencomments/java/typemap/main.java b/Examples/doxygencomments/java/typemap/main.java deleted file mode 100644 index bd9a4e1b6..000000000 --- a/Examples/doxygencomments/java/typemap/main.java +++ /dev/null @@ -1,26 +0,0 @@ - -public class main { - - static { - try { - System.loadLibrary("example"); - } catch (UnsatisfiedLinkError e) { - System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e); - System.exit(1); - } - } - - public static void main(String argv[]) { - String s = "brave new world"; - example.f1(s); - System.out.println("f1(String): " + s); - - byte b[] = new byte[25]; - example.f2(b); - System.out.println("f2(byte[]): " + new String(b)); - - StringBuffer sb = new StringBuffer(20); - example.f3(sb); - System.out.println("f3(StringBuffer): " + sb); - } -} diff --git a/Examples/doxygencomments/java/variables/Makefile b/Examples/doxygencomments/java/variables/Makefile deleted file mode 100644 index 968c92c6c..000000000 --- a/Examples/doxygencomments/java/variables/Makefile +++ /dev/null @@ -1,18 +0,0 @@ -TOP = ../.. -SWIG = $(TOP)/../preinst-swig -SRCS = example.c -TARGET = example -INTERFACE = example.i -SWIGOPT = - -all:: java - -java:: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ - SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' java - javac *.java - -clean:: - $(MAKE) -f $(TOP)/Makefile java_clean - -check: all diff --git a/Examples/doxygencomments/java/variables/example.c b/Examples/doxygencomments/java/variables/example.c deleted file mode 100644 index aa4ffe9b3..000000000 --- a/Examples/doxygencomments/java/variables/example.c +++ /dev/null @@ -1,91 +0,0 @@ -/* File : example.c */ - -/* I'm a file containing some C global variables */ - -/* Deal with Microsoft's attempt at deprecating C standard runtime functions */ -#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) -# define _CRT_SECURE_NO_DEPRECATE -#endif - -#include -#include -#include "example.h" - -int ivar = 0; -short svar = 0; -long lvar = 0; -unsigned int uivar = 0; -unsigned short usvar = 0; -unsigned long ulvar = 0; -signed char scvar = 0; -unsigned char ucvar = 0; -char cvar = 0; -float fvar = 0; -double dvar = 0; -char *strvar = 0; -const char cstrvar[] = "Goodbye"; -int *iptrvar = 0; -char name[256] = "Dave"; -char path[256] = "/home/beazley"; - - -/* Global variables involving a structure */ -Point *ptptr = 0; -Point pt = { 10, 20 }; - -/* A variable that we will make read-only in the interface */ -int status = 1; - -/* A debugging function to print out their values */ - -void print_vars() { - printf("ivar = %d\n", ivar); - printf("svar = %d\n", svar); - printf("lvar = %ld\n", lvar); - printf("uivar = %u\n", uivar); - printf("usvar = %u\n", usvar); - printf("ulvar = %lu\n", ulvar); - printf("scvar = %d\n", scvar); - printf("ucvar = %u\n", ucvar); - printf("fvar = %g\n", fvar); - printf("dvar = %g\n", dvar); - printf("cvar = %c\n", cvar); - printf("strvar = %s\n", strvar ? strvar : "(null)"); - printf("cstrvar = %s\n", cstrvar ? cstrvar : "(null)"); - printf("iptrvar = %p\n", iptrvar); - printf("name = %s\n", name); - printf("ptptr = %p (%d, %d)\n", ptptr, ptptr ? ptptr->x : 0, ptptr ? ptptr->y : 0); - printf("pt = (%d, %d)\n", pt.x, pt.y); - printf("status = %d\n", status); -} - -/* A function to create an integer (to test iptrvar) */ - -int *new_int(int value) { - int *ip = (int *) malloc(sizeof(int)); - *ip = value; - return ip; -} - -/* A function to create a point */ - -Point *new_Point(int x, int y) { - Point *p = (Point *) malloc(sizeof(Point)); - p->x = x; - p->y = y; - return p; -} - -char * Point_print(Point *p) { - static char buffer[256]; - if (p) { - sprintf(buffer,"(%d,%d)", p->x,p->y); - } else { - sprintf(buffer,"null"); - } - return buffer; -} - -void pt_print() { - printf("(%d, %d)\n", pt.x, pt.y); -} diff --git a/Examples/doxygencomments/java/variables/example.h b/Examples/doxygencomments/java/variables/example.h deleted file mode 100644 index 2265a45f3..000000000 --- a/Examples/doxygencomments/java/variables/example.h +++ /dev/null @@ -1,6 +0,0 @@ -/* File: example.h */ - -typedef struct { - int x,y; -} Point; /*!< Description of struct Point */ - diff --git a/Examples/doxygencomments/java/variables/example.i b/Examples/doxygencomments/java/variables/example.i deleted file mode 100644 index b9794f0cf..000000000 --- a/Examples/doxygencomments/java/variables/example.i +++ /dev/null @@ -1,57 +0,0 @@ -/* File : example.i */ -%module example -%{ -#include "example.h" -%} - -/* Some global variable declarations */ -%inline %{ -extern int ivar; /*!< Description of ivar */ -extern short svar; /*!< Description of svar */ -extern long lvar; /*!< Description of lvar */ -extern unsigned int uivar; /*!< Description of uivar */ -extern unsigned short usvar; /*!< Description of usvar */ -extern unsigned long ulvar; /*!< Description of ulvar */ -extern signed char scvar; /*!< Description of scvar */ -extern unsigned char ucvar; /*!< Description of ucvar */ -extern char cvar; /*!< Description of cvar */ -extern float fvar; /*!< Description of fvar */ -extern double dvar; /*!< Description of dvar */ -extern char *strvar; /*!< Description of strvar */ -extern const char cstrvar[]; /*!< Description of cstrvar */ -extern int *iptrvar; /*!< Description of iptrvar */ -extern char name[256]; /*!< Description of name */ - -extern Point *ptptr; /*!< Description of ptrptr */ -extern Point pt; /*!< Description of pt */ -%} - - -/* Some read-only variables */ - -%immutable; - -%inline %{ -extern int status; -extern char path[256]; -%} - -%mutable; - -/* Some helper functions to make it easier to test */ -%inline %{ -/*! this function prints variables - \author someone */ -extern void print_vars(); -extern int *new_int(int value); /*!< Description of new_int - \param value the value - \return a new int */ -/*! Description of new_point - \param x the value x - \param y the value y - \return a new point */ -extern Point *new_Point(int x, int y); -extern char *Point_print(Point *p); -extern void pt_print(); -%} - diff --git a/Examples/doxygencomments/java/variables/index.html b/Examples/doxygencomments/java/variables/index.html deleted file mode 100644 index 05aaa2d6e..000000000 --- a/Examples/doxygencomments/java/variables/index.html +++ /dev/null @@ -1,85 +0,0 @@ - - -SWIG:Examples:java:variables - - - - -SWIG/Examples/java/variables/ -
    - -

    Wrapping C Global Variables

    - -

    -When a C global variable appears in an interface file, SWIG tries to -wrap it using a technique known as "variable linking." The idea is -pretty simple---we try to create a Java variable that magically -retrieves or updates the value of the underlying C variable when it is -accessed. Click here to see a SWIG interface with some variable -declarations in it. - - -

    Click here for the section on global variables in the SWIG and Java documentation.

    -

    Manipulating Variables from Java

    - -C variables are accessed through getters and setters from Java. Unfortunately this is the only way to get current values from variables because it is not possible to overload the dot operator in Java. All global variables are accessible from the module class. For example if the module class is called 'example', the global variable - -
    -
    -double foo;
    -
    -
    - -will be accessed in the Java module as -
    -
    -example.get_foo();
    -example.set_foo(12.3);
    -
    -
    - -Click here to see the example program that updates and prints -out the values of the variables using this technique. - -

    Key points

    - -
      -
    • When a global variable has the type "char *", SWIG manages it as a character -string. However, whenever the value of such a variable is set from Java, the old -value is destroyed using free() or delete (the choice of which depends -on whether or not SWIG was run with the -c++ option). -
    • signed char and unsigned char are handled as small 8-bit integers. -
    • String array variables such as 'char name[256]' are managed as Java strings, but -when setting the value, the result is truncated to the maximum length of the array. Furthermore, the string is assumed to be null-terminated. -
    • When structures and classes are used as global variables, they are mapped into pointers. -Getting the "value" returns a pointer to the global variable. Setting the value of a structure results in a memory copy from a pointer to the global. -
    - -

    Creating read-only variables

    - -The %immutable and %mutable directives can be used to -specify a collection of read-only variables. For example: - -
    -
    -%immutable;
    -int    status;
    -double blah;
    -...
    -%mutable;
    -
    -
    - -The %immutable directive remains in effect until it is explicitly disabled -using the %mutable directive. - -

    Comments

    -
      -
    • Management of global variables is one of the most problematic aspects -of C/C++ wrapping because the Java interface and resulting memory management -is much trickier than simply creating a wrapper function. -
    - - - -
    diff --git a/Examples/doxygencomments/java/variables/main.java b/Examples/doxygencomments/java/variables/main.java deleted file mode 100644 index 92745db99..000000000 --- a/Examples/doxygencomments/java/variables/main.java +++ /dev/null @@ -1,97 +0,0 @@ -// This example illustrates global variable access from Java. - -import java.lang.reflect.*; - -public class main { - static { - try { - System.loadLibrary("example"); - } catch (UnsatisfiedLinkError e) { - System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e); - System.exit(1); - } - } - - public static void main(String argv[]) { - -// Try to set the values of some global variables - - example.setIvar(42); - example.setSvar((short)-31000); - example.setLvar(65537); - example.setUivar(123456); - example.setUsvar(61000); - example.setUlvar(654321); - example.setScvar((byte)-13); - example.setUcvar((short)251); - example.setCvar('S'); - example.setFvar((float)3.14159); - example.setDvar(2.1828); - example.setStrvar("Hello World"); - example.setIptrvar(example.new_int(37)); - example.setPtptr(example.new_Point(37,42)); - example.setName("Bill"); - - // Now print out the values of the variables - - System.out.println( "Variables (values printed from Java)" ); - - System.out.println( "ivar =" + example.getIvar() ); - System.out.println( "svar =" + example.getSvar() ); - System.out.println( "lvar =" + example.getLvar() ); - System.out.println( "uivar =" + example.getUivar() ); - System.out.println( "usvar =" + example.getUsvar() ); - System.out.println( "ulvar =" + example.getUlvar() ); - System.out.println( "scvar =" + example.getScvar() ); - System.out.println( "ucvar =" + example.getUcvar() ); - System.out.println( "fvar =" + example.getFvar() ); - System.out.println( "dvar =" + example.getDvar() ); - System.out.println( "cvar =" + (char)example.getCvar() ); - System.out.println( "strvar =" + example.getStrvar() ); - System.out.println( "cstrvar =" + example.getCstrvar() ); - System.out.println( "iptrvar =" + Long.toHexString(SWIGTYPE_p_int.getCPtr(example.getIptrvar())) ); - System.out.println( "name =" + example.getName() ); - System.out.println( "ptptr =" + Long.toHexString(SWIGTYPE_p_Point.getCPtr(example.getPtptr())) + example.Point_print(example.getPtptr()) ); - System.out.println( "pt =" + Long.toHexString(SWIGTYPE_p_Point.getCPtr(example.getPt())) + example.Point_print(example.getPt()) ); - - System.out.println( "\nVariables (values printed from C)" ); - - example.print_vars(); - - System.out.println( "\nNow I'm going to try and modify some read only variables" ); - - System.out.println( " Trying to set 'path'" ); - try { - Method m = example.class.getDeclaredMethod("setPath", new Class[] {String.class}); - m.invoke(example.class, new Object[] {"Whoa!"} ); - System.out.println( "Hey, what's going on?!?! This shouldn't work" ); - } - catch (NoSuchMethodException e) { - System.out.println( "Good." ); - } - catch (Throwable t) { - System.out.println( "You shouldn't see this!" ); - } - - System.out.println( " Trying to set 'status'" ); - try { - Method m = example.class.getDeclaredMethod("setStatus", new Class[] {Integer.class}); - m.invoke(example.class, new Object[] {new Integer(0)} ); - System.out.println( "Hey, what's going on?!?! This shouldn't work" ); - } - catch (NoSuchMethodException e) { - System.out.println( "Good." ); - } - catch (Throwable t) { - System.out.println( "You shouldn't see this!" ); - } - - System.out.println( "\nI'm going to try and update a structure variable.\n" ); - - example.setPt(example.getPtptr()); - - System.out.println( "The new value is" ); - example.pt_print(); - System.out.println( "You should see the value" + example.Point_print(example.getPtptr()) ); - } -} diff --git a/Examples/java/check.list b/Examples/java/check.list index 825d04a6d..c30550a1c 100644 --- a/Examples/java/check.list +++ b/Examples/java/check.list @@ -2,6 +2,7 @@ callback class constants +doxygen enum extend funcptr diff --git a/Examples/java/doxygen/Makefile b/Examples/java/doxygen/Makefile new file mode 100644 index 000000000..9f471746e --- /dev/null +++ b/Examples/java/doxygen/Makefile @@ -0,0 +1,21 @@ +TOP = ../.. +SWIGEXE = $(TOP)/../swig +SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib +CXXSRCS = example.cxx +TARGET = example +INTERFACE = example.i +SWIGOPT = -doxygen +JAVASRCS = *.java + +check: build + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' java_run + +build: + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \ + SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \ + SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' java_cpp + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' JAVASRCS='$(JAVASRCS)' JAVAFLAGS='$(JAVAFLAGS)' java_compile + +clean: + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' java_clean + rm -rf javadocs diff --git a/Examples/java/doxygen/example.cxx b/Examples/java/doxygen/example.cxx new file mode 100644 index 000000000..ccdb87dfe --- /dev/null +++ b/Examples/java/doxygen/example.cxx @@ -0,0 +1,48 @@ +/* File : example.cxx */ + +#include "example.h" +#define M_PI 3.14159265358979323846 + +/* Move the shape to a new location */ +void Shape::move(double dx, double dy) { + x += dx; + y += dy; +} + +int Shape::nshapes = 0; + +Circle::Circle(double r) : radius(r) { + NumCircles++; +} + +double Circle::area() { + return M_PI*radius*radius; +} + +double Circle::perimeter() { + return 2*M_PI*radius; +} + +Square::Square(double w) : width(w) { + NumSquares++; +} + +double Square::area() { + return width*width; +} + +double Square::perimeter() { + return 4*width; +} + +int NumSquares = 0; +int NumCircles = 0; + +Square MakeSquare(double r) { + return Square(r); +} + +Circle MakeCircle(double w) { + return Circle(w); +} + diff --git a/Examples/doxygencomments/java/class/example.dsp b/Examples/java/doxygen/example.dsp similarity index 95% rename from Examples/doxygencomments/java/class/example.dsp rename to Examples/java/doxygen/example.dsp index fbe87e7a4..f52544b95 100644 --- a/Examples/doxygencomments/java/class/example.dsp +++ b/Examples/java/doxygen/example.dsp @@ -136,7 +136,7 @@ InputName=example echo JAVA_INCLUDE: %JAVA_INCLUDE% echo JAVA_BIN: %JAVA_BIN% echo on - ..\..\..\swig.exe -c++ -java $(InputPath) + ..\..\..\swig.exe -c++ -java "$(InputPath)" # End Custom Build @@ -151,7 +151,7 @@ InputName=example echo JAVA_INCLUDE: %JAVA_INCLUDE% echo JAVA_BIN: %JAVA_BIN% echo on - ..\..\..\swig.exe -c++ -java $(InputPath) + ..\..\..\swig.exe -c++ -java "$(InputPath)" # End Custom Build diff --git a/Examples/java/doxygen/example.h b/Examples/java/doxygen/example.h new file mode 100644 index 000000000..203348ae4 --- /dev/null +++ b/Examples/java/doxygen/example.h @@ -0,0 +1,107 @@ +/*! \file example.h +This file provides a simple set of Shape classes. */ + +/*! Base class for all shapes. + \author Bob + */ +class Shape { +public: + /*! Default constructor for creating a Shape */ + Shape() { + nshapes++; + } + /*! Destructor for destroying a Shape */ + virtual ~Shape() { + nshapes--; + } + double x; /*!< x co-ordinate */ + double y; /*!< y co-ordinate */ + void move(double dx, double dy); /*!< Move a shape to a new co-ordinate + \param dx x co-ordinate + \param dy y co-ordinate */ + virtual double area() = 0; /*!< \return the area */ + virtual double perimeter() = 0; /*!< \return the perimeter */ + static int nshapes; /*!< Number of shapes currently in existence */ +}; + +/*! A class for representing a circle. + \author Jack + */ +class Circle : public Shape { +private: + double radius; +public: + /*! Construct a circle + * \param r radius of the circle */ + Circle(double r); + /*! Calculate the area of the circle + * \return calculated area */ + virtual double area(); + /*! Calculate the perimeter of the circle + * \return calculated perimeter of the circle */ + virtual double perimeter(); +}; + +/// A class for representing a square. +class Square : public Shape { +private: + double width; +public: + /** Construct a square + * \param w width of the square */ + Square(double w); + /** Calculate the area of the square + * \return calculated area */ + virtual double area(); + /** Calculate the perimeter of the square + * \return calculated perimeter of the square */ + virtual double perimeter(); +}; + +/// A class for representing a rectangle, templated on the type for the rectangle dimensions +template +class Rectangle : public Shape { +private: + T height; + T width; +public: + /** Construct a rectangle + * \param h height of the rectangle + * \param w width of the rectangle */ + Rectangle(T h, T w) : height(h), width(w) {} + /** Calculate the area of the rectangle + * \return calculated area */ + virtual double area() { return width*height; } + /** Calculate the perimeter of the rectangle + * \return calculated perimeter of the rectangle */ + virtual double perimeter() { return 2*height + 2*width; } +}; + + +/*! Factory function for creating a square + * \param r width of the square + * \return a fully constructed square */ +Square MakeSquare(double r); + +/*! Factory function for creating a circle + * \param w radius of the circle + * \return a fully constructed circle */ +Circle MakeCircle(double w); + +/*! Factory function for creating a rectangle + * \param h height of the rectangle + * \param w width of the rectangle + * \return a fully constructed rectangle */ +template +Rectangle MakeRectangle(T h, T w) { + return Rectangle(h, w); +} + + + +/*! Total number of circles ever created */ +extern int NumCircles; + +/// Total number of squares ever created +extern int NumSquares; + diff --git a/Examples/java/doxygen/example.i b/Examples/java/doxygen/example.i new file mode 100644 index 000000000..803563dd9 --- /dev/null +++ b/Examples/java/doxygen/example.i @@ -0,0 +1,17 @@ +%module example + +%{ +#include "example.h" +%} + +%immutable NumSquares; +%immutable NumCircles; + +%include "example.h" + +/*! - this instantiation uses type int */ +%template(RectangleInt) Rectangle; + +/*! - this instantiation uses type int */ +%template(MakeRectangleInt) MakeRectangle; + diff --git a/Examples/java/doxygen/runme.java b/Examples/java/doxygen/runme.java new file mode 100644 index 000000000..6b7bb3d01 --- /dev/null +++ b/Examples/java/doxygen/runme.java @@ -0,0 +1,63 @@ +// This example shows simple usage of the wrapped Shape classes. +// The main purpose of this example is to show the doxygen comments translation to JavaDoc comments. +// Users should look at the generated .java files and if javadoc is installed and working on your system, +// the generated Java docs can be viewed in a browser by opening the javadocs/index.html file. + +import java.io.*; + +public class runme { + static { + try { + System.loadLibrary("example"); + } catch (UnsatisfiedLinkError e) { + System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e); + System.exit(1); + } + } + + public static void main(String argv[]) throws InterruptedException, IOException + { + System.out.println("Creating some objects:"); + Circle c = example.MakeCircle(10); + System.out.println(" Created circle " + c); + Square s = example.MakeSquare(10); + System.out.println(" Created square " + s); + RectangleInt r = example.MakeRectangleInt(10, 20); + System.out.println(" Created rectangle " + r); + + System.out.println("\nHere are some properties of the shapes:"); + Shape[] shapes = {c, s, r}; + for (int i=0; i Date: Thu, 31 May 2018 20:48:02 +0100 Subject: [PATCH 310/314] Add Python doxygen example --- Examples/python/check.list | 1 + Examples/python/doxygen/Makefile | 27 +++++ Examples/python/doxygen/example.cxx | 48 +++++++++ Examples/python/doxygen/example.dsp | 152 ++++++++++++++++++++++++++++ Examples/python/doxygen/example.h | 107 ++++++++++++++++++++ Examples/python/doxygen/example.i | 17 ++++ Examples/python/doxygen/runme.py | 28 +++++ 7 files changed, 380 insertions(+) create mode 100644 Examples/python/doxygen/Makefile create mode 100644 Examples/python/doxygen/example.cxx create mode 100644 Examples/python/doxygen/example.dsp create mode 100644 Examples/python/doxygen/example.h create mode 100644 Examples/python/doxygen/example.i create mode 100644 Examples/python/doxygen/runme.py diff --git a/Examples/python/check.list b/Examples/python/check.list index 73182025d..0798b5f7e 100644 --- a/Examples/python/check.list +++ b/Examples/python/check.list @@ -4,6 +4,7 @@ class constants contract docstrings +doxygen enum exception exceptproxy diff --git a/Examples/python/doxygen/Makefile b/Examples/python/doxygen/Makefile new file mode 100644 index 000000000..1a0e3d7c5 --- /dev/null +++ b/Examples/python/doxygen/Makefile @@ -0,0 +1,27 @@ +TOP = ../.. +SWIGEXE = $(TOP)/../swig +SWIG_LIB_DIR = $(TOP)/../$(TOP_BUILDDIR_TO_TOP_SRCDIR)Lib +CXXSRCS = example.cxx +TARGET = example +INTERFACE = example.i +LIBS = -lm +SWIGOPT = -doxygen + +check: build + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_run + +build: + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \ + SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \ + SWIGOPT='$(SWIGOPT)' \ + TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' python_cpp + +static: + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' \ + SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \ + SWIGOPT='$(SWIGOPT)' \ + TARGET='mypython' INTERFACE='$(INTERFACE)' python_cpp_static + +clean: + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='$(TARGET)' python_clean + rm -f example.html diff --git a/Examples/python/doxygen/example.cxx b/Examples/python/doxygen/example.cxx new file mode 100644 index 000000000..ccdb87dfe --- /dev/null +++ b/Examples/python/doxygen/example.cxx @@ -0,0 +1,48 @@ +/* File : example.cxx */ + +#include "example.h" +#define M_PI 3.14159265358979323846 + +/* Move the shape to a new location */ +void Shape::move(double dx, double dy) { + x += dx; + y += dy; +} + +int Shape::nshapes = 0; + +Circle::Circle(double r) : radius(r) { + NumCircles++; +} + +double Circle::area() { + return M_PI*radius*radius; +} + +double Circle::perimeter() { + return 2*M_PI*radius; +} + +Square::Square(double w) : width(w) { + NumSquares++; +} + +double Square::area() { + return width*width; +} + +double Square::perimeter() { + return 4*width; +} + +int NumSquares = 0; +int NumCircles = 0; + +Square MakeSquare(double r) { + return Square(r); +} + +Circle MakeCircle(double w) { + return Circle(w); +} + diff --git a/Examples/python/doxygen/example.dsp b/Examples/python/doxygen/example.dsp new file mode 100644 index 000000000..95ad8f173 --- /dev/null +++ b/Examples/python/doxygen/example.dsp @@ -0,0 +1,152 @@ +# Microsoft Developer Studio Project File - Name="example" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +CFG=example - Win32 Release +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "example.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "example.mak" CFG="example - Win32 Release" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "example - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "example - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "example - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "EXAMPLE_EXPORTS" /YX /FD /GZ /c +# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "$(PYTHON_INCLUDE)" /D "SWIG_PYTHON_INTERPRETER_NO_DEBUG" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "EXAMPLE_EXPORTS" /YX /FD /GZ /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x809 /d "_DEBUG" +# ADD RSC /l 0x809 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /dll /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib "$(PYTHON_LIB)" /nologo /dll /debug /machine:I386 /out:"_example.pyd" /pdbtype:sept + +!ELSEIF "$(CFG)" == "example - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "EXAMPLE_EXPORTS" /YX /FD /c +# ADD CPP /nologo /MT /W3 /GX /O2 /I "$(PYTHON_INCLUDE)" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "EXAMPLE_EXPORTS" /YX /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x809 /d "NDEBUG" +# ADD RSC /l 0x809 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /dll /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib "$(PYTHON_LIB)" /nologo /dll /machine:I386 /out:"_example.pyd" + +!ENDIF + +# Begin Target + +# Name "example - Win32 Debug" +# Name "example - Win32 Release" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\example.cxx +# End Source File +# Begin Source File + +SOURCE=.\example_wrap.cxx +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=.\example.h +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# End Group +# Begin Source File + +SOURCE=.\example.i + +!IF "$(CFG)" == "example - Win32 Debug" + +# Begin Custom Build +InputPath=.\example.i +InputName=example + +"$(InputName)_wrap.cxx" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + echo In order to function correctly, please ensure the following environment variables are correctly set: + echo PYTHON_INCLUDE: %PYTHON_INCLUDE% + echo PYTHON_LIB: %PYTHON_LIB% + echo on + ..\..\..\swig.exe -c++ -python "$(InputPath)" + +# End Custom Build + +!ELSEIF "$(CFG)" == "example - Win32 Release" + +# Begin Custom Build +InputPath=.\example.i +InputName=example + +"$(InputName)_wrap.cxx" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + echo In order to function correctly, please ensure the following environment variables are correctly set: + echo PYTHON_INCLUDE: %PYTHON_INCLUDE% + echo PYTHON_LIB: %PYTHON_LIB% + echo on + ..\..\..\swig.exe -c++ -python "$(InputPath)" + +# End Custom Build + +!ENDIF + +# End Source File +# End Target +# End Project diff --git a/Examples/python/doxygen/example.h b/Examples/python/doxygen/example.h new file mode 100644 index 000000000..203348ae4 --- /dev/null +++ b/Examples/python/doxygen/example.h @@ -0,0 +1,107 @@ +/*! \file example.h +This file provides a simple set of Shape classes. */ + +/*! Base class for all shapes. + \author Bob + */ +class Shape { +public: + /*! Default constructor for creating a Shape */ + Shape() { + nshapes++; + } + /*! Destructor for destroying a Shape */ + virtual ~Shape() { + nshapes--; + } + double x; /*!< x co-ordinate */ + double y; /*!< y co-ordinate */ + void move(double dx, double dy); /*!< Move a shape to a new co-ordinate + \param dx x co-ordinate + \param dy y co-ordinate */ + virtual double area() = 0; /*!< \return the area */ + virtual double perimeter() = 0; /*!< \return the perimeter */ + static int nshapes; /*!< Number of shapes currently in existence */ +}; + +/*! A class for representing a circle. + \author Jack + */ +class Circle : public Shape { +private: + double radius; +public: + /*! Construct a circle + * \param r radius of the circle */ + Circle(double r); + /*! Calculate the area of the circle + * \return calculated area */ + virtual double area(); + /*! Calculate the perimeter of the circle + * \return calculated perimeter of the circle */ + virtual double perimeter(); +}; + +/// A class for representing a square. +class Square : public Shape { +private: + double width; +public: + /** Construct a square + * \param w width of the square */ + Square(double w); + /** Calculate the area of the square + * \return calculated area */ + virtual double area(); + /** Calculate the perimeter of the square + * \return calculated perimeter of the square */ + virtual double perimeter(); +}; + +/// A class for representing a rectangle, templated on the type for the rectangle dimensions +template +class Rectangle : public Shape { +private: + T height; + T width; +public: + /** Construct a rectangle + * \param h height of the rectangle + * \param w width of the rectangle */ + Rectangle(T h, T w) : height(h), width(w) {} + /** Calculate the area of the rectangle + * \return calculated area */ + virtual double area() { return width*height; } + /** Calculate the perimeter of the rectangle + * \return calculated perimeter of the rectangle */ + virtual double perimeter() { return 2*height + 2*width; } +}; + + +/*! Factory function for creating a square + * \param r width of the square + * \return a fully constructed square */ +Square MakeSquare(double r); + +/*! Factory function for creating a circle + * \param w radius of the circle + * \return a fully constructed circle */ +Circle MakeCircle(double w); + +/*! Factory function for creating a rectangle + * \param h height of the rectangle + * \param w width of the rectangle + * \return a fully constructed rectangle */ +template +Rectangle MakeRectangle(T h, T w) { + return Rectangle(h, w); +} + + + +/*! Total number of circles ever created */ +extern int NumCircles; + +/// Total number of squares ever created +extern int NumSquares; + diff --git a/Examples/python/doxygen/example.i b/Examples/python/doxygen/example.i new file mode 100644 index 000000000..803563dd9 --- /dev/null +++ b/Examples/python/doxygen/example.i @@ -0,0 +1,17 @@ +%module example + +%{ +#include "example.h" +%} + +%immutable NumSquares; +%immutable NumCircles; + +%include "example.h" + +/*! - this instantiation uses type int */ +%template(RectangleInt) Rectangle; + +/*! - this instantiation uses type int */ +%template(MakeRectangleInt) MakeRectangle; + diff --git a/Examples/python/doxygen/runme.py b/Examples/python/doxygen/runme.py new file mode 100644 index 000000000..e23528874 --- /dev/null +++ b/Examples/python/doxygen/runme.py @@ -0,0 +1,28 @@ +# This example shows simple usage of the wrapped Shape classes. +# The main purpose of this example is to show the doxygen comments translation to PyDoc comments. +# Users should look at the generated example.py file. +# The generated PyDoc can be viewed in a browser by opening the example.html file. + +import example + +print "Creating some objects:" +c = example.MakeCircle(10) +print " Created circle", c +s = example.MakeSquare(10) +print " Created square", s +r = example.MakeRectangleInt(10, 20) +print " Created rectangle", r + +print "\nHere are some properties of the shapes:" +for o in [c, s, r]: + print " ", o + print " area = ", o.area() + print " perimeter = ", o.perimeter() + +print "\nRunning pydoc, this is the equivalent to executing: pydoc -w ./example.py" + +import pydoc + +pydoc.writedoc("example") + +print "Open example.html in your browser to view the generated python docs" From 15f16155f2f3f4c82726e27dd77c219ba6c4732d Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Fri, 1 Jun 2018 21:00:06 +0100 Subject: [PATCH 311/314] Move doxygen warning numbers Move out of the range reserved for language modules --- .../errors/doxygen_unknown_command.stderr | 2 +- Source/Include/swigwarn.h | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Examples/test-suite/errors/doxygen_unknown_command.stderr b/Examples/test-suite/errors/doxygen_unknown_command.stderr index 1ac00d6b0..e92da6e6c 100644 --- a/Examples/test-suite/errors/doxygen_unknown_command.stderr +++ b/Examples/test-suite/errors/doxygen_unknown_command.stderr @@ -1 +1 @@ -doxygen_unknown_command.i:4: Warning 760: Doxygen parser warning: unknown command "unknown". +doxygen_unknown_command.i:4: Warning 560: Doxygen parser warning: unknown command "unknown". diff --git a/Source/Include/swigwarn.h b/Source/Include/swigwarn.h index c0921530f..a7f9526e1 100644 --- a/Source/Include/swigwarn.h +++ b/Source/Include/swigwarn.h @@ -209,6 +209,14 @@ #define WARN_LANG_EXTEND_CONSTRUCTOR 522 #define WARN_LANG_EXTEND_DESTRUCTOR 523 +/* -- Doxygen comments -- */ + +#define WARN_DOXYGEN_UNKNOWN_COMMAND 560 +#define WARN_DOXYGEN_UNEXPECTED_END_OF_COMMENT 561 +#define WARN_DOXYGEN_COMMAND_EXPECTED 562 +#define WARN_DOXYGEN_UNTERMINATED_STRING 563 +#define WARN_DOXYGEN_COMMAND_ERROR 564 + /* -- Reserved (600-799) -- */ /* -- Language module specific warnings (700 - 899) -- */ @@ -241,14 +249,6 @@ /* please leave 740-759 free for Python */ -#define WARN_DOXYGEN_UNKNOWN_COMMAND 760 -#define WARN_DOXYGEN_UNEXPECTED_END_OF_COMMENT 761 -#define WARN_DOXYGEN_COMMAND_EXPECTED 762 -#define WARN_DOXYGEN_UNTERMINATED_STRING 763 -#define WARN_DOXYGEN_COMMAND_ERROR 764 - -/* please leave 760-779 free for Doxygen */ - #define WARN_RUBY_WRONG_NAME 801 #define WARN_RUBY_MULTIPLE_INHERITANCE 802 From 396910c100cd4d50167ce5aa78a2fd110adbbb81 Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Tue, 5 Jun 2018 18:40:30 +0100 Subject: [PATCH 312/314] Doxygen warnings cleanup - Remove unused warnings. - Refactor some warnings. - Document all Doxygen warnings. --- Doc/Manual/Warnings.html | 12 ++++- .../errors/doxygen_unknown_command.stderr | 2 +- Source/Doxygen/doxyparser.cxx | 53 +++++++++---------- Source/Include/swigwarn.h | 3 +- 4 files changed, 40 insertions(+), 30 deletions(-) diff --git a/Doc/Manual/Warnings.html b/Doc/Manual/Warnings.html index 4fdff486b..853ab691e 100644 --- a/Doc/Manual/Warnings.html +++ b/Doc/Manual/Warnings.html @@ -506,7 +506,7 @@ example.i(4) : Syntax error in input(1). -

    17.9.5 Code generation (500-599)

    +

    17.9.5 Code generation (500-559)

      @@ -535,6 +535,16 @@ example.i(4) : Syntax error in input(1).
    • 523. Use of an illegal destructor name 'name' in %extend is deprecated, the destructor name should be 'name'.
    +

    Doxygen comments (560-599)

    + +
      +
    • 560: Unknown Doxygen command: command.
    • +
    • 561: Unexpected end of Doxygen comment encountered.
    • +
    • 562: Expected Doxygen command: command
    • +
    • 563: Doxygen HTML error for tag tag: error text.
    • +
    • 564: Error parsing Doxygen command command: error text. Command ignored."
    • +
    +

    17.9.6 Language module specific (700-899)

    diff --git a/Examples/test-suite/errors/doxygen_unknown_command.stderr b/Examples/test-suite/errors/doxygen_unknown_command.stderr index e92da6e6c..e5c32cc4b 100644 --- a/Examples/test-suite/errors/doxygen_unknown_command.stderr +++ b/Examples/test-suite/errors/doxygen_unknown_command.stderr @@ -1 +1 @@ -doxygen_unknown_command.i:4: Warning 560: Doxygen parser warning: unknown command "unknown". +doxygen_unknown_command.i:4: Warning 560: Unknown Doxygen command: unknown. diff --git a/Source/Doxygen/doxyparser.cxx b/Source/Doxygen/doxyparser.cxx index 558b0401f..7286adeb0 100644 --- a/Source/Doxygen/doxyparser.cxx +++ b/Source/Doxygen/doxyparser.cxx @@ -279,7 +279,7 @@ std::string DoxygenParser::getStringTilEndCommand(const std::string &theCommand, m_tokenListIt++; } - printListError(WARN_DOXYGEN_COMMAND_EXPECTED, theCommand + " command expected"); + printListError(WARN_DOXYGEN_COMMAND_EXPECTED, "Expected Doxygen command: " + theCommand + "."); return description; } @@ -384,7 +384,7 @@ void DoxygenParser::addCommandWord(const std::string &theCommand, const TokenLis aNewList.push_back(DoxygenEntity("plainstd::string", name)); doxyList.push_back(DoxygenEntity(theCommand, aNewList)); } else { - printListError(WARN_DOXYGEN_COMMAND_ERROR, "No word followed " + theCommand + " command. Not added"); + printListError(WARN_DOXYGEN_COMMAND_ERROR, "Error parsing Doxygen command " + theCommand + ": No word followed the command. Command ignored."); } } @@ -412,7 +412,7 @@ void DoxygenParser::addCommandEndCommand(const std::string &theCommand, const To cout << "Parsing " << theCommand << endl; TokenListCIt endCommand = getEndCommand("end" + theCommand, tokList); if (endCommand == tokList.end()) { - printListError(WARN_DOXYGEN_COMMAND_EXPECTED, "Expected end" + theCommand); + printListError(WARN_DOXYGEN_COMMAND_EXPECTED, "Expected Doxygen command: end" + theCommand + "."); return; } DoxygenEntityList aNewList; @@ -428,7 +428,7 @@ void DoxygenParser::addCommandWordParagraph(const std::string &theCommand, const std::string name = getNextWord(); if (name.empty()) { - printListError(WARN_DOXYGEN_COMMAND_ERROR, "No word followed " + theCommand + " command. Not added"); + printListError(WARN_DOXYGEN_COMMAND_ERROR, "Error parsing Doxygen command " + theCommand + ": No word followed the command. Command ignored."); return; } TokenListCIt endOfParagraph = getEndOfParagraph(tokList); @@ -443,7 +443,7 @@ void DoxygenParser::addCommandWordLine(const std::string &theCommand, const Toke cout << "Parsing " << theCommand << endl; std::string name = getNextWord(); if (name.empty()) { - printListError(WARN_DOXYGEN_COMMAND_ERROR, "No word followed " + theCommand + " command. Not added"); + printListError(WARN_DOXYGEN_COMMAND_ERROR, "Error parsing Doxygen command " + theCommand + ": No word followed the command. Command ignored."); return; } @@ -461,7 +461,7 @@ void DoxygenParser::addCommandWordOWordOWord(const std::string &theCommand, cons std::string name = getNextWord(); if (name.empty()) { - printListError(WARN_DOXYGEN_COMMAND_ERROR, "No word followed " + theCommand + " command. Not added"); + printListError(WARN_DOXYGEN_COMMAND_ERROR, "Error parsing Doxygen command " + theCommand + ": No word followed the command. Command ignored."); return; } std::string headerfile = getNextWord(); @@ -487,8 +487,7 @@ void DoxygenParser::addCommandOWord(const std::string &theCommand, const TokenLi void DoxygenParser::addCommandErrorThrow(const std::string &theCommand, const TokenList &tokList, DoxygenEntityList &) { - printListError(WARN_DOXYGEN_COMMAND_ERROR, - "Encountered: " + theCommand + "\nThis command should not have been encountered. Behaviour past this may be unpredictable"); + printListError(WARN_DOXYGEN_COMMAND_ERROR, "Error parsing Doxygen command " + theCommand + ": Unexpectedly encountered this command."); m_tokenListIt = getOneLine(tokList); } @@ -524,17 +523,17 @@ void DoxygenParser::addCommandUnique(const std::string &theCommand, const TokenL cout << "Parsing " << theCommand << endl; std::string key = getNextWord(); if (key.empty()) { - printListError(WARN_DOXYGEN_COMMAND_ERROR, "No key followed " + theCommand + " command. Not added"); + printListError(WARN_DOXYGEN_COMMAND_ERROR, "Error parsing Doxygen command " + theCommand + ": No key followed the command. Command ignored."); return; } std::string heading = getNextWord(); if (key.empty()) { - printListError(WARN_DOXYGEN_COMMAND_ERROR, "No heading followed " + theCommand + " command. Not added"); + printListError(WARN_DOXYGEN_COMMAND_ERROR, "Error parsing Doxygen command " + theCommand + ": No heading followed the command. Command ignored."); return; } std::string title = getNextWord(); if (title.empty()) { - printListError(WARN_DOXYGEN_COMMAND_ERROR, "No title followed " + theCommand + " command. Not added"); + printListError(WARN_DOXYGEN_COMMAND_ERROR, "Error parsing Doxygen command " + theCommand + ": No title followed the command. Command ignored."); return; } TokenListCIt endOfParagraph = getEndOfParagraph(tokList); @@ -592,7 +591,7 @@ void DoxygenParser::addCommandUnique(const std::string &theCommand, const TokenL cout << "Parsing " << theCommand << endl; std::string name = getNextWord(); if (name.empty()) { - printListError(WARN_DOXYGEN_COMMAND_ERROR, "No word followed " + theCommand + " command. Not added"); + printListError(WARN_DOXYGEN_COMMAND_ERROR, "Error parsing Doxygen command " + theCommand + ": No word followed the command. Command ignored."); return; } DoxygenEntityList aNewList; @@ -609,7 +608,7 @@ void DoxygenParser::addCommandUnique(const std::string &theCommand, const TokenL cout << "Parsing " << theCommand << endl; std::string name = getNextWord(); if (name.empty()) { - printListError(WARN_DOXYGEN_COMMAND_ERROR, "No key followed " + theCommand + " command. Not added"); + printListError(WARN_DOXYGEN_COMMAND_ERROR, "Error parsing Doxygen command " + theCommand + ": No key followed the command. Command ignored."); return; } DoxygenEntityList aNewList; @@ -638,7 +637,7 @@ void DoxygenParser::addCommandUnique(const std::string &theCommand, const TokenL cout << "Parsing " << theCommand << endl; std::string name = getNextWord(); if (name.empty()) { - printListError(WARN_DOXYGEN_COMMAND_ERROR, "No name followed " + theCommand + " command. Not added"); + printListError(WARN_DOXYGEN_COMMAND_ERROR, "Error parsing Doxygen command " + theCommand + ": No name followed the command. Command ignored."); return; } std::string text = getNextWord(); @@ -685,7 +684,7 @@ void DoxygenParser::addCommandUnique(const std::string &theCommand, const TokenL cout << "Parsing " << theCommand << endl; std::string file = getNextWord(); if (file.empty()) { - printListError(WARN_DOXYGEN_COMMAND_ERROR, "No file followed " + theCommand + " command. Not added"); + printListError(WARN_DOXYGEN_COMMAND_ERROR, "Error parsing Doxygen command " + theCommand + ": No file followed the command. Command ignored."); return; } std::string caption = getNextWord(); @@ -700,12 +699,12 @@ void DoxygenParser::addCommandUnique(const std::string &theCommand, const TokenL cout << "Parsing " << theCommand << endl; std::string format = getNextWord(); if (format.empty()) { - printListError(WARN_DOXYGEN_COMMAND_ERROR, "No format followed " + theCommand + " command. Not added"); + printListError(WARN_DOXYGEN_COMMAND_ERROR, "Error parsing Doxygen command " + theCommand + ": No format followed the command. Command ignored."); return; } std::string file = getNextWord(); if (file.empty()) { - printListError(WARN_DOXYGEN_COMMAND_ERROR, "No name followed " + theCommand + " command. Not added"); + printListError(WARN_DOXYGEN_COMMAND_ERROR, "Error parsing Doxygen command " + theCommand + ": No name followed the command. Command ignored."); return; } std::string caption = getNextWord(); @@ -726,7 +725,7 @@ void DoxygenParser::addCommandUnique(const std::string &theCommand, const TokenL cout << "Parsing " << theCommand << endl; std::string name = getNextWord(); if (name.empty()) { - printListError(WARN_DOXYGEN_COMMAND_ERROR, "There should be at least one word following the '" + theCommand + "' command. Command ignored."); + printListError(WARN_DOXYGEN_COMMAND_ERROR, "Error parsing Doxygen command " + theCommand + ": There should be at least one word following the command. Command ignored."); return; } DoxygenEntityList aNewList; @@ -749,7 +748,7 @@ void DoxygenParser::addCommandUnique(const std::string &theCommand, const TokenL if (needsCond) { cond = getNextWord(); if (cond.empty()) { - printListError(WARN_DOXYGEN_COMMAND_ERROR, "No word followed " + theCommand + " command. Not added"); + printListError(WARN_DOXYGEN_COMMAND_ERROR, "Error parsing Doxygen command " + theCommand + ": No word followed the command. Command ignored."); return; } } @@ -777,7 +776,7 @@ void DoxygenParser::addCommandUnique(const std::string &theCommand, const TokenL } if (endCommand == tokList.end()) { - printListError(WARN_DOXYGEN_COMMAND_EXPECTED, "No corresponding endif found"); + printListError(WARN_DOXYGEN_COMMAND_EXPECTED, "Expected Doxygen command: endif."); return; } @@ -835,7 +834,7 @@ void DoxygenParser::ignoreCommand(const std::string &theCommand, const TokenList if (!endCommand.empty()) { TokenListCIt itEnd = getEndCommand(endCommand, tokList); if (itEnd == tokList.end()) { - printListError(WARN_DOXYGEN_COMMAND_EXPECTED, "Expected " + endCommand); + printListError(WARN_DOXYGEN_COMMAND_EXPECTED, "Expected Doxygen command: " + endCommand + "."); return; } // If we ignore the command, also ignore any whitespace preceding it as we @@ -979,7 +978,7 @@ DoxygenEntityList DoxygenParser::parse(TokenListCIt endParsingIndex, const Token if (endParsingIndex != tokList.end() && m_tokenListIt == tokList.end()) { // this could happen if we can't reach the original endParsingIndex - printListError(WARN_DOXYGEN_UNEXPECTED_END_OF_COMMENT, "Unexpected end of comment encountered"); + printListError(WARN_DOXYGEN_UNEXPECTED_END_OF_COMMENT, "Unexpected end of Doxygen comment encountered."); break; } } @@ -1052,7 +1051,7 @@ bool DoxygenParser::addDoxyCommand(DoxygenParser::TokenList &tokList, const std: const TokenListCIt itSave = m_tokenListIt; m_tokenListIt = m_tokenList.end(); - printListError(WARN_DOXYGEN_UNKNOWN_COMMAND, "unknown command \"" + cmd + '"'); + printListError(WARN_DOXYGEN_UNKNOWN_COMMAND, "Unknown Doxygen command: " + cmd + "."); m_tokenListIt = itSave; } @@ -1177,13 +1176,13 @@ void DoxygenParser::processHtmlTags(size_t &pos, const std::string &line) { // for example , , ... if (isEndHtmlTag) { m_tokenListIt = m_tokenList.end(); - printListError(WARN_DOXYGEN_COMMAND_ERROR, "Illegal end HTML tag without '>' found! Tag: " + cmd); + printListError(WARN_DOXYGEN_HTML_ERROR, "Doxygen HTML error for tag " + cmd + ": Illegal end HTML tag without '>' found."); } endHtmlPos = line.find(">", pos); if (endHtmlPos == string::npos) { m_tokenListIt = m_tokenList.end(); - printListError(WARN_DOXYGEN_COMMAND_ERROR, "HTML tag without '>' found! Tag: " + cmd); + printListError(WARN_DOXYGEN_HTML_ERROR, "Doxygen HTML error for tag " + cmd + ": HTML tag without '>' found."); } // add args of HTML command, like link URL, image URL, ... m_tokenList.push_back(Token(PLAINSTRING, line.substr(pos, endHtmlPos - pos))); @@ -1268,7 +1267,7 @@ size_t DoxygenParser::processNormalComment(size_t pos, const std::string &line) break; default: m_tokenListIt = m_tokenList.end(); - printListError(WARN_DOXYGEN_COMMAND_ERROR, std::string("Unknown special character: ") + line[pos]); + printListError(WARN_DOXYGEN_UNKNOWN_CHARACTER, std::string("Unknown special character in Doxygen comment: ") + line[pos] + "."); } return pos; @@ -1418,5 +1417,5 @@ void DoxygenParser::printListError(int warningType, const std::string &message) } } - Swig_warning(warningType, m_fileName.c_str(), curLine, "Doxygen parser warning: %s.\n", message.c_str()); + Swig_warning(warningType, m_fileName.c_str(), curLine, "%s\n", message.c_str()); } diff --git a/Source/Include/swigwarn.h b/Source/Include/swigwarn.h index a7f9526e1..9f863f194 100644 --- a/Source/Include/swigwarn.h +++ b/Source/Include/swigwarn.h @@ -214,8 +214,9 @@ #define WARN_DOXYGEN_UNKNOWN_COMMAND 560 #define WARN_DOXYGEN_UNEXPECTED_END_OF_COMMENT 561 #define WARN_DOXYGEN_COMMAND_EXPECTED 562 -#define WARN_DOXYGEN_UNTERMINATED_STRING 563 +#define WARN_DOXYGEN_HTML_ERROR 563 #define WARN_DOXYGEN_COMMAND_ERROR 564 +#define WARN_DOXYGEN_UNKNOWN_CHARACTER 565 /* -- Reserved (600-799) -- */ From 088d7c7773e4395a0246dd90bbc85c7d27d2a7b5 Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Tue, 5 Jun 2018 18:52:30 +0100 Subject: [PATCH 313/314] Add some missing doctype tyemaps --- Lib/python/boost_shared_ptr.i | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Lib/python/boost_shared_ptr.i b/Lib/python/boost_shared_ptr.i index 8aeae5be5..709e7811d 100644 --- a/Lib/python/boost_shared_ptr.i +++ b/Lib/python/boost_shared_ptr.i @@ -399,7 +399,10 @@ %} %typemap(doctype) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >, - SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >& %{TYPE%} + SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > &, + SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *, + SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& + %{TYPE%} %template() SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >; From ac80a0ed265984492918f9ea4c89c87264028498 Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Thu, 7 Jun 2018 07:42:08 +0100 Subject: [PATCH 314/314] Add changes entry for Doxygen support --- CHANGES.current | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGES.current b/CHANGES.current index 2e1934cce..3a3487e15 100644 --- a/CHANGES.current +++ b/CHANGES.current @@ -7,6 +7,11 @@ the issue number to the end of the URL: https://github.com/swig/swig/issues/ Version 4.0.0 (in progress) =========================== +2018-06-07: cmfoil, kabbi, Jamie Kirkpatrick, markok314, vadz, wsfulton, Yann Diorcet + #170 Doxygen documentation support added. This allows translation of Doxygen comments + into JavaDoc and PyDoc documentation. It is enabled via the -doxygen command line + option. See the Doxygen.html chapter in the documentation for further information. + 2018-05-15: kwwette [Octave] add support for version 4.4 - Should not introduce any user-visible incompatibilities