summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--addon/doxyparse/doxyparse.cpp25
-rw-r--r--src/code.l8
-rw-r--r--src/fortrancode.l4
-rw-r--r--src/memberdef.cpp18
-rw-r--r--src/memberdef.h8
-rw-r--r--src/pycode.l8
-rw-r--r--src/util.cpp70
-rw-r--r--src/util.h1
8 files changed, 105 insertions, 37 deletions
diff --git a/addon/doxyparse/doxyparse.cpp b/addon/doxyparse/doxyparse.cpp
index babf3d7..2f6e32d 100644
--- a/addon/doxyparse/doxyparse.cpp
+++ b/addon/doxyparse/doxyparse.cpp
@@ -125,25 +125,6 @@ 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");
}
@@ -151,7 +132,7 @@ static void printFile(std::string file) {
printf("%s:\n", file.c_str());
}
static void printModule(std::string module) {
- printf(" \"%s\":\n", unescapeCharsInString(module).c_str());
+ printf(" \"%s\":\n", unescapeCharsInString(module.c_str()).data());
}
static void printClassInformation(std::string information) {
printf(" information: %s\n", information.c_str());
@@ -185,7 +166,7 @@ static void printUses() {
static void printReferenceTo(std::string type, std::string signature, std::string defined_in) {
printf(" - \"%s\":\n", signature.substr(0, 1022).c_str());
printf(" type: %s\n", type.c_str());
- printf(" defined_in: \"%s\"\n", unescapeCharsInString(defined_in).c_str());
+ printf(" defined_in: \"%s\"\n", unescapeCharsInString(defined_in.c_str()).data());
}
static void printNumberOfConditionalPaths(MemberDef* md) {
printf(" conditional_paths: %d\n", md->numberOfFlowKeyWords());
@@ -451,7 +432,7 @@ int main(int argc,char **argv) {
}
if (qstrcmp(&argv[1][2], "version") == 0) {
QCString versionString = getVersion();
- printf("%s\n", versionString);
+ printf("%s\n", versionString.data());
exit(0);
}
diff --git a/src/code.l b/src/code.l
index 45429c3..b932a43 100644
--- a/src/code.l
+++ b/src/code.l
@@ -2474,7 +2474,7 @@ RAWEND ")"[^ \t\(\)\\]{0,16}\"
<Body>{FLOWCONDITION}/{BN}*"(" {
if (g_currentMemberDef && g_currentMemberDef->isFunction())
{
- g_currentMemberDef->addFlowKeyWord();
+ g_currentMemberDef->incrementFlowKeyWordCount();
}
startFontClass("keywordflow");
codifyLines(yytext);
@@ -2495,7 +2495,7 @@ RAWEND ")"[^ \t\(\)\\]{0,16}\"
<Body>{FLOWCONDITION}/([^a-z_A-Z0-9]) {
if (g_currentMemberDef && g_currentMemberDef->isFunction())
{
- g_currentMemberDef->addFlowKeyWord();
+ g_currentMemberDef->incrementFlowKeyWordCount();
}
startFontClass("keywordflow");
codifyLines(yytext);
@@ -2513,7 +2513,7 @@ RAWEND ")"[^ \t\(\)\\]{0,16}\"
<Body>{FLOWCONDITION}/{B}* {
if (g_currentMemberDef && g_currentMemberDef->isFunction())
{
- g_currentMemberDef->addFlowKeyWord();
+ g_currentMemberDef->incrementFlowKeyWordCount();
}
startFontClass("keywordflow");
codifyLines(yytext);
@@ -3052,7 +3052,7 @@ RAWEND ")"[^ \t\(\)\\]{0,16}\"
<MemberCall2,FuncCall>{FLOWCONDITION}/([^a-z_A-Z0-9]) {
if (g_currentMemberDef && g_currentMemberDef->isFunction())
{
- g_currentMemberDef->addFlowKeyWord();
+ g_currentMemberDef->incrementFlowKeyWordCount();
}
addParmType();
g_parmName=yytext;
diff --git a/src/fortrancode.l b/src/fortrancode.l
index 0712afd..3e443b5 100644
--- a/src/fortrancode.l
+++ b/src/fortrancode.l
@@ -750,6 +750,10 @@ LANGUAGE_BIND_SPEC BIND{BS}"("{BS}C{BS}(,{BS}NAME{BS}"="{BS}"\""(.*)"\""{BS})?")
{
if ((yy_my_start == 1) && ((yytext[0] == 'c') || (yytext[0] == 'C'))) YY_FTN_REJECT;
}
+ if (g_currentMemberDef && g_currentMemberDef->isFunction())
+ {
+ g_currentMemberDef->incrementFlowKeyWordCount();
+ }
/* font class is defined e.g. in doxygen.css */
startFontClass("keywordflow");
codifyLines(yytext);
diff --git a/src/memberdef.cpp b/src/memberdef.cpp
index d0b70bb..9d6ac51 100644
--- a/src/memberdef.cpp
+++ b/src/memberdef.cpp
@@ -174,6 +174,7 @@ class MemberDefImpl : public DefinitionImpl, public MemberDef
virtual bool livesInsideEnum() const;
virtual bool isSliceLocal() const;
virtual bool isConstExpr() const;
+ virtual int numberOfFlowKeyWords() const;
virtual bool isFriendToHide() const;
virtual bool isNotFriend() const;
virtual bool isFunctionOrSignalSlot() const;
@@ -308,6 +309,7 @@ class MemberDefImpl : public DefinitionImpl, public MemberDef
virtual void setBriefDescription(const char *b,const char *briefFile,int briefLine);
virtual void setInbodyDocumentation(const char *d,const char *inbodyFile,int inbodyLine);
virtual void setHidden(bool b);
+ virtual void incrementFlowKeyWordCount();
virtual void writeDeclaration(OutputList &ol,
const ClassDef *cd,const NamespaceDef *nd,const FileDef *fd,const GroupDef *gd,
bool inGroup, const ClassDef *inheritFrom=0,const char *inheritId=0) const;
@@ -605,6 +607,8 @@ class MemberDefAliasImpl : public DefinitionAliasImpl, public MemberDef
{ return getMdAlias()->isSliceLocal(); }
virtual bool isConstExpr() const
{ return getMdAlias()->isConstExpr(); }
+ virtual int numberOfFlowKeyWords() const
+ { return getMdAlias()->numberOfFlowKeyWords(); }
virtual bool isFriendToHide() const
{ return getMdAlias()->isFriendToHide(); }
virtual bool isNotFriend() const
@@ -820,6 +824,7 @@ class MemberDefAliasImpl : public DefinitionAliasImpl, public MemberDef
virtual MemberDef *createTemplateInstanceMember(ArgumentList *formalArgs,
ArgumentList *actualArgs) const
{ return getMdAlias()->createTemplateInstanceMember(formalArgs,actualArgs); }
+ virtual void incrementFlowKeyWordCount() {}
virtual void writeDeclaration(OutputList &ol,
const ClassDef *cd,const NamespaceDef *nd,const FileDef *fd,const GroupDef *gd,
@@ -1408,6 +1413,7 @@ class MemberDefImpl::IMPL
QCString declFileName;
int declLine;
int declColumn;
+ int numberOfFlowKW;
};
MemberDefImpl::IMPL::IMPL() :
@@ -1423,7 +1429,8 @@ MemberDefImpl::IMPL::IMPL() :
category(0),
categoryRelation(0),
declLine(-1),
- declColumn(-1)
+ declColumn(-1),
+ numberOfFlowKW(0)
{
}
@@ -1581,7 +1588,6 @@ MemberDefImpl::MemberDefImpl(const char *df,int dl,int dc,
//printf("MemberDefImpl::MemberDef(%s)\n",na);
m_impl = new MemberDefImpl::IMPL;
m_impl->init(this,t,a,e,p,v,s,r,mt,tal,al,meta);
- number_of_flowkw = 1;
m_isLinkableCached = 0;
m_isConstructorCached = 0;
m_isDestructorCached = 0;
@@ -5971,14 +5977,14 @@ void MemberDefImpl::invalidateCachedArgumentTypes()
invalidateCachedTypesInArgumentList(m_impl->declArgList);
}
-void MemberDef::addFlowKeyWord()
+void MemberDefImpl::incrementFlowKeyWordCount()
{
- number_of_flowkw++;
+ m_impl->numberOfFlowKW++;
}
-int MemberDef::numberOfFlowKeyWords()
+int MemberDefImpl::numberOfFlowKeyWords() const
{
- return number_of_flowkw;
+ return m_impl->numberOfFlowKW;
}
//----------------
diff --git a/src/memberdef.h b/src/memberdef.h
index a94005f..c81af80 100644
--- a/src/memberdef.h
+++ b/src/memberdef.h
@@ -182,8 +182,8 @@ class MemberDef : virtual public Definition
virtual bool livesInsideEnum() const = 0;
virtual bool isSliceLocal() const = 0;
virtual bool isConstExpr() const = 0;
+ virtual int numberOfFlowKeyWords() const = 0;
- int numberOfFlowKeyWords();
// derived getters
virtual bool isFriendToHide() const = 0;
virtual bool isNotFriend() const = 0;
@@ -281,7 +281,6 @@ class MemberDef : virtual public Definition
// ---- setters -----
//-----------------------------------------------------------------------------------
- void addFlowKeyWord();
// set functions
virtual void setMemberType(MemberType t) = 0;
@@ -302,12 +301,13 @@ class MemberDef : virtual public Definition
virtual void setReadAccessor(const char *r) = 0;
virtual void setWriteAccessor(const char *w) = 0;
virtual void setTemplateSpecialization(bool b) = 0;
-
+
virtual void makeRelated() = 0;
virtual void makeForeign() = 0;
virtual void setInheritsDocsFrom(MemberDef *md) = 0;
virtual void setTagInfo(TagInfo *i) = 0;
virtual void setArgsString(const char *as) = 0;
+ virtual void incrementFlowKeyWordCount() = 0;
// relation to other members
virtual void setReimplements(MemberDef *md) = 0;
@@ -408,8 +408,6 @@ class MemberDef : virtual public Definition
const ClassDef *cd,const NamespaceDef *nd,const FileDef *fd,const GroupDef *gd,
bool onlyText=FALSE) const = 0;
- int number_of_flowkw;
-
// write helpers
virtual void warnIfUndocumented() const = 0;
virtual void warnIfUndocumentedParams() const = 0;
diff --git a/src/pycode.l b/src/pycode.l
index 3d57727..0f04baa 100644
--- a/src/pycode.l
+++ b/src/pycode.l
@@ -1173,6 +1173,10 @@ TARGET ({IDENTIFIER}|"("{TARGET_LIST}")"|"["{TARGET_LIST}"]"|{ATTRIBUT
}
{FLOWKW} {
+ if (g_currentMemberDef && g_currentMemberDef->isFunction())
+ {
+ g_currentMemberDef->incrementFlowKeyWordCount();
+ }
startFontClass("keywordflow");
codify(yytext);
endFontClass();
@@ -1210,6 +1214,10 @@ TARGET ({IDENTIFIER}|"("{TARGET_LIST}")"|"["{TARGET_LIST}"]"|{ATTRIBUT
}
{FLOWKW} {
+ if (g_currentMemberDef && g_currentMemberDef->isFunction())
+ {
+ g_currentMemberDef->incrementFlowKeyWordCount();
+ }
startFontClass("keywordflow");
codifyLines(yytext);
endFontClass();
diff --git a/src/util.cpp b/src/util.cpp
index e028660..69f91d5 100644
--- a/src/util.cpp
+++ b/src/util.cpp
@@ -5564,6 +5564,76 @@ QCString escapeCharsInString(const char *name,bool allowDots,bool allowUnderscor
return growBuf.get();
}
+QCString unescapeCharsInString(const char *s)
+{
+ static bool caseSenseNames = Config_getBool(CASE_SENSE_NAMES);
+ QCString result;
+ const char *p = s;
+ if (p)
+ {
+ char c;
+ while ((c=*p++))
+ {
+ if (c=='_') // 2 or 3 character escape
+ {
+ switch (*p)
+ {
+ case '_': result+=c; p++; break; // __ -> '_'
+ case '1': result+=':'; p++; break; // _1 -> ':'
+ case '2': result+='/'; p++; break; // _2 -> '/'
+ case '3': result+='<'; p++; break; // _3 -> '<'
+ case '4': result+='>'; p++; break; // _4 -> '>'
+ case '5': result+='*'; p++; break; // _5 -> '*'
+ case '6': result+='&'; p++; break; // _6 -> '&'
+ case '7': result+='|'; p++; break; // _7 -> '|'
+ case '8': result+='.'; p++; break; // _8 -> '.'
+ case '9': result+='!'; p++; break; // _9 -> '!'
+ case '0': // 3 character escape
+ switch (*(p+1))
+ {
+ case '0': result+=','; p+=2; break; // _00 -> ','
+ case '1': result+=' '; p+=2; break; // _01 -> ' '
+ case '2': result+='{'; p+=2; break; // _02 -> '{'
+ case '3': result+='}'; p+=2; break; // _03 -> '}'
+ case '4': result+='?'; p+=2; break; // _04 -> '?'
+ case '5': result+='^'; p+=2; break; // _05 -> '^'
+ case '6': result+='%'; p+=2; break; // _06 -> '%'
+ case '7': result+='('; p+=2; break; // _07 -> '('
+ case '8': result+=')'; p+=2; break; // _08 -> ')'
+ case '9': result+='+'; p+=2; break; // _09 -> '+'
+ case 'a': result+='='; p+=2; break; // _0a -> '='
+ case 'b': result+='$'; p+=2; break; // _0b -> '$'
+ case 'c': result+='\\'; p+=2; break;// _0c -> '\'
+ case 'd': result+='@'; p+=2; break; // _0d -> '@'
+ case 'e': result+=']'; p+=2; break; // _0e -> ']'
+ case 'f': result+='['; p+=2; break; // _0f -> '['
+ default: // unknown escape, just pass underscore character as-is
+ result+=c;
+ break;
+ }
+ break;
+ default:
+ if (!caseSenseNames && c>='a' && c<='z') // lower to upper case escape, _a -> 'A'
+ {
+ result+=toupper(*p);
+ p++;
+ }
+ else // unknown escape, pass underscore character as-is
+ {
+ result+=c;
+ }
+ break;
+ }
+ }
+ else // normal character; pass as is
+ {
+ result+=c;
+ }
+ }
+ }
+ return result;
+}
+
/*! This function determines the file name on disk of an item
* given its name, which could be a class name with template
* arguments, so special characters need to be escaped.
diff --git a/src/util.h b/src/util.h
index ad062d0..ac89ccd 100644
--- a/src/util.h
+++ b/src/util.h
@@ -340,6 +340,7 @@ PageDef *addRelatedPage(const char *name,
);
QCString escapeCharsInString(const char *name,bool allowDots,bool allowUnderscore=FALSE);
+QCString unescapeCharsInString(const char *s);
void addGroupListToTitle(OutputList &ol,const Definition *d);