diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/classdef.cpp | 21 | ||||
-rw-r--r-- | src/classdef.h | 2 | ||||
-rw-r--r-- | src/classlist.cpp | 16 | ||||
-rw-r--r-- | src/code.l | 1 | ||||
-rw-r--r-- | src/doc.l | 28 | ||||
-rw-r--r-- | src/doxygen.cpp | 20 | ||||
-rw-r--r-- | src/latexgen.cpp | 5 | ||||
-rw-r--r-- | src/memberdef.cpp | 2 | ||||
-rw-r--r-- | src/memberdef.h | 4 | ||||
-rw-r--r-- | src/sortdict.h | 59 | ||||
-rw-r--r-- | src/util.cpp | 31 |
11 files changed, 133 insertions, 56 deletions
diff --git a/src/classdef.cpp b/src/classdef.cpp index 59a53d7..511aa7b 100644 --- a/src/classdef.cpp +++ b/src/classdef.cpp @@ -2342,21 +2342,12 @@ QCString ClassDef::qualifiedNameWithTemplateParameters( QCString ClassDef::className() const { - if (!m_className.isEmpty()) + QCString className=m_localName; + Definition *p=getOuterScope(); + while (p && p->definitionType()==TypeClass) { - return m_className; - } - else - { - ClassDef *that = (ClassDef *)this; - // m_className is a cache value, so we fake that this function is "const". - that->m_className=m_localName.copy(); - Definition *p=getOuterScope(); - while (p && p->definitionType()==TypeClass) - { - that->m_className.prepend(p->localName()+"::"); - p=p->getOuterScope(); - } - return m_className; + className.prepend(p->localName()+"::"); + p=p->getOuterScope(); } + return className; }; diff --git a/src/classdef.h b/src/classdef.h index d31d99b..95450c3 100644 --- a/src/classdef.h +++ b/src/classdef.h @@ -401,8 +401,6 @@ class ClassDef : public Definition /*! Is this an abstact class? */ bool m_isAbstract; - QCString m_className; - /*! Is the class part of an unnamed namespace? */ bool m_isStatic; }; diff --git a/src/classlist.cpp b/src/classlist.cpp index 3772ae5..c78a3f5 100644 --- a/src/classlist.cpp +++ b/src/classlist.cpp @@ -35,18 +35,22 @@ int ClassList::compareItems(GCI item1, GCI item2) { ClassDef *c1=(ClassDef *)item1; ClassDef *c2=(ClassDef *)item2; - return stricmp(c1->localName().data()+getPrefixIndex(c1->localName()), - c2->localName().data()+getPrefixIndex(c2->localName()) - ); + //return stricmp(c1->localName().data()+getPrefixIndex(c1->localName()), + // c2->localName().data()+getPrefixIndex(c2->localName()) + // ); + return stricmp(c1->className().data()+getPrefixIndex(c1->className()), + c2->className().data()+getPrefixIndex(c2->className())); } int ClassSDict::compareItems(GCI item1, GCI item2) { ClassDef *c1=(ClassDef *)item1; ClassDef *c2=(ClassDef *)item2; - return stricmp(c1->localName().data()+getPrefixIndex(c1->localName()), - c2->localName().data()+getPrefixIndex(c2->localName()) - ); + //return stricmp(c1->localName().data()+getPrefixIndex(c1->localName()), + // c2->localName().data()+getPrefixIndex(c2->localName()) + // ); + return stricmp(c1->className().data()+getPrefixIndex(c1->className()), + c2->className().data()+getPrefixIndex(c2->className())); } ClassListIterator::ClassListIterator(const ClassList &cllist) : @@ -240,6 +240,7 @@ static void endCodeLine() */ static void codifyLines(char *text) { + //printf("codifyLines(%d,\"%s\")\n",g_yyLineNr,text); char *p=text,*sp=p; char c; bool done=FALSE; @@ -143,6 +143,7 @@ static void initParser() //----------------------------------------------------------------------------- void scanString(const char *s); +void scanDoc(const char *s); void internalParseDocument(const char *s); //----------------------------------------------------------------------------- @@ -324,7 +325,7 @@ static void verbIncludeFile(OutputDocInterface &od,const char *name) if ((fd=findFileDef(Doxygen::exampleNameDict,name,ambig))) { od.startCodeFragment(); - od.codify(fileToString(fd->absFilePath())); + od.codify(fileToString(fd->absFilePath())+"\n"); od.endCodeFragment(); } else if (ambig) @@ -909,7 +910,7 @@ TT [tT][tT] UL [uU][lL] VAR [vV][aA][rR] BLOCKQUOTE [bB][lL][oO][cC][kK][qQ][uU][oO][tT][eE] -DOCPARAM ([a-z_A-Z0-9:\<\>\=\.\-]+)|("\"".*"\"") +DOCPARAM ("#")?([a-z_A-Z0-9:\<\>\=\.\-]+)|("\"".*"\"") OPNEW {B}+"new"({B}*"[]")? OPDEL {B}+"delete"({B}*"[]")? OPARG "("[a-z_A-Z0-9,\<\> \t\*\&]*")" @@ -1567,14 +1568,14 @@ OPMASK ({B}*{OPNORM}({OPARG}?))|({OPCAST}{OPARG}) <DocScan>"\\capt".* <DocParam>({DOCPARAM}{BN}*","{BN}*)*{DOCPARAM}{BSEP}* { outDoc->startDescTableTitle(); - outDoc->docify(substitute(yytext,"\"","").stripWhiteSpace()); + scanDoc(substitute(yytext,"\"","").stripWhiteSpace()); outDoc->endDescTableTitle(); outDoc->startDescTableData(); BEGIN(DocScan); } <DocException>{SCOPENAME} { outDoc->startDescTableTitle(); - outDoc->docify(yytext); + generateRef(*outDoc,className,yytext,FALSE); outDoc->endDescTableTitle(); outDoc->startDescTableData(); BEGIN(DocScan); @@ -1938,6 +1939,7 @@ OPMASK ({B}*{OPNORM}({OPARG}?))|({OPCAST}{OPARG}) } } <DocCodeBlock>{BN}*{CMD}"endcode"/[^a-z_A-Z0-9] { // needed to match things like \endcode. (note the dot) + codeBlock+="\n"; parseCode(*outDoc,className,codeBlock,exampleDoc,exampleName); //printf("Code block\n-------------\n%s\n--------------\n",codeBlock.data()); outDoc->endCodeFragment(); @@ -2449,6 +2451,24 @@ void scanString(const char *s) BEGIN( oldRule ); } +void scanDoc(const char *s) +{ + const char *oldInputString = inputString; + int oldInputPosition = inputPosition; + int oldRule = YY_START; + YY_BUFFER_STATE oldBuffer = YY_CURRENT_BUFFER; + yy_switch_to_buffer(yy_create_buffer(docYYin, YY_BUF_SIZE)); + inputString = s; + inputPosition = 0; + BEGIN( DocScan ); + docYYlex(); + yy_delete_buffer(YY_CURRENT_BUFFER); + yy_switch_to_buffer(oldBuffer); + inputString = oldInputString; + inputPosition = oldInputPosition; + BEGIN( oldRule ); +} + void internalParseDocument(const char *s) { const char *oldInputString = inputString; diff --git a/src/doxygen.cpp b/src/doxygen.cpp index f350cc8..b3582f0 100644 --- a/src/doxygen.cpp +++ b/src/doxygen.cpp @@ -937,7 +937,7 @@ static void buildClassList(Entry *root) // add class to the list //printf("ClassDict.insert(%s)\n",resolveDefines(fullName).data()); - Doxygen::classSDict.inSort(fullName,cd); + Doxygen::classSDict.append(fullName,cd); // also add class to the correct structural context Definition *d = findScopeFromQualifiedName(Doxygen::globalScope,fullName); @@ -2543,7 +2543,7 @@ static void findUsedClassesForClass(Entry *root, masterCd->getDefFileName(),masterCd->getDefLine(), usedName,ClassDef::Class); //usedCd->setIsTemplateBaseClass(count); - Doxygen::hiddenClasses.inSort(usedName,usedCd); + Doxygen::hiddenClasses.append(usedName,usedCd); } if (isArtificial) usedCd->setClassIsArtificial(); instanceCd->addUsedClass(usedCd,md->name()); @@ -2600,7 +2600,7 @@ static void findUsedClassesForClass(Entry *root, usedCd = new ClassDef( masterCd->getDefFileName(),masterCd->getDefLine(), type,ClassDef::Class); - Doxygen::hiddenClasses.inSort(type,usedCd); + Doxygen::hiddenClasses.append(type,usedCd); } if (isArtificial) usedCd->setClassIsArtificial(); instanceCd->addUsedClass(usedCd,md->name()); @@ -2700,7 +2700,7 @@ static bool findTemplateInstanceRelation(Entry *root, if (freshInstance) { - Doxygen::classSDict.inSort(instanceClass->name(),instanceClass); + Doxygen::classSDict.append(instanceClass->name(),instanceClass); instanceClass->setTemplateBaseClassNames(templateNames); // search for new template instances caused by base classes of @@ -2967,7 +2967,7 @@ static bool findClassRelation( { baseClass=new ClassDef(root->fileName,root->startLine, baseClassName,ClassDef::Class); - Doxygen::hiddenClasses.inSort(baseClassName,baseClass); + Doxygen::hiddenClasses.append(baseClassName,baseClass); if (isArtificial) baseClass->setClassIsArtificial(); } } @@ -2975,7 +2975,7 @@ static bool findClassRelation( { baseClass=new ClassDef(root->fileName,root->startLine, baseClassName,ClassDef::Class); - Doxygen::classSDict.inSort(baseClassName,baseClass); + Doxygen::classSDict.append(baseClassName,baseClass); if (isArtificial) baseClass->setClassIsArtificial(); } // add base class to this class @@ -4413,14 +4413,14 @@ static void findMember(Entry *root, !findGlobalMember(root,namespaceName,funcName,funcTempList,funcArgs,funcDecl)) { warn(root->fileName,root->startLine, - "Warning: class for member %s cannot " + "Warning: class for member `%s' cannot " "be found.", funcName.data() ); } else if (!className.isEmpty()) { warn(root->fileName,root->startLine, - "Warning: member %s of class %s cannot be found", + "Warning: member `%s' of class `%s' cannot be found", funcName.data(),className.data()); } } @@ -7130,9 +7130,11 @@ void parseInput() msg("Search for main page...\n"); findMainPage(root); - msg("Sorting member lists...\n"); + msg("Sorting lists...\n"); Doxygen::memberNameList.sort(); Doxygen::functionNameList.sort(); + Doxygen::hiddenClasses.sort(); + Doxygen::classSDict.sort(); msg("Freeing entry tree\n"); delete root; diff --git a/src/latexgen.cpp b/src/latexgen.cpp index d310ea3..6b4f901 100644 --- a/src/latexgen.cpp +++ b/src/latexgen.cpp @@ -160,16 +160,17 @@ void LatexGenerator::init() << endl << "refman.ps: refman.dvi" << endl << "\tdvips -o refman.ps refman.dvi" << endl - << endl - << "refman.pdf: refman.ps" << endl; + << endl; if (Config_getBool("USE_PDFLATEX")) // use pdflatex instead of latex { + t << "refman.pdf: refman.tex" << endl; t << "\tpdflatex refman.tex" << endl; t << "\tmakeindex refman.idx" << endl; t << "\tpdflatex refman.tex" << endl << endl; } else // otherwise use ps2pdf: not as nice :( { + t << "refman.pdf: refman.ps" << endl; #if defined(_MSC_VER) // ps2pdf.bat does not work properly from a makefile using GNU make! t << "\tgswin32c -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite " diff --git a/src/memberdef.cpp b/src/memberdef.cpp index 5b58626..b7631f8 100644 --- a/src/memberdef.cpp +++ b/src/memberdef.cpp @@ -288,7 +288,7 @@ MemberDef::MemberDef(const char *df,int dl, args=a; args=removeRedundantWhiteSpace(args); if (type.isEmpty()) decl=name()+args; else decl=type+" "+name()+args; - declLine=0; + //declLine=0; memberGroup=0; virt=v; prot=p; diff --git a/src/memberdef.h b/src/memberdef.h index b734615..d81470c 100644 --- a/src/memberdef.h +++ b/src/memberdef.h @@ -255,8 +255,8 @@ class MemberDef : public Definition QCString init; // initializer int initLines; // number of lines in the initializer QCString decl; // member declaration in class - QCString declFile; // file where the declaration was found - int declLine; // line where the declaration was found + //QCString declFile; // file where the declaration was found + //int declLine; // line where the declaration was found QCString def; // member definition in code (fully qualified name) QCString anc; // HTML anchor name Specifier virt; // normal/virtual/pure virtual diff --git a/src/sortdict.h b/src/sortdict.h index 64afe8d..77991ea 100644 --- a/src/sortdict.h +++ b/src/sortdict.h @@ -23,6 +23,45 @@ #include <qlist.h> #include <qdict.h> +#define AUTORESIZE 1 + +#if AUTORESIZE +const uint SDict_primes[] = +{ + 17, + 29, + 47, + 71, + 113, + 179, + 293, + 457, + 733, + 1171, + 1871, + 2999, + 4787, + 7669, + 12251, + 19603, + 31379, + 50177, + 80287, + 128449, + 205519, + 328829, + 526139, + 841801, + 1346881, + 2155007, + 3448033, + 5516827, + 8826919, + 14123059, + 0xffffffff +}; +#endif + template<class T> class SDict; /*! internal wrapper class that redirects compareItems() to the @@ -51,16 +90,22 @@ class SDict private: SList<T> *m_list; QDict<T> *m_dict; + int m_sizeIndex; public: /*! Create an ordered dictionary. * \param size The size of the dictionary. Should be a prime number for * best distribution of elements. */ - SDict(int size) + SDict(int size) : m_sizeIndex(0) { m_list = new SList<T>(this); +#if AUTORESIZE + while ((uint)size>SDict_primes[m_sizeIndex]) m_sizeIndex++; + m_dict = new QDict<T>(SDict_primes[m_sizeIndex]); +#else m_dict = new QDict<T>(size); +#endif } /*! Destroys the dictionary */ virtual ~SDict() @@ -78,6 +123,12 @@ class SDict { m_list->append(d); m_dict->insert(key,d); +#if AUTORESIZE + if (m_dict->size()>SDict_primes[m_sizeIndex]) + { + m_dict->resize(SDict_primes[++m_sizeIndex]); + } +#endif } /*! Sorts the members of the dictionary. First appending a number * of members and then sorting them is faster (O(NlogN) than using @@ -96,6 +147,12 @@ class SDict { m_list->inSort(d); m_dict->insert(key,d); +#if AUTORESIZE + if (m_dict->size()>SDict_primes[m_sizeIndex]) + { + m_dict->resize(SDict_primes[++m_sizeIndex]); + } +#endif } /*! Indicates whether or not the dictionary owns its elements */ void setAutoDelete(bool val) diff --git a/src/util.cpp b/src/util.cpp index 764ab02..96944ff 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -891,26 +891,29 @@ void setAnchors(char id,MemberList *ml,int groupId) //---------------------------------------------------------------------------- +/*! takes the \a buf of the given lenght \a len and converts CR LF (DOS) + * or CR (MAC) line ending to LF (Unix). Returns the length of the + * converted content (i.e. the same as \a len (Unix, MAC) or + * smaller (DOS). + */ int filterCRLF(char *buf,int len) { - char *ps=buf; - char *pd=buf; - char c; - int i; - for (i=0;i<len;i++) + int src = 0; // source index + int dest = 0; // destination index + char c; // current character + + while (src<len) { - c=*ps++; - if (c=='\r') - { - if (*ps=='\n') ps++; // DOS: CR+LF -> LF - *pd++='\n'; // MAC: CR -> LF - } - else + c = buf[src++]; // Remember the processed character. + if (c == '\r') // CR to be solved (MAC, DOS) { - *pd++=c; + c = '\n'; // each CR to LF + if (src<len && buf[src] == '\n') + ++src; // skip LF just after CR (DOS) } + buf[dest++] = c; // copy the (modified) character to dest } - return len+pd-ps; + return dest; // length of the valid part of the buf } /*! reads a file with name \a name and returns it as a string. If \a filter |