summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/definition.cpp2
-rw-r--r--src/doxygen.cpp1
-rw-r--r--src/formula.cpp4
-rw-r--r--src/membergroup.cpp4
-rw-r--r--src/portable.cpp17
-rw-r--r--src/portable.h2
-rw-r--r--src/pre.l67
-rw-r--r--src/scanner.l1
-rw-r--r--src/xmlgen.cpp16
9 files changed, 81 insertions, 33 deletions
diff --git a/src/definition.cpp b/src/definition.cpp
index f2b9018..80060ba 100644
--- a/src/definition.cpp
+++ b/src/definition.cpp
@@ -1606,7 +1606,7 @@ void DefinitionImpl::makePartOfGroup(GroupDef *gd)
void DefinitionImpl::setRefItems(const std::vector<ListItemInfo> &sli)
{
- m_impl->xrefListItems = sli;
+ m_impl->xrefListItems.insert(m_impl->xrefListItems.end(), sli.cbegin(), sli.cend());
}
void DefinitionImpl::mergeRefItems(Definition *d)
diff --git a/src/doxygen.cpp b/src/doxygen.cpp
index c622f78..b4a4deb 100644
--- a/src/doxygen.cpp
+++ b/src/doxygen.cpp
@@ -11862,6 +11862,7 @@ void generateOutput()
g_s.begin("Running html help compiler...\n");
QString oldDir = QDir::currentDirPath();
QDir::setCurrent(Config_getString(HTML_OUTPUT));
+ portable_setShortDir();
portable_sysTimerStart();
if (portable_system(Config_getString(HHC_LOCATION), "index.hhp", Debug::isFlagSet(Debug::ExtCmd))!=1)
{
diff --git a/src/formula.cpp b/src/formula.cpp
index 534f56a..3d8e6ce 100644
--- a/src/formula.cpp
+++ b/src/formula.cpp
@@ -193,8 +193,8 @@ void FormulaList::generateBitmaps(const char *path)
// used.
char gsArgs[4096];
- sprintf(gsArgs,"-q -g%dx%d -r%dx%dx -sDEVICE=ppmraw "
- "-sOutputFile=%s.pnm -dNOPAUSE -dBATCH -- %s.ps",
+ sprintf(gsArgs,"-q -g%dx%d -r%dx%d -sDEVICE=ppmraw "
+ "-sOutputFile=%s.pnm -dNOPAUSE -dBATCH -dNOSAFER %s.ps",
gx,gy,(int)(scaleFactor*72),(int)(scaleFactor*72),
formBase.data(),formBase.data()
);
diff --git a/src/membergroup.cpp b/src/membergroup.cpp
index da52d64..05c38c3 100644
--- a/src/membergroup.cpp
+++ b/src/membergroup.cpp
@@ -358,7 +358,7 @@ void MemberGroup::findSectionsInDocumentation(const Definition *d)
void MemberGroup::setRefItems(const std::vector<ListItemInfo> &sli)
{
- m_xrefListItems = sli;
+ m_xrefListItems.insert(m_xrefListItems.end(), sli.cbegin(), sli.cend());
}
void MemberGroup::writeTagFile(FTextStream &tagFile)
@@ -370,5 +370,5 @@ void MemberGroup::writeTagFile(FTextStream &tagFile)
void MemberGroupInfo::setRefItems(const std::vector<ListItemInfo> &sli)
{
- m_sli = sli;
+ m_sli.insert(m_sli.end(), sli.cbegin(), sli.cend());
}
diff --git a/src/portable.cpp b/src/portable.cpp
index c6e829d..b447adc 100644
--- a/src/portable.cpp
+++ b/src/portable.cpp
@@ -478,3 +478,20 @@ void portable_unlink(const char *fileName)
#endif
}
+void portable_setShortDir(void)
+{
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ long length = 0;
+ TCHAR* buffer = NULL;
+ // First obtain the size needed by passing NULL and 0.
+ length = GetShortPathName(QDir::currentDirPath().data(), NULL, 0);
+ // Dynamically allocate the correct size
+ // (terminating null char was included in length)
+ buffer = new TCHAR[length];
+ // Now simply call again using same (long) path.
+ length = GetShortPathName(QDir::currentDirPath().data(), buffer, length);
+ // Set the correct directory (short name)
+ QDir::setCurrent(buffer);
+ delete [] buffer;
+#endif
+}
diff --git a/src/portable.h b/src/portable.h
index 83f90ef..c1b8c29 100644
--- a/src/portable.h
+++ b/src/portable.h
@@ -4,6 +4,7 @@
#include <sys/types.h>
#include <stdio.h>
#include <qglobal.h>
+#include <qdir.h>
#if defined(_WIN32)
typedef __int64 portable_off_t;
@@ -37,6 +38,7 @@ double portable_getSysElapsedTime();
void portable_sleep(int ms);
bool portable_isAbsolutePath(const char *fileName);
void portable_correct_path(void);
+void portable_setShortDir(void);
extern "C" {
void * portable_iconv_open(const char* tocode, const char* fromcode);
diff --git a/src/pre.l b/src/pre.l
index 0aa54b9..8bde725 100644
--- a/src/pre.l
+++ b/src/pre.l
@@ -379,6 +379,7 @@ struct preYY_state
bool ccomment;
QCString delimiter;
QDict<void> allIncludes;
+ QDict<void> expansionDict;
DefineManager defineManager;
ConstExpressionParser constExpParser;
};
@@ -1933,7 +1934,7 @@ static QCString extractTrailingComment(const char *s)
static int getNextChar(yyscan_t yyscanner,const QCString &expr,QCString *rest,uint &pos);
static int getCurrentChar(yyscan_t yyscanner,const QCString &expr,QCString *rest,uint pos);
static void unputChar(yyscan_t yyscanner,const QCString &expr,QCString *rest,uint &pos,char c);
-static void expandExpression(yyscan_t yyscanner,QCString &expr,QCString *rest,int pos);
+static void expandExpression(yyscan_t yyscanner,QCString &expr,QCString *rest,int pos,int level);
static QCString stringize(const QCString &s)
{
@@ -2068,10 +2069,10 @@ static inline void addTillEndOfString(yyscan_t yyscanner,const QCString &expr,QC
* The replacement string will be returned in \a result and the
* length of the (unexpanded) argument list is stored in \a len.
*/
-static bool replaceFunctionMacro(yyscan_t yyscanner,const QCString &expr,QCString *rest,int pos,int &len,const Define *def,QCString &result)
+static bool replaceFunctionMacro(yyscan_t yyscanner,const QCString &expr,QCString *rest,int pos,int &len,const Define *def,QCString &result,int level)
{
YY_EXTRA_TYPE state = preYYget_extra(yyscanner);
- //printf("replaceFunctionMacro(expr=%s,rest=%s,pos=%d,def=%s) level=%d\n",expr.data(),rest ? rest->data() : 0,pos,def->name.data(),state->level);
+ //printf(">replaceFunctionMacro(expr='%s',rest='%s',pos=%d,def='%s') level=%d\n",expr.data(),rest ? rest->data() : 0,pos,def->name.data(),state->level);
uint j=pos;
len=0;
result.resize(0);
@@ -2225,7 +2226,7 @@ static bool replaceFunctionMacro(yyscan_t yyscanner,const QCString &expr,QCStrin
// substitution of all formal arguments
QCString resExpr;
const QCString d=def->definition.stripWhiteSpace();
- //printf("Macro definition: %s\n",d.data());
+ //printf("Macro definition: '%s'\n",d.data());
bool inString=FALSE;
while (k<d.length())
{
@@ -2269,7 +2270,10 @@ static bool replaceFunctionMacro(yyscan_t yyscanner,const QCString &expr,QCStrin
//printf("substArg='%s'\n",substArg.data());
// only if no ## operator is before or after the argument
// marker we do macro expansion.
- if (!hash) expandExpression(yyscanner,substArg,0,0);
+ if (!hash)
+ {
+ expandExpression(yyscanner,substArg,0,0,level+1);
+ }
if (inString)
{
//printf("'%s'=stringize('%s')\n",stringize(*subst).data(),subst->data());
@@ -2311,10 +2315,10 @@ static bool replaceFunctionMacro(yyscan_t yyscanner,const QCString &expr,QCStrin
}
len=j-pos;
result=resExpr;
- //printf("result after substitution '%s' expr='%s'\n",
- // result.data(),expr.mid(pos,len).data());
+ //printf("<replaceFunctionMacro(expr='%s',rest='%s',pos=%d,def='%s',result='%s') level=%d return=TRUE\n",expr.data(),rest ? rest->data() : 0,pos,def->name.data(),result.data(),state->level);
return TRUE;
}
+ //printf("<replaceFunctionMacro(expr='%s',rest='%s',pos=%d,def='%s',result='%s') level=%d return=FALSE\n",expr.data(),rest ? rest->data() : 0,pos,def->name.data(),result.data(),state->level);
return FALSE;
}
@@ -2380,13 +2384,23 @@ static int getNextId(const QCString &expr,int p,int *l)
/*! performs recursive macro expansion on the string \a expr
* starting at position \a pos.
* May read additional characters from the input while re-scanning!
- * If \a expandAll is \c TRUE then all macros in the expression are
- * expanded, otherwise only the first is expanded.
*/
-static void expandExpression(yyscan_t yyscanner,QCString &expr,QCString *rest,int pos)
+static void expandExpression(yyscan_t yyscanner,QCString &expr,QCString *rest,int pos,int level)
{
YY_EXTRA_TYPE state = preYYget_extra(yyscanner);
- //printf("expandExpression(%s,%s)\n",expr.data(),rest ? rest->data() : 0);
+ //printf(">expandExpression(expr='%s',rest='%s',pos=%d,level=%d)\n",expr.data(),rest ? rest->data() : 0, pos, level);
+ if (expr.isEmpty())
+ {
+ return;
+ }
+ if (state->expansionDict.find(expr)!=0) // check for recursive expansions
+ {
+ return;
+ }
+ else
+ {
+ state->expansionDict.insert(expr,(void*)0x8);
+ }
QCString macroName;
QCString expMacro;
bool definedTest=FALSE;
@@ -2395,7 +2409,7 @@ static void expandExpression(yyscan_t yyscanner,QCString &expr,QCString *rest,in
{
bool replaced=FALSE;
macroName=expr.mid(p,l);
- //printf("macroName=%s\n",macroName.data());
+ //printf(" p=%d macroName=%s\n",p,macroName.data());
if (p<2 || !(expr.at(p-2)=='@' && expr.at(p-1)=='-')) // no-rescan marker?
{
if (state->expandedDict->find(macroName)==0) // expand macro
@@ -2432,29 +2446,33 @@ static void expandExpression(yyscan_t yyscanner,QCString &expr,QCString *rest,in
}
else if (def && def->nargs>=0) // function macro
{
- replaced=replaceFunctionMacro(yyscanner,expr,rest,p+l,len,def,expMacro);
+ //printf(" >>>> call replaceFunctionMacro\n");
+ replaced=replaceFunctionMacro(yyscanner,expr,rest,p+l,len,def,expMacro,level);
+ //printf(" <<<< call replaceFunctionMacro: replaced=%d\n",replaced);
len+=l;
}
+ //printf(" macroName='%s' expMacro='%s' replaced=%d\n",macroName.data(),expMacro.data(),replaced);
if (replaced) // expand the macro and rescan the expression
{
- //printf("replacing '%s'->'%s'\n",expr.mid(p,len).data(),expMacro.data());
+ //printf(" replacing '%s'->'%s'\n",expr.mid(p,len).data(),expMacro.data());
QCString resultExpr=expMacro;
QCString restExpr=expr.right(expr.length()-len-p);
processConcatOperators(resultExpr);
+ //printf(" macroName=%s def->nonRecursive=%d\n",macroName.data(),def->nonRecursive);
if (def && !def->nonRecursive)
{
state->expandedDict->insert(macroName,def);
- expandExpression(yyscanner,resultExpr,&restExpr,0);
+ expandExpression(yyscanner,resultExpr,&restExpr,0,level+1);
state->expandedDict->remove(macroName);
}
expr=expr.left(p)+resultExpr+restExpr;
+ //printf(" new expression: '%s' old i=%d new i=%d\n",expr.data(),i,p);
i=p;
- //printf("new expression: %s\n",expr.data());
}
else // move to the next macro name
{
- //printf("moving to the next macro old=%d new=%d\n",i,p+l);
+ //printf(" moving to the next macro old i=%d new i=%d\n",i,p+l);
i=p+l;
}
}
@@ -2472,6 +2490,7 @@ static void expandExpression(yyscan_t yyscanner,QCString &expr,QCString *rest,in
i=p+l;
}
}
+ //printf("<expandExpression(expr='%s',rest='%s',pos=%d,level=%d)\n",expr.data(),rest ? rest->data() : 0, pos,level);
}
/*! @brief Process string or character literal.
@@ -2700,7 +2719,8 @@ static bool computeExpression(yyscan_t yyscanner,const QCString &expr)
{
YY_EXTRA_TYPE state = preYYget_extra(yyscanner);
QCString e=expr;
- expandExpression(yyscanner,e,0,0);
+ state->expansionDict.clear();
+ expandExpression(yyscanner,e,0,0,0);
//printf("after expansion '%s'\n",e.data());
e = removeIdsAndMarkers(e);
if (e.isEmpty()) return FALSE;
@@ -2714,8 +2734,10 @@ static bool computeExpression(yyscan_t yyscanner,const QCString &expr)
static QCString expandMacro(yyscan_t yyscanner,const QCString &name)
{
+ YY_EXTRA_TYPE state = preYYget_extra(yyscanner);
QCString n=name;
- expandExpression(yyscanner,n,0,0);
+ state->expansionDict.clear();
+ expandExpression(yyscanner,n,0,0,0);
n=removeMarkers(n);
//printf("expandMacro '%s'->'%s'\n",name.data(),n.data());
return n;
@@ -2750,7 +2772,7 @@ static void addDefine(yyscan_t yyscanner)
// conditional section (cond command) that is disabled.
if (!Doxygen::gatherDefines) return;
- //printf("addDefine %s %s\n",state->defName.data(),state->defArgsStr.data());
+ //printf("addDefine '%s' '%s'\n",state->defName.data(),state->defArgsStr.data());
//ArgumentList *al = new ArgumentList;
//stringToArgumentList(state->defArgsStr,al);
MemberDef *md=createMemberDef(
@@ -3180,6 +3202,11 @@ void Preprocessor::processFile(const char *fileName,BufStr &input,BufStr &output
yyscan_t yyscanner = p->yyscanner;
YY_EXTRA_TYPE state = preYYget_extra(p->yyscanner);
struct yyguts_t *yyg = (struct yyguts_t*)p->yyscanner;
+
+#ifdef FLEX_DEBUG
+ preYYset_debug(1,yyscanner);
+#endif
+
printlex(yy_flex_debug, TRUE, __FILE__, fileName);
uint orgOffset=output.curPos();
//printf("##########################\n%s\n####################\n",
diff --git a/src/scanner.l b/src/scanner.l
index abc0c3b..393d6d4 100644
--- a/src/scanner.l
+++ b/src/scanner.l
@@ -2852,6 +2852,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP})
<FindMembers,FindFields,ReadInitializer>"//"([!/]){B}*{CMD}"}".*|"/*"([!*]){B}*{CMD}"}"[^*]*"*/" {
bool insideEnum = YY_START==FindFields || (YY_START==ReadInitializer && lastInitializerContext==FindFields); // see bug746226
Doxygen::docGroup.close(current.get(),yyFileName,yyLineNr,insideEnum);
+ lineCount();
}
<FindMembers>"=" { // in PHP code this could also be due to "<?="
current->bodyLine = yyLineNr;
diff --git a/src/xmlgen.cpp b/src/xmlgen.cpp
index 9e76d6f..83e97b2 100644
--- a/src/xmlgen.cpp
+++ b/src/xmlgen.cpp
@@ -980,7 +980,7 @@ static void generateXMLForMember(const MemberDef *md,FTextStream &ti,FTextStream
if (md->getDefLine()!=-1)
{
t << " <location file=\""
- << stripFromPath(md->getDefFileName()) << "\" line=\""
+ << convertToXML(stripFromPath(md->getDefFileName())) << "\" line=\""
<< md->getDefLine() << "\" column=\""
<< md->getDefColumn() << "\"" ;
if (md->getStartBodyLine()!=-1)
@@ -988,14 +988,14 @@ static void generateXMLForMember(const MemberDef *md,FTextStream &ti,FTextStream
FileDef *bodyDef = md->getBodyDef();
if (bodyDef)
{
- t << " bodyfile=\"" << stripFromPath(bodyDef->absFilePath()) << "\"";
+ t << " bodyfile=\"" << convertToXML(stripFromPath(bodyDef->absFilePath())) << "\"";
}
t << " bodystart=\"" << md->getStartBodyLine() << "\" bodyend=\""
<< md->getEndBodyLine() << "\"";
}
if (md->getDeclLine()!=-1)
{
- t << " declfile=\"" << stripFromPath(md->getDeclFileName()) << "\" declline=\""
+ t << " declfile=\"" << convertToXML(stripFromPath(md->getDeclFileName())) << "\" declline=\""
<< md->getDeclLine() << "\" declcolumn=\""
<< md->getDeclColumn() << "\"";
}
@@ -1418,7 +1418,7 @@ static void generateXMLForClass(const ClassDef *cd,FTextStream &ti)
t << " </collaborationgraph>" << endl;
}
t << " <location file=\""
- << stripFromPath(cd->getDefFileName()) << "\" line=\""
+ << convertToXML(stripFromPath(cd->getDefFileName())) << "\" line=\""
<< cd->getDefLine() << "\"" << " column=\""
<< cd->getDefColumn() << "\"" ;
if (cd->getStartBodyLine()!=-1)
@@ -1426,7 +1426,7 @@ static void generateXMLForClass(const ClassDef *cd,FTextStream &ti)
FileDef *bodyDef = cd->getBodyDef();
if (bodyDef)
{
- t << " bodyfile=\"" << stripFromPath(bodyDef->absFilePath()) << "\"";
+ t << " bodyfile=\"" << convertToXML(stripFromPath(bodyDef->absFilePath())) << "\"";
}
t << " bodystart=\"" << cd->getStartBodyLine() << "\" bodyend=\""
<< cd->getEndBodyLine() << "\"";
@@ -1506,7 +1506,7 @@ static void generateXMLForNamespace(const NamespaceDef *nd,FTextStream &ti)
writeXMLDocBlock(t,nd->docFile(),nd->docLine(),nd,0,nd->documentation());
t << " </detaileddescription>" << endl;
t << " <location file=\""
- << stripFromPath(nd->getDefFileName()) << "\" line=\""
+ << convertToXML(stripFromPath(nd->getDefFileName())) << "\" line=\""
<< nd->getDefLine() << "\"" << " column=\""
<< nd->getDefColumn() << "\"/>" << endl ;
t << " </compounddef>" << endl;
@@ -1648,7 +1648,7 @@ static void generateXMLForFile(FileDef *fd,FTextStream &ti)
writeXMLCodeBlock(t,fd);
t << " </programlisting>" << endl;
}
- t << " <location file=\"" << stripFromPath(fd->getDefFileName()) << "\"/>" << endl;
+ t << " <location file=\"" << convertToXML(stripFromPath(fd->getDefFileName())) << "\"/>" << endl;
t << " </compounddef>" << endl;
t << "</doxygen>" << endl;
@@ -1762,7 +1762,7 @@ static void generateXMLForDir(DirDef *dd,FTextStream &ti)
t << " <detaileddescription>" << endl;
writeXMLDocBlock(t,dd->docFile(),dd->docLine(),dd,0,dd->documentation());
t << " </detaileddescription>" << endl;
- t << " <location file=\"" << stripFromPath(dd->name()) << "\"/>" << endl;
+ t << " <location file=\"" << convertToXML(stripFromPath(dd->name())) << "\"/>" << endl;
t << " </compounddef>" << endl;
t << "</doxygen>" << endl;