summaryrefslogtreecommitdiffstats
path: root/addon
diff options
context:
space:
mode:
authorJoenio Costa <joenio@joenio.me>2019-08-05 01:22:12 (GMT)
committerJoenio Costa <joenio@joenio.me>2019-08-05 01:22:12 (GMT)
commit69f51747c37bb24b7e296ff01bb7e45a624f6225 (patch)
tree64ae72f5c5689d7285375516967cd89725af1e54 /addon
parent7f0ea786de3153f535ca20280d6b8660ffefd2e6 (diff)
downloadDoxygen-69f51747c37bb24b7e296ff01bb7e45a624f6225.zip
Doxygen-69f51747c37bb24b7e296ff01bb7e45a624f6225.tar.gz
Doxygen-69f51747c37bb24b7e296ff01bb7e45a624f6225.tar.bz2
doxyparse addon new features and bugfixes
this commit is a squashed merge from lots of doxyparse evolution and concentrates contributions from many authors, all listed at the end of this message as Signed-off-by follow a list of all improvements and bugfixes on doxyparse: * workarounding strings replaced by doxygen core * print missing module name for some C code (analizo/analizo#155) * do not count/print 'void' as a function argument * rough instructions for doxyparse release * limit identifiers to 1024 chars (analizo/analizo#135) * removing "\\" from function signatures (analizo/analizo#138) * fix override args references (analizo/analizo#79) * check if new_data in removeDoubleQuotes function is empty (analizo/analizo#120) * removing double quotes from function signature (analizo/analizo#117) * check if ArgumentList is null (analizo/analizo#116) * don't report same module/class more than once (analizo/analizo#112) * add missing key "defines:" to all modules (analizo/analizo#111) * check if string is larger than 1 before removing surrounding quotes (analizo/analizo#110) * doxyparse properly detects package methods * output inheritance as list instead of hash * start yaml document: --- * adding double quoted in module name (analizo/analizo#106) * added --version flag to doxyparse * removing double quotes from function arguments list * fix doxyparse segfault for python source files * using quotes to surround members definition on yaml * add the number of conditionals path * generate configvalues.h * adding .cs (csharp) as non-C file extension * adding .pyw (python) as non-C file extension * adding .py (python) as non-C file extension Signed-off-by: Antonio Terceiro <terceiro@softwarelivre.org> Signed-off-by: Henrique Dutra <hld@henriquedutra.com.br> Signed-off-by: Igor Ribeiro Barbosa Duarte <igor.ribeiro.duarte@gmail.com> Signed-off-by: João M. Miranda <joaomm88@gmail.com> Signed-off-by: Jonathan Moraes <arkyebr@gmail.com> Signed-off-by: Kleber <kleberbritomoreira10@gmail.com> Signed-off-by: leonardork <leodegolim@yahoo.com.br> Signed-off-by: Marcelo Ferreira <marcelohpf@gmail.com> Signed-off-by: Mateus Andrade <mateusandrade080@gmail.com> Signed-off-by: Matheus Miranda <matheusmirandalacerda@gmail.com> Signed-off-by: Paulo Meirelles <paulo@softwarelivre.org> Signed-off-by: Sabryna de Sousa <sabryna.sousa1323@gmail.com> Signed-off-by: Vinicius Daros <vkdaros@mercurio.eclipse.ime.usp.br> Signed-off-by: VinyPinheiro <viny-pinheiro@hotmail.com>
Diffstat (limited to 'addon')
-rw-r--r--addon/doxyparse/README14
-rw-r--r--addon/doxyparse/doxyparse.cpp147
2 files changed, 126 insertions, 35 deletions
diff --git a/addon/doxyparse/README b/addon/doxyparse/README
index 288b31e..95cce8c 100644
--- a/addon/doxyparse/README
+++ b/addon/doxyparse/README
@@ -18,8 +18,20 @@ More info and source code repository: https://github.com/analizo/doxygen
sudo make install
+## release
+
+* ensure analizo testsuite passing on newer doxyparse version
+* update debian/changelog, commit, push
+* create git tag, push to github analizo/doxyparse
+* build on amd64 and i386 archs, upload tar.gz to github
+ * tar -zcf doxyparse_<VERSION>_amd64.tar.gz -C bin/ doxyparse
+ * tar -zcf doxyparse_<VERSION>_i386.tar.gz -C bin/ doxyparse
+* build debian packages for amd64 and i386, update analizo.org repository
+ * (see analizo.github.io/README.md file for updating repository instructions)
+ * upload the deb files to github release tag also
+* check if a alien-doxyparse release is necessary and do it on cpan
+
AUTHORS
-=======
Antonio Terceiro <terceiro@softwarelivre.org>
João M. Miranda <joaomm88@gmail.com>
diff --git a/addon/doxyparse/doxyparse.cpp b/addon/doxyparse/doxyparse.cpp
index 26ecea9..babf3d7 100644
--- a/addon/doxyparse/doxyparse.cpp
+++ b/addon/doxyparse/doxyparse.cpp
@@ -24,6 +24,7 @@
#else
#include <windows.h>
#endif
+#include "version.h"
#include "doxygen.h"
#include "outputgen.h"
#include "parserintf.h"
@@ -40,6 +41,9 @@
#include <sstream>
#include <map>
#include <qdir.h>
+#include <qcstring.h>
+#include <qregexp.h>
+#include "namespacedef.h"
class Doxyparse : public CodeOutputInterface
{
@@ -81,8 +85,6 @@ class Doxyparse : public CodeOutputInterface
};
static bool is_c_code = true;
-static std::map<std::string, bool> modules;
-static std::string current_module;
static void findXRefSymbols(FileDef *fd)
{
@@ -107,7 +109,7 @@ static void findXRefSymbols(FileDef *fd)
static bool ignoreStaticExternalCall(MemberDef *context, MemberDef *md) {
if (md->isStatic()) {
- if(md->getFileDef()) {
+ if(md->getFileDef() && context->getFileDef()) {
if(md->getFileDef()->getOutputFileBase() == context->getFileDef()->getOutputFileBase())
// TODO ignore prefix of file
return false;
@@ -123,27 +125,48 @@ static bool ignoreStaticExternalCall(MemberDef *context, MemberDef *md) {
}
}
+// that undo some replacing by src/util.cpp escapeCharsInString(...)
+// * https://github.com/doxygen/doxygen/pull/577
+std::string unescapeCharsInString(std::string name) {
+ QCString module = QCString(name.c_str());
+ bool replaced = false;
+ if (module.find('.') == -1) {
+ module.replace(QRegExp("_8"), ".");
+ replaced = true;
+ }
+ if (module.find('/') == -1) {
+ module.replace(QRegExp("_2"), "/");
+ replaced = true;
+ }
+ if (replaced) {
+ module.replace(QRegExp("__"), "_");
+ }
+ return module.data();
+}
+
+static void startYamlDocument() {
+ printf("---\n");
+}
static void printFile(std::string file) {
printf("%s:\n", file.c_str());
}
static void printModule(std::string module) {
- current_module = module;
- printf(" %s:\n", module.c_str());
+ printf(" \"%s\":\n", unescapeCharsInString(module).c_str());
}
static void printClassInformation(std::string information) {
printf(" information: %s\n", information.c_str());
}
+static void printInherits() {
+ printf(" inherits:\n");
+}
static void printInheritance(std::string base_class) {
- printf(" inherits: %s\n", base_class.c_str());
+ printf(" - %s\n", base_class.c_str());
}
static void printDefines() {
- if (! modules[current_module]) {
- printf(" defines:\n");
- }
- modules[current_module] = true;
+ printf(" defines:\n");
}
static void printDefinition(std::string type, std::string signature, int line) {
- printf(" - \"%s\":\n", signature.c_str());
+ printf(" - \"%s\":\n", signature.substr(0, 1022).c_str());
printf(" type: %s\n", type.c_str());
printf(" line: %d\n", line);
}
@@ -160,44 +183,47 @@ static void printUses() {
printf(" uses:\n");
}
static void printReferenceTo(std::string type, std::string signature, std::string defined_in) {
- printf(" - \"%s\":\n", signature.c_str());
+ printf(" - \"%s\":\n", signature.substr(0, 1022).c_str());
printf(" type: %s\n", type.c_str());
- printf(" defined_in: %s\n", defined_in.c_str());
+ printf(" defined_in: \"%s\"\n", unescapeCharsInString(defined_in).c_str());
+}
+static void printNumberOfConditionalPaths(MemberDef* md) {
+ printf(" conditional_paths: %d\n", md->numberOfFlowKeyWords());
}
static int isPartOfCStruct(MemberDef * md) {
return is_c_code && md->getClassDef() != NULL;
}
-std::string removeDoubleQuotes(std::string data) {
- // remove surrounding double quotes
- if (data.front() == '"' && data.back() == '"') {
- data.erase(0, 1); // first double quote
- data.erase(data.size() - 1); // last double quote
- }
- return data;
+std::string sanitizeString(std::string data) {
+ QCString new_data = QCString(data.c_str());
+ new_data.replace(QRegExp("\""), "");
+ new_data.replace(QRegExp("\\"), ""); // https://github.com/analizo/analizo/issues/138
+ return !new_data.isEmpty() ? new_data.data() : "";
}
std::string argumentData(Argument *argument) {
std::string data = "";
- if (argument->type != NULL)
- data = removeDoubleQuotes(argument->type.data());
+ if (argument->type != NULL && argument->type.size() > 1)
+ data = sanitizeString(argument->type.data());
else if (argument->name != NULL)
- data = removeDoubleQuotes(argument->name.data());
+ data = sanitizeString(argument->name.data());
return data;
}
std::string functionSignature(MemberDef* md) {
- std::string signature = md->name().data();
+ std::string signature = sanitizeString(md->name().data());
if(md->isFunction()){
ArgumentList *argList = md->argumentList();
- ArgumentListIterator iterator(*argList);
signature += "(";
- Argument * argument = iterator.toFirst();
- if(argument != NULL) {
- signature += argumentData(argument);
- for(++iterator; (argument = iterator.current()); ++iterator){
- signature += std::string(",") + argumentData(argument);
+ if (argList) {
+ ArgumentListIterator iterator(*argList);
+ Argument * argument = iterator.toFirst();
+ if(argument != NULL) {
+ signature += argumentData(argument);
+ for(++iterator; (argument = iterator.current()); ++iterator) {
+ signature += std::string(",") + argumentData(argument);
+ }
}
}
signature += ")";
@@ -221,6 +247,9 @@ static void referenceTo(MemberDef* md) {
else if (md->getFileDef()) {
defined_in = md->getFileDef()->getOutputFileBase().data();
}
+ else if (md->getNamespaceDef()) {
+ defined_in = md->getNamespaceDef()->name().data();
+ }
}
printReferenceTo(type, signature, defined_in);
}
@@ -228,6 +257,12 @@ static void referenceTo(MemberDef* md) {
void cModule(ClassDef* cd) {
MemberList* ml = cd->getMemberList(MemberListType_variableMembers);
if (ml) {
+ FileDef *fd = cd->getFileDef();
+ MemberList *fd_ml = fd->getMemberList(MemberListType_allMembersList);
+ if (!fd_ml || fd_ml->count() == 0) {
+ printModule(fd->getOutputFileBase().data());
+ printDefines();
+ }
MemberListIterator mli(*ml);
MemberDef* md;
for (mli.toFirst(); (md=mli.current()); ++mli) {
@@ -239,18 +274,50 @@ void cModule(ClassDef* cd) {
}
}
+static bool checkOverrideArg(ArgumentList *argList, MemberDef *md) {
+ ArgumentListIterator iterator(*argList);
+ Argument * argument = iterator.toFirst();
+
+ if(!md->isFunction() || argList->count() == 0){
+ return false;
+ }
+
+ if(argument != NULL) {
+ for(; (argument = iterator.current()); ++iterator){
+ if(md->name() == argument->name) {
+ return true;
+ }
+ }
+ }
+
+ return false;
+}
+
void functionInformation(MemberDef* md) {
+ std::string temp = "";
int size = md->getEndBodyLine() - md->getStartBodyLine() + 1;
printNumberOfLines(size);
ArgumentList *argList = md->argumentList();
- printNumberOfArguments(argList->count());
+ if (argList) {
+ ArgumentListIterator iterator(*argList);
+ Argument * argument = iterator.toFirst();
+ if(argument != NULL) {
+ temp = argumentData(argument);
+// TODO: This is a workaround; better not include "void" in argList, in the first place.
+ if(temp != "void") {
+ printNumberOfArguments(argList->count());
+ }
+ }
+ }
+
+ printNumberOfConditionalPaths(md);
MemberSDict *defDict = md->getReferencesMembers();
if (defDict) {
MemberSDict::Iterator msdi(*defDict);
MemberDef *rmd;
printUses();
for (msdi.toFirst(); (rmd=msdi.current()); ++msdi) {
- if (rmd->definitionType() == Definition::TypeMember && !ignoreStaticExternalCall(md, rmd)) {
+ if (rmd->definitionType() == Definition::TypeMember && !ignoreStaticExternalCall(md, rmd) && !checkOverrideArg(argList, rmd)) {
referenceTo(rmd);
}
}
@@ -276,7 +343,6 @@ void listMembers(MemberList *ml) {
if (ml) {
MemberListIterator mli(*ml);
MemberDef *md;
- printDefines();
for (mli.toFirst(); (md=mli.current()); ++mli) {
lookupSymbol((Definition*) md);
}
@@ -299,6 +365,7 @@ static void classInformation(ClassDef* cd) {
printModule(cd->name().data());
BaseClassList* baseClasses = cd->baseClasses();
if (baseClasses) {
+ printInherits();
BaseClassListIterator bci(*baseClasses);
BaseClassDef* bcd;
for (bci.toFirst(); (bcd = bci.current()); ++bci) {
@@ -308,6 +375,7 @@ static void classInformation(ClassDef* cd) {
if(cd->isAbstract()) {
printClassInformation("abstract class");
}
+ printDefines();
listAllMembers(cd);
}
}
@@ -356,6 +424,7 @@ static void listSymbols() {
MemberList *ml = fd->getMemberList(MemberListType_allMembersList);
if (ml && ml->count() > 0) {
printModule(fd->getOutputFileBase().data());
+ printDefines();
listMembers(ml);
}
@@ -364,7 +433,10 @@ static void listSymbols() {
ClassSDict::Iterator cli(*classes);
ClassDef *cd;
for (cli.toFirst(); (cd = cli.current()); ++cli) {
- classInformation(cd);
+ if (!cd->isVisited()) {
+ classInformation(cd);
+ cd->setVisited(TRUE);
+ }
}
}
}
@@ -377,6 +449,11 @@ int main(int argc,char **argv) {
printf("Usage: %s [source_file | source_dir]\n",argv[0]);
exit(1);
}
+ if (qstrcmp(&argv[1][2], "version") == 0) {
+ QCString versionString = getVersion();
+ printf("%s\n", versionString);
+ exit(0);
+ }
// initialize data structures
initDoxygen();
@@ -411,6 +488,7 @@ int main(int argc,char **argv) {
Config_getBool(EXTRACT_STATIC)=TRUE;
Config_getBool(EXTRACT_PRIVATE)=TRUE;
Config_getBool(EXTRACT_LOCAL_METHODS)=TRUE;
+ Config_getBool(EXTRACT_PACKAGE)=TRUE;
// Extract source browse information, needed
// to make doxygen gather the cross reference info
Config_getBool(SOURCE_BROWSER)=TRUE;
@@ -464,6 +542,7 @@ int main(int argc,char **argv) {
// clean up after us
thisDir.rmdir(Config_getString(OUTPUT_DIRECTORY));
+ startYamlDocument();
listSymbols();
std::string cleanup_command = "rm -rf ";