summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDimitri van Heesch <doxygen@gmail.com>2020-05-15 09:28:16 (GMT)
committerDimitri van Heesch <doxygen@gmail.com>2020-05-15 09:34:17 (GMT)
commit10787eed95266bb1a13c892fe4cf5a695dac1559 (patch)
tree3267c7bc4580d4de7ec5797b5658038ad53e3941
parent12843822b09f0aa3f426387986354d9e1303e41e (diff)
downloadDoxygen-10787eed95266bb1a13c892fe4cf5a695dac1559.zip
Doxygen-10787eed95266bb1a13c892fe4cf5a695dac1559.tar.gz
Doxygen-10787eed95266bb1a13c892fe4cf5a695dac1559.tar.bz2
Refactoring
- Makes doxycfg library more self contained - renames _doxygen library to doxymain - Modernizes Debug implementation - Moves Doxygen::runningTime into Debug - Moves full version string to libversion - Removed mentioning of file version in messages (when FILE_VERSION_FILTER is used) - Move substitute functions into QCString
-rw-r--r--addon/doxyapp/CMakeLists.txt2
-rw-r--r--addon/doxyparse/CMakeLists.txt2
-rw-r--r--libversion/CMakeLists.txt1
-rw-r--r--libversion/doxyversion.cpp.in2
-rw-r--r--libversion/fullversion.cpp22
-rw-r--r--libversion/gitversion.cpp.in17
-rw-r--r--libversion/version.h13
-rw-r--r--qtools/qcstring.cpp110
-rw-r--r--qtools/qcstring.h5
-rw-r--r--src/CMakeLists.txt27
-rw-r--r--src/debug.cpp138
-rw-r--r--src/debug.h21
-rw-r--r--src/doxygen.cpp5
-rw-r--r--src/doxygen.h1
-rw-r--r--src/message.cpp17
-rw-r--r--src/message.h13
-rw-r--r--src/util.cpp126
-rw-r--r--src/util.h4
18 files changed, 261 insertions, 265 deletions
diff --git a/addon/doxyapp/CMakeLists.txt b/addon/doxyapp/CMakeLists.txt
index ae52cab..af4590d 100644
--- a/addon/doxyapp/CMakeLists.txt
+++ b/addon/doxyapp/CMakeLists.txt
@@ -18,7 +18,7 @@ if (use_libclang)
endif()
target_link_libraries(doxyapp
-_doxygen
+doxymain
qtools
md5
lodepng
diff --git a/addon/doxyparse/CMakeLists.txt b/addon/doxyparse/CMakeLists.txt
index 2387f1b..d2a8f63 100644
--- a/addon/doxyparse/CMakeLists.txt
+++ b/addon/doxyparse/CMakeLists.txt
@@ -18,7 +18,7 @@ if (use_libclang)
endif()
target_link_libraries(doxyparse
-_doxygen
+doxymain
qtools
md5
lodepng
diff --git a/libversion/CMakeLists.txt b/libversion/CMakeLists.txt
index 6952cea..009c236 100644
--- a/libversion/CMakeLists.txt
+++ b/libversion/CMakeLists.txt
@@ -19,6 +19,7 @@ include_directories(
add_library(doxygen_version STATIC
${POST_CONFIGURE_DOXYGEN_VERSION_FILE}
${POST_CONFIGURE_GIT_VERSION_FILE}
+ fullversion.cpp
)
add_dependencies( doxygen_version check_git_repository )
diff --git a/libversion/doxyversion.cpp.in b/libversion/doxyversion.cpp.in
index 614aa07..fcdac77 100644
--- a/libversion/doxyversion.cpp.in
+++ b/libversion/doxyversion.cpp.in
@@ -1,6 +1,6 @@
#include "version.h"
-char *getDoxygenVersion(void)
+const char *getDoxygenVersion(void)
{
static char versionString[] = "@DOXYGEN_VERSION@";
return versionString;
diff --git a/libversion/fullversion.cpp b/libversion/fullversion.cpp
new file mode 100644
index 0000000..dfc2b0d
--- /dev/null
+++ b/libversion/fullversion.cpp
@@ -0,0 +1,22 @@
+#include <string.h>
+#include <version.h>
+
+const char *getFullVersion(void)
+{
+#define BUF_SIZE 100
+ static char fullVersionString[BUF_SIZE];
+ static bool init = false;
+ if (!init)
+ {
+ strlcpy(fullVersionString,getDoxygenVersion(),BUF_SIZE);
+ if (strlen(getGitVersion())>0)
+ {
+ strlcat(fullVersionString," (",BUF_SIZE);
+ strlcat(fullVersionString,getGitVersion(),BUF_SIZE);
+ strlcat(fullVersionString,")",BUF_SIZE);
+ }
+ fullVersionString[BUF_SIZE-1]='\0';
+ init = true;
+ }
+ return fullVersionString;
+}
diff --git a/libversion/gitversion.cpp.in b/libversion/gitversion.cpp.in
index 164b50b..50ce1d2 100644
--- a/libversion/gitversion.cpp.in
+++ b/libversion/gitversion.cpp.in
@@ -6,11 +6,18 @@
* - No git information is present (no .git directory)
* in those cases clear the gitVersionString (would have string GIT-NOTFOUND).
*/
-char *getGitVersion(void)
+const char *getGitVersion(void)
{
- static char gitVersionString[100];
- strcpy(gitVersionString,"@GIT_HEAD_SHA1@");
- strcat(gitVersionString,!strcmp("@GIT_IS_DIRTY@","true")?"*":"");
- if (!strcmp("@GIT_HEAD_SHA1@", "GIT-NOTFOUND")) gitVersionString[0] = '\0';
+#define BUF_SIZE 100
+ static char gitVersionString[BUF_SIZE];
+ static bool init = false;
+ if (!init)
+ {
+ strncpy(gitVersionString,"@GIT_HEAD_SHA1@",BUF_SIZE);
+ strncat(gitVersionString,!strcmp("@GIT_IS_DIRTY@","true")?"*":"",BUF_SIZE);
+ if (!strcmp("@GIT_HEAD_SHA1@", "GIT-NOTFOUND")) gitVersionString[0] = '\0';
+ gitVersionString[BUF_SIZE-1]='\0';
+ init = true;
+ }
return gitVersionString;
}
diff --git a/libversion/version.h b/libversion/version.h
index 22a054d..212e8d4 100644
--- a/libversion/version.h
+++ b/libversion/version.h
@@ -1,12 +1,10 @@
/******************************************************************************
*
- *
- *
- * Copyright (C) 1997-2015 by Dimitri van Heesch.
+ * Copyright (C) 1997-2020 by Dimitri van Heesch.
*
* Permission to use, copy, modify, and distribute this software and its
- * documentation under the terms of the GNU General Public License is hereby
- * granted. No representations are made about the suitability of this software
+ * documentation under the terms of the GNU General Public License is hereby
+ * granted. No representations are made about the suitability of this software
* for any purpose. It is provided "as is" without express or implied warranty.
* See the GNU General Public License for more details.
*
@@ -17,6 +15,7 @@
#ifndef VERSION_H
#define VERSION_H
-char *getDoxygenVersion(void);
-char *getGitVersion(void);
+const char *getDoxygenVersion(void);
+const char *getGitVersion(void);
+const char *getFullVersion(void);
#endif
diff --git a/qtools/qcstring.cpp b/qtools/qcstring.cpp
index 64417e3..8d442d7 100644
--- a/qtools/qcstring.cpp
+++ b/qtools/qcstring.cpp
@@ -840,3 +840,113 @@ inline QCString operator+( const QGString &s1, const QCString &s2 )
return tmp;
}
+/// substitute all occurrences of \a src in \a s by \a dst
+QCString substitute(const QCString &s,const QCString &src,const QCString &dst)
+{
+ if (s.isEmpty() || src.isEmpty()) return s;
+ const char *p, *q;
+ int srcLen = src.length();
+ int dstLen = dst.length();
+ int resLen;
+ if (srcLen!=dstLen)
+ {
+ int count;
+ for (count=0, p=s.data(); (q=strstr(p,src))!=0; p=q+srcLen) count++;
+ resLen = s.length()+count*(dstLen-srcLen);
+ }
+ else // result has same size as s
+ {
+ resLen = s.length();
+ }
+ QCString result(resLen+1);
+ char *r;
+ for (r=result.rawData(), p=s; (q=strstr(p,src))!=0; p=q+srcLen)
+ {
+ int l = (int)(q-p);
+ memcpy(r,p,l);
+ r+=l;
+
+ if (dst) memcpy(r,dst,dstLen);
+ r+=dstLen;
+ }
+ qstrcpy(r,p);
+ //printf("substitute(%s,%s,%s)->%s\n",s,src,dst,result.data());
+ return result;
+}
+
+
+/// substitute all occurrences of \a src in \a s by \a dst, but skip
+/// each consecutive sequence of \a src where the number consecutive
+/// \a src matches \a skip_seq; if \a skip_seq is negative, skip any
+/// number of consecutive \a src
+QCString substitute(const QCString &s,const QCString &src,const QCString &dst,int skip_seq)
+{
+ if (s.isEmpty() || src.isEmpty()) return s;
+ const char *p, *q;
+ int srcLen = src.length();
+ int dstLen = dst.length();
+ int resLen;
+ if (srcLen!=dstLen)
+ {
+ int count;
+ for (count=0, p=s.data(); (q=strstr(p,src))!=0; p=q+srcLen) count++;
+ resLen = s.length()+count*(dstLen-srcLen);
+ }
+ else // result has same size as s
+ {
+ resLen = s.length();
+ }
+ QCString result(resLen+1);
+ char *r;
+ for (r=result.rawData(), p=s; (q=strstr(p,src))!=0; p=q+srcLen)
+ {
+ // search a consecutive sequence of src
+ int seq = 0, skip = 0;
+ if (skip_seq)
+ {
+ for (const char *n=q+srcLen; qstrncmp(n,src,srcLen)==0; seq=1+skip, n+=srcLen)
+ ++skip; // number of consecutive src after the current one
+
+ // verify the allowed number of consecutive src to skip
+ if (skip_seq > 0 && skip_seq != seq)
+ seq = skip = 0;
+ }
+
+ // skip a consecutive sequence of src when necessary
+ int l = (int)((q + seq * srcLen)-p);
+ memcpy(r,p,l);
+ r+=l;
+
+ if (skip)
+ {
+ // skip only the consecutive src found after the current one
+ q += skip * srcLen;
+ // the next loop will skip the current src, aka (p=q+srcLen)
+ continue;
+ }
+
+ if (dst) memcpy(r,dst,dstLen);
+ r+=dstLen;
+ }
+ qstrcpy(r,p);
+ result.resize((int)strlen(result.data())+1);
+ //printf("substitute(%s,%s,%s)->%s\n",s,src,dst,result.data());
+ return result;
+}
+
+/// substitute all occurrences of \a srcChar in \a s by \a dstChar
+QCString substitute(const QCString &s,char srcChar,char dstChar)
+{
+ int l=s.length();
+ QCString result(l+1);
+ char *q=result.rawData();
+ if (l>0)
+ {
+ const char *p=s.data();
+ char c;
+ while ((c=*p++)) *q++ = (c==srcChar) ? dstChar : c;
+ }
+ *q='\0';
+ return result;
+}
+
diff --git a/qtools/qcstring.h b/qtools/qcstring.h
index ec57f17..b126194 100644
--- a/qtools/qcstring.h
+++ b/qtools/qcstring.h
@@ -812,4 +812,9 @@ inline std::string toStdString(const QCString &s)
if (!s.isEmpty()) return std::string(s.data()); else return std::string();
}
+// helper functions
+QCString substitute(const QCString &s,const QCString &src,const QCString &dst);
+QCString substitute(const QCString &s,const QCString &src,const QCString &dst,int skip_seq);
+QCString substitute(const QCString &s,char srcChar,char dstChar);
+
#endif // QCSTRING_H
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 780352a..154abb0 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -142,18 +142,22 @@ add_library(doxycfg STATIC
${GENERATED_SRC}/configimpl.l.h
${GENERATED_SRC}/configoptions.cpp
${GENERATED_SRC}/configvalues.cpp
+ ${GENERATED_SRC}/settings.h
portable.cpp
portable_c.c
+ ftextstream.cpp
+ message.cpp
+ debug.cpp
)
-add_library(_doxygen STATIC
+add_library(doxymain STATIC
# generated for/by flex/bison
#${LEX_FILES_H} #unfortunately doesn't work in older versions of CMake (like 3.6.2)
#${LEX_FILES_CPP} #unfortunately doesn't work in older versions of CMake (like 3.6.2)
${GENERATED_SRC}/code.l.h
${GENERATED_SRC}/commentcnv.l.h
${GENERATED_SRC}/commentscan.l.h
- ${GENERATED_SRC}/configimpl.l.h
+ ${GENERATED_SRC}/constexp.cpp
${GENERATED_SRC}/constexp.l.h
${GENERATED_SRC}/declinfo.l.h
${GENERATED_SRC}/defargs.l.h
@@ -170,8 +174,6 @@ add_library(_doxygen STATIC
${GENERATED_SRC}/code.cpp
${GENERATED_SRC}/commentcnv.cpp
${GENERATED_SRC}/commentscan.cpp
- ${GENERATED_SRC}/configimpl.cpp
- ${GENERATED_SRC}/constexp.cpp
${GENERATED_SRC}/declinfo.cpp
${GENERATED_SRC}/defargs.cpp
${GENERATED_SRC}/doctokenizer.cpp
@@ -188,10 +190,8 @@ add_library(_doxygen STATIC
${GENERATED_SRC}/ce_parse.cpp
# custom generated files
${GENERATED_SRC}/lang_cfg.h
- ${GENERATED_SRC}/settings.h
${GENERATED_SRC}/layout_default.xml.h
${GENERATED_SRC}/ce_parse.h
- ${GENERATED_SRC}/configvalues.h
${GENERATED_SRC}/resources.cpp
#
arguments.cpp
@@ -203,7 +203,6 @@ add_library(_doxygen STATIC
condparser.cpp
context.cpp
cppvalue.cpp
- debug.cpp
defgen.cpp
define.cpp
definition.cpp
@@ -234,7 +233,6 @@ add_library(_doxygen STATIC
filedef.cpp
fileparser.cpp
formula.cpp
- ftextstream.cpp
ftvhelp.cpp
groupdef.cpp
htags.cpp
@@ -254,7 +252,6 @@ add_library(_doxygen STATIC
memberdef.cpp
membergroup.cpp
memberlist.cpp
- message.cpp
msc.cpp
namespacedef.cpp
outputgen.cpp
@@ -291,7 +288,7 @@ set_source_files_properties(clangparser.cpp PROPERTIES COMPILE_FLAGS "-Wno-shado
endif()
##foreach(lex_file ${LEX_FILES})
-##add_library(_doxygen STATIC ${GENERATED_SRC}/${lex_file}.l.h)
+##add_library(doxymain STATIC ${GENERATED_SRC}/${lex_file}.l.h)
##endforeach()
add_executable(doxygen main.cpp)
@@ -302,12 +299,12 @@ if (use_libclang)
find_package(Clang REQUIRED CONFIG)
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
cmake_minimum_required(VERSION 3.1)
- target_compile_features(_doxygen PRIVATE cxx_alignof)
+ target_compile_features(doxymain PRIVATE cxx_alignof)
target_compile_features(doxygen PRIVATE cxx_alignof)
- target_compile_options(_doxygen PRIVATE -stdlib=libc++)
+ target_compile_options(doxymain PRIVATE -stdlib=libc++)
target_compile_options(doxygen PRIVATE -stdlib=libc++)
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
- target_compile_options(_doxygen PRIVATE -std=c++11)
+ target_compile_options(doxymain PRIVATE -std=c++11)
target_compile_options(doxygen PRIVATE -std=c++11)
endif()
include_directories(${LLVM_INCLUDE_DIRS})
@@ -318,8 +315,8 @@ if (use_libclang)
endif()
target_link_libraries(doxygen
- _doxygen
doxycfg
+ doxymain
qtools
md5
lodepng
@@ -335,7 +332,7 @@ target_link_libraries(doxygen
)
set_project_warnings(doxycfg)
-set_project_warnings(_doxygen)
+set_project_warnings(doxymain)
set_project_warnings(doxygen)
install(TARGETS doxygen DESTINATION bin)
diff --git a/src/debug.cpp b/src/debug.cpp
index 4c7afb3..ca3c1e9 100644
--- a/src/debug.cpp
+++ b/src/debug.cpp
@@ -1,12 +1,10 @@
/******************************************************************************
*
- *
- *
- * Copyright (C) 1997-2015 by Dimitri van Heesch.
+ * Copyright (C) 1997-2020 by Dimitri van Heesch.
*
* Permission to use, copy, modify, and distribute this software and its
- * documentation under the terms of the GNU General Public License is hereby
- * granted. No representations are made about the suitability of this software
+ * documentation under the terms of the GNU General Public License is hereby
+ * granted. No representations are made about the suitability of this software
* for any purpose. It is provided "as is" without express or implied warranty.
* See the GNU General Public License for more details.
*
@@ -16,68 +14,37 @@
*/
#include <stdarg.h>
+#include <algorithm>
#include <stdio.h>
-
-#include <qdict.h>
+#include <map>
+#include <string>
+#include <chrono>
#include "debug.h"
#include "message.h"
//------------------------------------------------------------------------
-/** Helper struct representing a mapping from debug label to a debug ID */
-struct LabelMap
-{
- const char *name;
- Debug::DebugMask event;
-};
-
-static LabelMap s_labels[] =
+static std::map< std::string, Debug::DebugMask > s_labels =
{
- { "findmembers", Debug::FindMembers },
- { "functions", Debug::Functions },
- { "variables", Debug::Variables },
- { "preprocessor", Debug::Preprocessor },
- { "classes", Debug::Classes },
- { "commentcnv", Debug::CommentCnv },
- { "commentscan", Debug::CommentScan },
- { "validate", Debug::Validate },
- { "printtree", Debug::PrintTree },
- { "time", Debug::Time },
- { "extcmd", Debug::ExtCmd },
- { "markdown", Debug::Markdown },
- { "filteroutput", Debug::FilterOutput },
- { "lex", Debug::Lex },
- { "plantuml", Debug::Plantuml },
- { "fortranfixed2free", Debug::FortranFixed2Free },
- { 0, (Debug::DebugMask)0 }
-};
-
-/** Class representing a mapping from debug labels to debug IDs. */
-class LabelMapper
-{
- public:
- LabelMapper() : m_map(17)
- {
- m_map.setAutoDelete(TRUE);
- LabelMap *p = s_labels;
- while (p->name)
- {
- m_map.insert(p->name,new Debug::DebugMask(p->event));
- p++;
- }
- }
- Debug::DebugMask *find(const char *s) const
- {
- if (s==0) return 0;
- return m_map.find(s);
- }
- private:
- QDict<Debug::DebugMask> m_map;
+ { "findmembers", Debug::FindMembers },
+ { "functions", Debug::Functions },
+ { "variables", Debug::Variables },
+ { "preprocessor", Debug::Preprocessor },
+ { "classes", Debug::Classes },
+ { "commentcnv", Debug::CommentCnv },
+ { "commentscan", Debug::CommentScan },
+ { "validate", Debug::Validate },
+ { "printtree", Debug::PrintTree },
+ { "time", Debug::Time },
+ { "extcmd", Debug::ExtCmd },
+ { "markdown", Debug::Markdown },
+ { "filteroutput", Debug::FilterOutput },
+ { "lex", Debug::Lex },
+ { "plantuml", Debug::Plantuml },
+ { "fortranfixed2free", Debug::FortranFixed2Free }
};
-static LabelMapper g_labelMapper;
-
//------------------------------------------------------------------------
Debug::DebugMask Debug::curMask = Debug::Quiet;
@@ -94,17 +61,24 @@ void Debug::print(DebugMask mask,int prio,const char *fmt,...)
}
}
+static char asciiToLower(char in) {
+ if (in <= 'Z' && in >= 'A')
+ return in - ('Z' - 'z');
+ return in;
+}
+
static int labelToEnumValue(const char *l)
{
- QCString label=l;
- Debug::DebugMask *event = g_labelMapper.find(label.lower());
- if (event) return *event; else return 0;
+ std::string s = l;
+ std::transform(s.begin(),s.end(),s.begin(),asciiToLower);
+ auto it = s_labels.find(s);
+ return (it!=s_labels.end()) ? it->second : 0;
}
int Debug::setFlag(const char *lab)
{
int retVal = labelToEnumValue(lab);
- curMask = (DebugMask)(curMask | labelToEnumValue(lab));
+ curMask = (DebugMask)(curMask | labelToEnumValue(lab));
return retVal;
}
@@ -123,14 +97,42 @@ bool Debug::isFlagSet(DebugMask mask)
return (curMask & mask)!=0;
}
-void Debug::printFlags(void)
+void Debug::printFlags()
{
- int i;
- for (i = 0; i < (int)(sizeof(s_labels)/sizeof(*s_labels)); i++)
+ for (const auto &v : s_labels)
{
- if (s_labels[i].name)
- {
- msg("\t%s\n",s_labels[i].name);
- }
+ msg("\t%s\n",v.first.c_str());
}
}
+
+//------------------------------------------------------------------------
+
+class Timer
+{
+ public:
+ void start()
+ {
+ m_startTime = std::chrono::system_clock::now();
+ }
+ int elapsedTimeMs()
+ {
+ return std::chrono::duration_cast<
+ std::chrono::milliseconds>(
+ std::chrono::system_clock::now() - m_startTime).count();
+ }
+ private:
+ std::chrono::time_point<std::chrono::system_clock> m_startTime;
+};
+
+static Timer g_runningTime;
+
+void Debug::startTimer()
+{
+ g_runningTime.start();
+}
+
+int Debug::elapsedTime()
+{
+ return g_runningTime.elapsedTimeMs();
+}
+
diff --git a/src/debug.h b/src/debug.h
index 79bc3d8..0c046f4 100644
--- a/src/debug.h
+++ b/src/debug.h
@@ -1,13 +1,10 @@
/******************************************************************************
*
- *
- *
- *
- * Copyright (C) 1997-2015 by Dimitri van Heesch.
+ * Copyright (C) 1997-2020 by Dimitri van Heesch.
*
* Permission to use, copy, modify, and distribute this software and its
- * documentation under the terms of the GNU General Public License is hereby
- * granted. No representations are made about the suitability of this software
+ * documentation under the terms of the GNU General Public License is hereby
+ * granted. No representations are made about the suitability of this software
* for any purpose. It is provided "as is" without express or implied warranty.
* See the GNU General Public License for more details.
*
@@ -24,8 +21,8 @@ class Debug
{
public:
enum DebugMask { Quiet = 0x00000000,
- FindMembers = 0x00000001,
- Functions = 0x00000002,
+ FindMembers = 0x00000001,
+ Functions = 0x00000002,
Variables = 0x00000004,
Preprocessor = 0x00000008,
Classes = 0x00000010,
@@ -42,12 +39,16 @@ class Debug
FortranFixed2Free = 0x00008000
};
static void print(DebugMask mask,int prio,const char *fmt,...);
+
static int setFlag(const char *label);
static void clearFlag(const char *label);
static bool isFlagSet(DebugMask mask);
- static void printFlags(void);
+ static void printFlags();
static void setPriority(int p);
-
+
+ static void startTimer();
+ static int elapsedTime();
+
private:
static DebugMask curMask;
static int curPrio;
diff --git a/src/doxygen.cpp b/src/doxygen.cpp
index 6c4a19c..0b868a8 100644
--- a/src/doxygen.cpp
+++ b/src/doxygen.cpp
@@ -142,7 +142,6 @@ PageDef *Doxygen::mainPage = 0;
bool Doxygen::insideMainPage = FALSE; // are we generating docs for the main page?
NamespaceDef *Doxygen::globalScope = 0;
bool Doxygen::parseSourcesNeeded = FALSE;
-QTime Doxygen::runningTime;
SearchIndexIntf *Doxygen::searchIndex=0;
QDict<DefinitionIntf> *Doxygen::symbolMap = 0;
QDict<Definition> *Doxygen::clangUsrMap = 0;
@@ -9662,7 +9661,7 @@ void initDoxygen()
Portable::correct_path();
- Doxygen::runningTime.start();
+ Debug::startTimer();
Doxygen::preprocessor = new Preprocessor();
Doxygen::parserManager = new ParserManager( std::make_unique<NullOutlineParser>(),
@@ -11524,7 +11523,7 @@ void generateOutput()
if (Debug::isFlagSet(Debug::Time))
{
msg("Total elapsed time: %.3f seconds\n(of which %.3f seconds waiting for external tools to finish)\n",
- ((double)Doxygen::runningTime.elapsed())/1000.0,
+ ((double)Debug::elapsedTime())/1000.0,
Portable::getSysElapsedTime()
);
g_s.print();
diff --git a/src/doxygen.h b/src/doxygen.h
index 3335974..d8cd1fc 100644
--- a/src/doxygen.h
+++ b/src/doxygen.h
@@ -118,7 +118,6 @@ class Doxygen
static NamespaceDef *globalScope;
static QCString htmlFileExtension;
static bool parseSourcesNeeded;
- static QTime runningTime;
static SearchIndexIntf *searchIndex;
static QDict<DefinitionIntf> *symbolMap;
static QDict<Definition> *clangUsrMap;
diff --git a/src/message.cpp b/src/message.cpp
index 4e07d56..a787357 100644
--- a/src/message.cpp
+++ b/src/message.cpp
@@ -1,6 +1,6 @@
/******************************************************************************
*
- * Copyright (C) 1997-2015 by Dimitri van Heesch.
+ * Copyright (C) 1997-2020 by Dimitri van Heesch.
*
* Permission to use, copy, modify, and distribute this software and its
* documentation under the terms of the GNU General Public License is hereby
@@ -14,13 +14,9 @@
*/
#include <stdio.h>
-#include <qdatetime.h>
#include "config.h"
-#include "util.h"
#include "debug.h"
-#include "doxygen.h"
#include "portable.h"
-#include "filedef.h"
#include "message.h"
static QCString outputFormat;
@@ -110,7 +106,7 @@ void msg(const char *fmt, ...)
{
if (Debug::isFlagSet(Debug::Time))
{
- printf("%.3f sec: ",((double)Doxygen::runningTime.elapsed())/1000.0);
+ printf("%.3f sec: ",((double)Debug::elapsedTime())/1000.0);
}
va_list args;
va_start(args, fmt);
@@ -125,15 +121,6 @@ static void format_warn(const char *file,int line,const char *text)
QCString lineSubst; lineSubst.setNum(line);
QCString textSubst = text;
QCString versionSubst;
- if (file) // get version from file name
- {
- bool ambig;
- FileDef *fd=findFileDef(Doxygen::inputNameLinkedMap,file,ambig);
- if (fd)
- {
- versionSubst = fd->getVersion();
- }
- }
// substitute markers by actual values
bool warnAsError = Config_getBool(WARN_AS_ERROR);
QCString msgText =
diff --git a/src/message.h b/src/message.h
index 5f8c9db..e84344b 100644
--- a/src/message.h
+++ b/src/message.h
@@ -1,12 +1,10 @@
/******************************************************************************
*
- *
- *
- * Copyright (C) 1997-2015 by Dimitri van Heesch.
+ * Copyright (C) 1997-2020 by Dimitri van Heesch.
*
* Permission to use, copy, modify, and distribute this software and its
- * documentation under the terms of the GNU General Public License is hereby
- * granted. No representations are made about the suitability of this software
+ * documentation under the terms of the GNU General Public License is hereby
+ * granted. No representations are made about the suitability of this software
* for any purpose. It is provided "as is" without express or implied warranty.
* See the GNU General Public License for more details.
*
@@ -18,12 +16,11 @@
#ifndef MESSAGE_H
#define MESSAGE_H
-#include <stdio.h>
-#include <stdarg.h>
+#include <cstdarg>
#ifdef __GNUC__
#define PRINTFLIKE(FORMAT, PARAM ) __attribute__((format(printf, FORMAT, PARAM)))
-#else
+#else
#define PRINTFLIKE(FORMAT, PARAM )
#endif
diff --git a/src/util.cpp b/src/util.cpp
index 2b82afb..a595b06 100644
--- a/src/util.cpp
+++ b/src/util.cpp
@@ -4600,118 +4600,6 @@ QCString showFileDefMatches(const FileNameLinkedMap *fnMap,const char *n)
//----------------------------------------------------------------------
-/// substitute all occurrences of \a src in \a s by \a dst
-QCString substitute(const QCString &s,const QCString &src,const QCString &dst)
-{
- if (s.isEmpty() || src.isEmpty()) return s;
- const char *p, *q;
- int srcLen = src.length();
- int dstLen = dst.length();
- int resLen;
- if (srcLen!=dstLen)
- {
- int count;
- for (count=0, p=s.data(); (q=strstr(p,src))!=0; p=q+srcLen) count++;
- resLen = s.length()+count*(dstLen-srcLen);
- }
- else // result has same size as s
- {
- resLen = s.length();
- }
- QCString result(resLen+1);
- char *r;
- for (r=result.rawData(), p=s; (q=strstr(p,src))!=0; p=q+srcLen)
- {
- int l = (int)(q-p);
- memcpy(r,p,l);
- r+=l;
-
- if (dst) memcpy(r,dst,dstLen);
- r+=dstLen;
- }
- qstrcpy(r,p);
- //printf("substitute(%s,%s,%s)->%s\n",s,src,dst,result.data());
- return result;
-}
-
-
-/// substitute all occurrences of \a src in \a s by \a dst, but skip
-/// each consecutive sequence of \a src where the number consecutive
-/// \a src matches \a skip_seq; if \a skip_seq is negative, skip any
-/// number of consecutive \a src
-QCString substitute(const QCString &s,const QCString &src,const QCString &dst,int skip_seq)
-{
- if (s.isEmpty() || src.isEmpty()) return s;
- const char *p, *q;
- int srcLen = src.length();
- int dstLen = dst.length();
- int resLen;
- if (srcLen!=dstLen)
- {
- int count;
- for (count=0, p=s.data(); (q=strstr(p,src))!=0; p=q+srcLen) count++;
- resLen = s.length()+count*(dstLen-srcLen);
- }
- else // result has same size as s
- {
- resLen = s.length();
- }
- QCString result(resLen+1);
- char *r;
- for (r=result.rawData(), p=s; (q=strstr(p,src))!=0; p=q+srcLen)
- {
- // search a consecutive sequence of src
- int seq = 0, skip = 0;
- if (skip_seq)
- {
- for (const char *n=q+srcLen; qstrncmp(n,src,srcLen)==0; seq=1+skip, n+=srcLen)
- ++skip; // number of consecutive src after the current one
-
- // verify the allowed number of consecutive src to skip
- if (skip_seq > 0 && skip_seq != seq)
- seq = skip = 0;
- }
-
- // skip a consecutive sequence of src when necessary
- int l = (int)((q + seq * srcLen)-p);
- memcpy(r,p,l);
- r+=l;
-
- if (skip)
- {
- // skip only the consecutive src found after the current one
- q += skip * srcLen;
- // the next loop will skip the current src, aka (p=q+srcLen)
- continue;
- }
-
- if (dst) memcpy(r,dst,dstLen);
- r+=dstLen;
- }
- qstrcpy(r,p);
- result.resize((int)strlen(result.data())+1);
- //printf("substitute(%s,%s,%s)->%s\n",s,src,dst,result.data());
- return result;
-}
-
-/// substitute all occurrences of \a srcChar in \a s by \a dstChar
-QCString substitute(const QCString &s,char srcChar,char dstChar)
-{
- int l=s.length();
- QCString result(l+1);
- char *q=result.rawData();
- if (l>0)
- {
- const char *p=s.data();
- char c;
- while ((c=*p++)) *q++ = (c==srcChar) ? dstChar : c;
- }
- *q='\0';
- return result;
-}
-
-//----------------------------------------------------------------------
-
QCString substituteKeywords(const QCString &s,const char *title,
const char *projName,const char *projNum,const char *projBrief)
{
@@ -8521,20 +8409,6 @@ void writeLatexSpecialFormulaChars(FTextStream &t)
"\n";
}
-QCString getFullVersion()
-{
- QCString versionString;
- if (strlen(getGitVersion())>0)
- {
- versionString = QCString(getDoxygenVersion())+" ("+getGitVersion()+")";
- }
- else
- {
- versionString = getDoxygenVersion();
- }
- return versionString;
-}
-
//------------------------------------------------------
static int g_usedTableLevels = 0;
diff --git a/src/util.h b/src/util.h
index f8befa2..e49a807 100644
--- a/src/util.h
+++ b/src/util.h
@@ -195,9 +195,6 @@ void mergeArguments(ArgumentList &,ArgumentList &,bool forceNameOverwrite=FALSE)
QCString substituteClassNames(const QCString &s);
-QCString substitute(const QCString &s,const QCString &src,const QCString &dst);
-QCString substitute(const QCString &s,const QCString &src,const QCString &dst,int skip_seq);
-QCString substitute(const QCString &s,char srcChar,char dstChar);
QCString clearBlock(const char *s,const char *begin,const char *end);
@@ -502,5 +499,4 @@ int usedTableLevels();
void incUsedTableLevels();
void decUsedTableLevels();
-QCString getFullVersion();
#endif