diff options
author | dimitri <dimitri@afe2bf4a-e733-0410-8a33-86f594647bc7> | 2003-08-08 12:54:22 (GMT) |
---|---|---|
committer | dimitri <dimitri@afe2bf4a-e733-0410-8a33-86f594647bc7> | 2003-08-08 12:54:22 (GMT) |
commit | d09056a74447fe1c841ffd469986afdffd99765b (patch) | |
tree | 7c2d3f65b509d762729291b5341f0751138192fd /src | |
parent | 8c1096fc0147c36d3e026ec093b2c5f9158ae01d (diff) | |
download | Doxygen-d09056a74447fe1c841ffd469986afdffd99765b.zip Doxygen-d09056a74447fe1c841ffd469986afdffd99765b.tar.gz Doxygen-d09056a74447fe1c841ffd469986afdffd99765b.tar.bz2 |
Release-1.3.3-20030808
Diffstat (limited to 'src')
72 files changed, 3714 insertions, 2911 deletions
diff --git a/src/Makefile.in b/src/Makefile.in index 226d891..1d57871 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -14,12 +14,11 @@ # input used in their production; they are not affected by this license. # -all: Makefile.libdoxygen Makefile.libdoxycfg Makefile.doxygen Makefile.doxytag Makefile.doxysearch Makefile +all: Makefile.libdoxygen Makefile.libdoxycfg Makefile.doxygen Makefile.doxytag Makefile $(MAKE) -f Makefile.libdoxycfg PERL=$(PERL) $@ $(MAKE) -f Makefile.libdoxygen PERL=$(PERL) $@ $(MAKE) -f Makefile.doxygen PERL=$(PERL) $@ $(MAKE) -f Makefile.doxytag PERL=$(PERL) $@ - $(MAKE) -f Makefile.doxysearch PERL=$(PERL) $@ Makefile.libdoxygen: libdoxygen.pro libdoxygen.t $(ENV) $(PERL) $(TMAKE) libdoxygen.pro >Makefile.libdoxygen @@ -33,22 +32,17 @@ Makefile.doxygen: doxygen.pro Makefile.doxytag: doxytag.pro doxytag.t $(ENV) $(PERL) $(TMAKE) doxytag.pro >Makefile.doxytag -Makefile.doxysearch: doxysearch.pro - $(ENV) $(PERL) $(TMAKE) doxysearch.pro >Makefile.doxysearch - tmake: $(ENV) $(PERL) $(TMAKE) libdoxygen.pro >Makefile.libdoxygen $(ENV) $(PERL) $(TMAKE) libdoxycfg.pro >Makefile.libdoxycfg $(ENV) $(PERL) $(TMAKE) doxygen.pro >Makefile.doxygen $(ENV) $(PERL) $(TMAKE) doxytag.pro >Makefile.doxytag - $(ENV) $(PERL) $(TMAKE) doxysearch.pro >Makefile.doxysearch -clean: Makefile.libdoxygen Makefile.doxygen Makefile.doxytag Makefile.doxysearch +clean: Makefile.libdoxygen Makefile.doxygen Makefile.doxytag $(MAKE) -f Makefile.libdoxygen clean $(MAKE) -f Makefile.libdoxycfg clean $(MAKE) -f Makefile.doxygen clean $(MAKE) -f Makefile.doxytag clean - $(MAKE) -f Makefile.doxysearch clean distclean: clean -$(RM) scanner.cpp code.cpp config.cpp pre.cpp ce_lex.cpp \ diff --git a/src/classdef.cpp b/src/classdef.cpp index d6f5352..e20e9d6 100644 --- a/src/classdef.cpp +++ b/src/classdef.cpp @@ -791,7 +791,7 @@ void ClassDef::writeDetailedDescription(OutputList &ol, const QCString &pageType // repeat brief description if (!briefDescription().isEmpty() && Config_getBool("REPEAT_BRIEF")) { - ol.parseDoc(briefFile(),briefLine(),name(),0,briefDescription(),FALSE); + ol.parseDoc(briefFile(),briefLine(),this,0,briefDescription(),FALSE,FALSE); } if (!briefDescription().isEmpty() && Config_getBool("REPEAT_BRIEF") && !documentation().isEmpty()) @@ -811,7 +811,7 @@ void ClassDef::writeDetailedDescription(OutputList &ol, const QCString &pageType ol.disableAllBut(OutputGenerator::RTF); ol.newParagraph(); ol.popGeneratorState(); - ol.parseDoc(docFile(),docLine(),name(),0,documentation()+"\n",FALSE); + ol.parseDoc(docFile(),docLine(),this,0,documentation()+"\n",TRUE,FALSE); } // write examples if (exampleFlag) @@ -860,7 +860,7 @@ void ClassDef::writeDocumentation(OutputList &ol) { if (!Config_getBool("DETAILS_AT_TOP")) { - ol.parseDoc(briefFile(),briefLine(),name(),0,briefDescription(),FALSE); + ol.parseDoc(briefFile(),briefLine(),this,0,briefDescription(),TRUE,FALSE); ol.writeString(" \n"); ol.pushGeneratorState(); ol.disableAllBut(OutputGenerator::Html); diff --git a/src/classlist.cpp b/src/classlist.cpp index c370196..60ac20c 100644 --- a/src/classlist.cpp +++ b/src/classlist.cpp @@ -117,8 +117,8 @@ void ClassSDict::writeDeclaration(OutputList &ol,const ClassDef::CompoundType *f if (!cd->briefDescription().isEmpty()) { ol.startMemberDescription(); - ol.parseDoc(cd->briefFile(),cd->briefLine(),cd->name(),0, - cd->briefDescription(),FALSE); + ol.parseDoc(cd->briefFile(),cd->briefLine(),cd,0, + cd->briefDescription(),FALSE,FALSE); if ((!cd->briefDescription().isEmpty() && Config_getBool("REPEAT_BRIEF")) || !cd->documentation().isEmpty()) { diff --git a/src/compound.xsd b/src/compound.xsd index 9fb394a..5844f07 100644 --- a/src/compound.xsd +++ b/src/compound.xsd @@ -323,6 +323,7 @@ <xsd:element name="acute" type="docCharType" /> <xsd:element name="grave" type="docCharType" /> <xsd:element name="circ" type="docCharType" /> + <xsd:element name="slash" type="docCharType" /> <xsd:element name="tilde" type="docCharType" /> <xsd:element name="cedil" type="docCharType" /> <xsd:element name="ring" type="docCharType" /> diff --git a/src/compound_xsd.h b/src/compound_xsd.h index ca866bb..d84816b 100644 --- a/src/compound_xsd.h +++ b/src/compound_xsd.h @@ -323,6 +323,7 @@ " <xsd:element name=\"acute\" type=\"docCharType\" />\n" " <xsd:element name=\"grave\" type=\"docCharType\" />\n" " <xsd:element name=\"circ\" type=\"docCharType\" />\n" +" <xsd:element name=\"slash\" type=\"docCharType\" />\n" " <xsd:element name=\"tilde\" type=\"docCharType\" />\n" " <xsd:element name=\"cedil\" type=\"docCharType\" />\n" " <xsd:element name=\"ring\" type=\"docCharType\" />\n" diff --git a/src/config.h b/src/config.h index 5869add..5bd4209 100644 --- a/src/config.h +++ b/src/config.h @@ -25,7 +25,8 @@ class ConfigOption O_Enum, //<! A fixed set of items O_String, //<! A single item O_Int, //<! An integer value - O_Bool //<! A boolean value + O_Bool, //<! A boolean value + O_Obsolete //<! An obsolete option }; enum { @@ -309,6 +310,18 @@ class ConfigBool : public ConfigOption QCString m_valueString; }; +/*! \brief Section marker for obsolete options + * + */ +class ConfigObsolete : public ConfigOption +{ + public: + ConfigObsolete(OptionType t) : ConfigOption(t) {} + void writeTemplate(QTextStream &,bool,bool) {} + void substEnvVars() {} +}; + + // some convenience macros #define Config_getString(val) Config::instance()->getString(__FILE__,__LINE__,val) #define Config_getInt(val) Config::instance()->getInt(__FILE__,__LINE__,val) @@ -479,6 +492,13 @@ class Config m_dict->insert(name,result); return result; } + /*! Adds an option that has become obsolete. */ + ConfigOption *addObsolete(const char *name) + { + ConfigObsolete *option = new ConfigObsolete(ConfigOption::O_Obsolete); + m_dict->insert(name,option); + return option; + } /*! @} */ /*! Writes a template configuration file to \a f. If \a shortIndex diff --git a/src/config.l b/src/config.l index 87b98a0..a22e4de 100644 --- a/src/config.l +++ b/src/config.l @@ -469,6 +469,12 @@ static void readIncludeFile(const char *incName) s->resize(0); BEGIN(GetString); break; + case ConfigOption::O_Obsolete: + config_err("Warning: Tag `%s' at line %d of file %s has become obsolete.\n" + "To avoid this warning please update your configuration " + "file using \"doxygen -u\"\n", cmd.data(),yyLineNr,yyFileName.data()); + BEGIN(SkipInvalid); + break; } } } @@ -502,6 +508,12 @@ static void readIncludeFile(const char *incName) yytext,yyLineNr,yyFileName.data()); BEGIN(SkipInvalid); break; + case ConfigOption::O_Obsolete: + config_err("Warning: Tag `%s' at line %d of file %s has become obsolete.\n" + "To avoid this warning please update your configuration " + "file using \"doxygen -u\"\n", cmd.data(),yyLineNr,yyFileName.data()); + BEGIN(SkipInvalid); + break; } } } @@ -1077,6 +1089,9 @@ void Config::check() filePatternList.append("*.idl"); filePatternList.append("*.odl"); filePatternList.append("*.cs"); + filePatternList.append("*.php"); + filePatternList.append("*.php3"); + filePatternList.append("*.inc"); } // add default pattern if needed @@ -1094,102 +1109,102 @@ void Config::check() //} // more checks needed if and only if the search engine is enabled. - if (Config_getBool("SEARCHENGINE")) +// if (Config_getBool("SEARCHENGINE")) +// { +// // check cgi name +// QCString &cgiName = Config_getString("CGI_NAME"); +// if (cgiName.isEmpty()) +// { +// config_err("Error: tag CGI_NAME: no cgi script name after the CGI_NAME tag.\n"); +// exit(1); +// } +// // check cgi URL +// QCString &cgiURL = Config_getString("CGI_URL"); +// if (cgiURL.isEmpty()) +// { +// config_err("Error: tag CGI_URL: no URL to cgi directory specified.\n"); +// exit(1); +// } +// else if (cgiURL.left(7)!="http://" && +// cgiURL.left(8)!="https://" && +// cgiURL.left(4)!="cgi:" +// ) +// { +// config_err("Error: tag CGI_URL: URL to cgi directory is invalid (must " +// "start with http:// or https://).\n"); +// exit(1); +// } +// // check documentation URL +// QCString &docURL = Config_getString("DOC_URL"); +// if (docURL.isEmpty()) +// { +// docURL = Config_getString("OUTPUT_DIRECTORY").copy().prepend("file://").append("html"); +// } +// else if (docURL.left(7)!="http://" && +// docURL.left(8)!="https://" && +// docURL.left(7)!="file://" +// ) +// { +// config_err("Error: tag DOC_URL: URL to documentation is invalid or " +// "not absolute.\n"); +// exit(1); +// } +// // check absolute documentation path +// QCString &docAbsPath = Config_getString("DOC_ABSPATH"); +// if (docAbsPath.isEmpty()) +// { +// docAbsPath = Config_getString("OUTPUT_DIRECTORY")+"/html"; +// } +// else if (docAbsPath[0]!='/' && docAbsPath[1]!=':') +// { +// config_err("Error: tag DOC_ABSPATH: path is not absolute!\n"); +// exit(1); +// } +// // check path to doxysearch +// QCString &binAbsPath = Config_getString("BIN_ABSPATH"); +// if (binAbsPath.isEmpty()) +// { +// config_err("Error: tag BIN_ABSPATH: no absolute path to doxysearch " +// "specified.\n"); +// exit(1); +// } +// else if (binAbsPath[0]!='/' && binAbsPath[1]!=':') +// { +// config_err("Error: tag BIN_ABSPATH: path is not absolute!\n"); +// exit(1); +// } +// +// } + // check perl path + bool found=FALSE; + QCString &perlPath = Config_getString("PERL_PATH"); + if (perlPath.isEmpty()) { - // check cgi name - QCString &cgiName = Config_getString("CGI_NAME"); - if (cgiName.isEmpty()) - { - config_err("Error: tag CGI_NAME: no cgi script name after the CGI_NAME tag.\n"); - exit(1); - } - // check cgi URL - QCString &cgiURL = Config_getString("CGI_URL"); - if (cgiURL.isEmpty()) - { - config_err("Error: tag CGI_URL: no URL to cgi directory specified.\n"); - exit(1); - } - else if (cgiURL.left(7)!="http://" && - cgiURL.left(8)!="https://" && - cgiURL.left(4)!="cgi:" - ) - { - config_err("Error: tag CGI_URL: URL to cgi directory is invalid (must " - "start with http:// or https://).\n"); - exit(1); - } - // check documentation URL - QCString &docURL = Config_getString("DOC_URL"); - if (docURL.isEmpty()) - { - docURL = Config_getString("OUTPUT_DIRECTORY").copy().prepend("file://").append("html"); - } - else if (docURL.left(7)!="http://" && - docURL.left(8)!="https://" && - docURL.left(7)!="file://" - ) - { - config_err("Error: tag DOC_URL: URL to documentation is invalid or " - "not absolute.\n"); - exit(1); - } - // check absolute documentation path - QCString &docAbsPath = Config_getString("DOC_ABSPATH"); - if (docAbsPath.isEmpty()) - { - docAbsPath = Config_getString("OUTPUT_DIRECTORY")+"/html"; - } - else if (docAbsPath[0]!='/' && docAbsPath[1]!=':') - { - config_err("Error: tag DOC_ABSPATH: path is not absolute!\n"); - exit(1); - } - // check path to doxysearch - QCString &binAbsPath = Config_getString("BIN_ABSPATH"); - if (binAbsPath.isEmpty()) - { - config_err("Error: tag BIN_ABSPATH: no absolute path to doxysearch " - "specified.\n"); - exit(1); - } - else if (binAbsPath[0]!='/' && binAbsPath[1]!=':') + QFileInfo fi; + fi.setFile("/usr/bin/perl"); + if (fi.exists()) { - config_err("Error: tag BIN_ABSPATH: path is not absolute!\n"); - exit(1); + perlPath="/usr/bin/perl"; + found=TRUE; } - - // check perl path - bool found=FALSE; - QCString &perlPath = Config_getString("PERL_PATH"); - if (perlPath.isEmpty()) + else { - QFileInfo fi; - fi.setFile("/usr/bin/perl"); - if (fi.exists()) + fi.setFile("/usr/local/bin/perl"); + if (fi.exists()) { - perlPath="/usr/bin/perl"; - found=TRUE; - } - else - { - fi.setFile("/usr/local/bin/perl"); - if (fi.exists()) - { - perlPath="/usr/local/bin/perl"; - found=TRUE; - } + perlPath="/usr/local/bin/perl"; + found=TRUE; } } - if (!found) + } + if (!found) + { + QFileInfo fi(perlPath); + if (!fi.exists()) { - QFileInfo fi(perlPath); - if (!fi.exists()) - { - config_warn("Warning: tag PERL_PATH: perl interpreter not found at default or" - "user specified (%s) location\n", - perlPath.data()); - } + config_warn("Warning: tag PERL_PATH: perl interpreter not found at default or" + "user specified (%s) location\n", + perlPath.data()); } } @@ -1742,7 +1757,7 @@ void Config::create() "and *.h) to filter out the source-files in the directories. If left \n" "blank the following patterns are tested: \n" "*.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx *.hpp \n" - "*.h++ *.idl *.odl *.cs\n" + "*.h++ *.idl *.odl *.cs *.php *.php3 *.inc\n" ); cb = addBool( "RECURSIVE", @@ -2611,52 +2626,12 @@ void Config::create() "used. If set to NO the values of all tags below this one will be ignored. \n", FALSE ); - cs = addString( - "CGI_NAME", - "The CGI_NAME tag should be the name of the CGI script that \n" - "starts the search engine (doxysearch) with the correct parameters. \n" - "A script with this name will be generated by doxygen. \n" - ); - cs->setDefaultValue("search.cgi"); - cs->addDependency("SEARCHENGINE"); - cs = addString( - "CGI_URL", - "The CGI_URL tag should be the absolute URL to the directory where the \n" - "cgi binaries are located. See the documentation of your http daemon for \n" - "details. \n" - ); - cs->addDependency("SEARCHENGINE"); - cs = addString( - "DOC_URL", - "The DOC_URL tag should be the absolute URL to the directory where the \n" - "documentation is located. If left blank the absolute path to the \n" - "documentation, with file:// prepended to it, will be used. \n" - ); - cs->addDependency("SEARCHENGINE"); - cs = addString( - "DOC_ABSPATH", - "The DOC_ABSPATH tag should be the absolute path to the directory where the \n" - "documentation is located. If left blank the directory on the local machine \n" - "will be used. \n" - ); - cs->setWidgetType(ConfigString::Dir); - cs->addDependency("SEARCHENGINE"); - cs = addString( - "BIN_ABSPATH", - "The BIN_ABSPATH tag must point to the directory where the doxysearch binary \n" - "is installed. \n" - ); - cs->setDefaultValue("/usr/local/bin/"); - cs->setWidgetType(ConfigString::Dir); - cs->addDependency("SEARCHENGINE"); - cl = addList( - "EXT_DOC_PATHS", - "The EXT_DOC_PATHS tag can be used to specify one or more paths to \n" - "documentation generated for other projects. This allows doxysearch to search \n" - "the documentation for these projects as well. \n" - ); - cl->setWidgetType(ConfigList::Dir); - cl->addDependency("SEARCHENGINE"); + addObsolete("CGI_NAME"); + addObsolete("CGI_URL"); + addObsolete("DOC_URL"); + addObsolete("DOC_ABSPATH"); + addObsolete("BIN_ABSPATH"); + addObsolete("EXT_DOC_PATHS"); // The IMAGE_PATTERNS tag is now officially obsolete. } diff --git a/src/docparser.cpp b/src/docparser.cpp index 1b584b3..4cbb0a7 100644 --- a/src/docparser.cpp +++ b/src/docparser.cpp @@ -38,6 +38,8 @@ #include "printdocvisitor.h" #include "message.h" #include "section.h" +#include "searchindex.h" +#include "language.h" #define DBG(x) do {} while(0) //#define DBG(x) printf x @@ -66,6 +68,8 @@ static bool g_isExample; static QCString g_exampleName; static SectionDict *g_sectionDict; +static QCString g_searchUrl; + // include file state static QString g_includeFileText; static uint g_includeFileOffset; @@ -691,7 +695,7 @@ static void handleLinkedWord(DocNode *parent,QList<DocNode> &children) { Definition *compound=0; MemberDef *member=0; - QString name = linkToText(g_token->name); + QString name = linkToText(g_token->name,TRUE); if (resolveRef(g_context,g_token->name,g_inSeeBlock,&compound,&member)) { if (member) // member link @@ -1088,6 +1092,11 @@ DocSymbol::SymType DocSymbol::decodeSymbol(const QString &symName,char *letter) *letter=symName.at(1); return DocSymbol::Ring; } + else if (l==8 && symName.right(6)=="slash;") + { + *letter=symName.at(1); + return DocSymbol::Slash; + } return DocSymbol::Unknown; } @@ -1103,7 +1112,7 @@ static int internalValidatingParseDoc(DocNode *parent,QList<DocNode> &children, doctokenizerYYinit(doc,g_fileName); // first parse any number of paragraphs - bool isFirst=FALSE; + bool isFirst=TRUE; DocPara *lastPar=0; do { @@ -1151,6 +1160,33 @@ static void readTextFileByName(const QString &file,QString &text) //--------------------------------------------------------------------------- +DocWord::DocWord(DocNode *parent,const QString &word) : + m_parent(parent), m_word(word) +{ + //printf("new word %s url=%s\n",word.data(),g_searchUrl.data()); + if (!g_searchUrl.isEmpty()) + { + Doxygen::searchIndex->addWord(word.lower()); + } +} + +//--------------------------------------------------------------------------- + +DocLinkedWord::DocLinkedWord(DocNode *parent,const QString &word, + const QString &ref,const QString &file, + const QString &anchor) : + m_parent(parent), m_word(word), m_ref(ref), + m_file(file), m_anchor(anchor) +{ + //printf("new word %s url=%s\n",word.data(),g_searchUrl.data()); + if (!g_searchUrl.isEmpty()) + { + Doxygen::searchIndex->addWord(word.lower()); + } +} + +//--------------------------------------------------------------------------- + DocAnchor::DocAnchor(DocNode *parent,const QString &id,bool newAnchor) : m_parent(parent) { @@ -1636,7 +1672,6 @@ DocRef::DocRef(DocNode *parent,const QString &target) : m_parent(parent), m_refToSection(FALSE), m_refToAnchor(FALSE) { Definition *compound = 0; - //PageInfo *pageInfo = 0; QCString anchor; ASSERT(!target.isEmpty()); SectionInfo *sec = Doxygen::sectionDict[target]; @@ -1653,14 +1688,11 @@ DocRef::DocRef(DocNode *parent,const QString &target) : } else if (resolveLink(g_context,target,TRUE,&compound,/*&pageInfo,*/anchor)) { - m_text = linkToText(target); + bool isFile = compound ? + (compound->definitionType()==Definition::TypeFile ? TRUE : FALSE) : + FALSE; + m_text = linkToText(target,isFile); m_anchor = anchor; - //if (pageInfo) // ref to page - //{ - // m_file = pageInfo->getOutputFileBase(); - // m_ref = pageInfo->getReference(); - //} - //else if (compound) // ref to compound { if (anchor.isEmpty() && /* compound link */ @@ -1681,6 +1713,7 @@ DocRef::DocRef(DocNode *parent,const QString &target) : } else // oops, bogus target { + m_text = linkToText(target,FALSE); warn_doc_error(g_fileName,doctokenizerYYlineno,"Warning: unable to resolve reference to `%s' for \\ref command", target.data()); } @@ -2150,7 +2183,7 @@ int DocInternal::parse(int level) DBG(("DocInternal::parse() start\n")); // first parse any number of paragraphs - bool isFirst=FALSE; + bool isFirst=TRUE; DocPara *lastPar=0; do { @@ -2347,7 +2380,7 @@ int DocHtmlCell::parse() DBG(("DocHtmlCell::parse() start\n")); // parse one or more paragraphs - bool isFirst=FALSE; + bool isFirst=TRUE; DocPara *par=0; do { @@ -2680,7 +2713,7 @@ int DocHtmlDescData::parse() g_nodeStack.push(this); DBG(("DocHtmlDescData::parse() start\n")); - bool isFirst=FALSE; + bool isFirst=TRUE; DocPara *par=0; do { @@ -2778,7 +2811,7 @@ int DocHtmlListItem::parse() g_nodeStack.push(this); // parse one or more paragraphs - bool isFirst=FALSE; + bool isFirst=TRUE; DocPara *par=0; do { @@ -4444,7 +4477,7 @@ int DocSection::parse() } // first parse any number of paragraphs - bool isFirst=FALSE; + bool isFirst=TRUE; DocPara *lastPar=0; do { @@ -4634,7 +4667,7 @@ void DocRoot::parse() int retval=0; // first parse any number of paragraphs - bool isFirst=FALSE; + bool isFirst=TRUE; DocPara *lastPar=0; do { @@ -4703,16 +4736,103 @@ void DocRoot::parse() //-------------------------------------------------------------------------- DocNode *validatingParseDoc(const char *fileName,int startLine, - const char *context,MemberDef *md, - const char *input,bool isExample, - const char *exampleName) + Definition *ctx,MemberDef *md, + const char *input,bool indexWords, + bool isExample, const char *exampleName) { + //printf("validatingParseDoc(%s,%s)\n",ctx?ctx->name().data():"<none>", + // md?md->name().data():"<none>"); //printf("========== validating %s at line %d\n",fileName,startLine); //printf("---------------- input --------------------\n%s\n----------- end input -------------------\n",input); g_token = new TokenInfo; - g_context = context; + if (ctx && + (ctx->definitionType()==Definition::TypeClass || + ctx->definitionType()==Definition::TypeNamespace + ) + ) + { + g_context = ctx->name(); + } + else + { + g_context = ""; + } + + if (indexWords && md && Config_getBool("SEARCHENGINE")) + { + g_searchUrl=md->getOutputFileBase()+ + Config_getString("HTML_FILE_EXTENSION")+"#"+md->anchor(); + Doxygen::searchIndex->setCurrentDoc( + theTranslator->trMember(TRUE,TRUE)+" "+md->qualifiedName(), + g_searchUrl); + } + else if (indexWords && ctx && Config_getBool("SEARCHENGINE")) + { + g_searchUrl=ctx->getOutputFileBase()+ + Config_getString("HTML_FILE_EXTENSION"); + QCString name = ctx->qualifiedName(); + if (Config_getBool("OPTIMIZE_OUTPUT_JAVA")) + { + name = substitute(name,"::","."); + } + switch (ctx->definitionType()) + { + case Definition::TypePage: + { + PageDef *pd = (PageDef *)ctx; + if (!pd->title().isEmpty()) + { + name = theTranslator->trPage(TRUE,TRUE)+" "+pd->title(); + } + else + { + name = theTranslator->trPage(TRUE,TRUE)+" "+pd->name(); + } + } + break; + case Definition::TypeClass: + { + ClassDef *cd = (ClassDef *)ctx; + name.prepend(cd->compoundTypeString()+" "); + } + break; + case Definition::TypeNamespace: + { + if (Config_getBool("OPTIMIZE_OUTPUT_JAVA")) + { + name = theTranslator->trPackage(name); + } + else + { + name.prepend(theTranslator->trNamespace(TRUE,TRUE)+" "); + } + } + break; + case Definition::TypeGroup: + { + GroupDef *gd = (GroupDef *)ctx; + if (gd->groupTitle()) + { + name = theTranslator->trGroup(TRUE,TRUE)+" "+gd->groupTitle(); + } + else + { + name.prepend(theTranslator->trGroup(TRUE,TRUE)+" "); + } + } + break; + default: + break; + } + Doxygen::searchIndex->setCurrentDoc(name,g_searchUrl); + } + else + { + g_searchUrl=""; + } + g_fileName = fileName; g_memberDef = md; g_nodeStack.clear(); @@ -4779,6 +4899,7 @@ DocNode *validatingParseText(const char *input) g_hasParamCommand = FALSE; g_paramsFound.setAutoDelete(FALSE); g_paramsFound.clear(); + g_searchUrl=""; doctokenizerYYlineno=1; doctokenizerYYinit(input,g_fileName); @@ -4808,3 +4929,14 @@ void docFindSections(const char *input, doctokenizerYYFindSections(input,d,mg,fileName); } +void initDocParser() +{ + if (Config_getBool("SEARCHENGINE")) + { + Doxygen::searchIndex = new SearchIndex; + } + else + { + Doxygen::searchIndex = 0; + } +} diff --git a/src/docparser.h b/src/docparser.h index 1554037..6b79220 100644 --- a/src/docparser.h +++ b/src/docparser.h @@ -36,24 +36,28 @@ class SectionDict; //--------------------------------------------------------------------------- +/*! Initialize the documentation parser */ +void initDocParser(); + /*! Main entry point for the documentation parser. * @param fileName File in which the documentation block is found (or the * name of the example file in case isExample is TRUE). * @param startLine Line at which the documentation block is found. - * @param context Class or namespace in which of the item to which this - * block belongs. + * @param context Class or namespace to which this block belongs. * @param md Member definition to which the documentation belongs. * Can be 0. * @param input String representation of the documentation block. + * @param indexWords Indicates whether or not words should be put in the + * search index. * @param isExample TRUE if the documentation belongs to an example. * @param exampleName Base name of the example file (0 if isExample is FALSE). * @returns Root node of the abstract syntax tree. Ownership of the * pointer is handed over to the caller. */ DocNode *validatingParseDoc(const char *fileName,int startLine, - const char *context, MemberDef *md, - const char *input,bool isExample, - const char *exampleName=0); + Definition *context, MemberDef *md, + const char *input,bool indexWords, + bool isExample,const char *exampleName=0); /*! Main entry point for parsing simple text fragments. These * fragments are limited to words, whitespace and symbols. @@ -176,8 +180,7 @@ template<class T> class CompAccept class DocWord : public DocNode { public: - DocWord(DocNode *parent,const QString &word) : - m_parent(parent), m_word(word) {} + DocWord(DocNode *parent,const QString &word); QString word() const { return m_word; } Kind kind() const { return Kind_Word; } DocNode *parent() const { return m_parent; } @@ -195,9 +198,7 @@ class DocLinkedWord : public DocNode public: DocLinkedWord(DocNode *parent,const QString &word, const QString &ref,const QString &file, - const QString &anchor) : - m_parent(parent), m_word(word), m_ref(ref), - m_file(file), m_anchor(anchor) {} + const QString &anchor); QString word() const { return m_word; } Kind kind() const { return Kind_Word; } DocNode *parent() const { return m_parent; } @@ -312,7 +313,7 @@ class DocSymbol : public DocNode public: enum SymType { Unknown=0, BSlash,At,Less,Greater,Amp,Dollar,Hash,Percent, Copy, Tm, Reg, Apos, Quot, Uml, Acute, Grave, Circ, Tilde, Szlig, - Cedil, Ring, Nbsp + Cedil, Ring, Nbsp, Slash }; DocSymbol(DocNode *parent,SymType s,char letter='\0') : m_parent(parent), m_symbol(s), m_letter(letter) {} @@ -923,6 +924,7 @@ class DocPara : public CompAccept<DocPara>, public DocNode void markLast(bool v=TRUE) { m_isLast=v; } bool isFirst() const { return m_isFirst; } bool isLast() const { return m_isLast; } + const QList<DocNode> &children() const { return m_children; } int handleCommand(const QString &cmdName); int handleHtmlStartTag(const QString &tagName,const HtmlAttribList &tagHtmlAttribs); diff --git a/src/doxygen.cpp b/src/doxygen.cpp index addf597..fbfe2e2 100644 --- a/src/doxygen.cpp +++ b/src/doxygen.cpp @@ -42,6 +42,7 @@ #include "pre.h" #include "tagreader.h" #include "dot.h" +#include "docparser.h" #include "outputlist.h" #include "declinfo.h" @@ -62,6 +63,7 @@ #include "bufstr.h" #include "commentcnv.h" #include "cmdmapper.h" +#include "searchindex.h" #if defined(_MSC_VER) || defined(__BORLANDC__) #define popen _popen @@ -113,6 +115,7 @@ QDict<RefList> *Doxygen::xrefLists = new QDict<RefList>; // dictionary of cross- bool Doxygen::parseSourcesNeeded = FALSE; double Doxygen::sysElapsedTime = 0.0; QTime Doxygen::runningTime; +SearchIndex * Doxygen::searchIndex=0; static StringList inputFiles; static StringDict excludeNameDict(1009); // sections @@ -893,6 +896,9 @@ static void resolveClassNestingRelations() Definition *d = findScopeFromQualifiedName(Doxygen::globalScope,cd->name()); if (d==0) { + //Definition *d = buildScopeFromQualifiedName(cd->name(),cd->name().contains("::")); + //d->addInnerCompound(nd); + //nd->setOuterScope(d); warn(cd->getDefFileName(),cd->getDefLine(), "Warning: Internal inconsistency: scope for class %s not " "found!\n",cd->name().data() @@ -1497,12 +1503,13 @@ static MemberDef *addVariableToFile( { Debug::print(Debug::Variables,0, " global variable:\n" - " type=`%s' scope=`%s' name=`%s' args=`%s' prot=`%d\n", + " type=`%s' scope=`%s' name=`%s' args=`%s' prot=`%d mtype=%d\n", root->type.data(), scope.data(), name.data(), root->args.data(), - root->protection + root->protection, + mtype ); bool ambig; @@ -2200,7 +2207,8 @@ static void buildFunctionList(Entry *root) ) ) { - addMethodToClass(root,cd,rname,/*scope,*/isFriend); + Debug::print(Debug::Functions,0,"--> member of class %s!\n",rname.data(),cd->name().data()); + addMethodToClass(root,cd,rname,isFriend); } else if (root->parent && !(root->parent->section & Entry::COMPOUND_MASK) && @@ -2220,7 +2228,7 @@ static void buildFunctionList(Entry *root) //MemberDef *fmd; if ((mn=Doxygen::functionNameSDict[rname])) { - //printf("--> function %s already found!\n",rname.data()); + Debug::print(Debug::Functions,0,"--> function %s already found!\n",rname.data()); MemberNameIterator mni(*mn); MemberDef *md; for (mni.toFirst();((md=mni.current()) && !found);++mni) @@ -2294,7 +2302,7 @@ static void buildFunctionList(Entry *root) } else if (!md->documentation().isEmpty() && !root->doc.isEmpty()) { - warn(root->docFile,root->docLine,"Warning: ignoring the detailed description found here, since another one was found at line %d of file %s!",md->docLine(),md->docFile().data()); + warn(root->docFile,root->docLine,"Warning: member %s: ignoring the detailed description found here, since another one was found at line %d of file %s!",md->name().data(),md->docLine(),md->docFile().data()); } if (md->briefDescription().isEmpty() && !root->brief.isEmpty()) @@ -2303,7 +2311,7 @@ static void buildFunctionList(Entry *root) } else if (!md->briefDescription().isEmpty() && !root->brief.isEmpty()) { - warn(root->briefFile,root->briefLine,"Warning: ignoring the brief description found here, since another one was found at line %d of file %s!",md->briefLine(),md->briefFile().data()); + warn(root->briefFile,root->briefLine,"Warning: member %s: ignoring the brief description found here, since another one was found at line %d of file %s!",md->name().data(),md->briefLine(),md->briefFile().data()); } md->addSectionsToDefinition(root->anchors); @@ -2635,26 +2643,26 @@ static void transferFunctionDocumentation() //printf("transfering docs mdef->mdec (%s->%s)\n",mdef->argsString(),mdec->argsString()); mdec->setDocumentation(mdef->documentation(),mdef->docFile(),mdef->docLine()); mdec->setDocsForDefinition(mdef->isDocsForDefinition()); - ArgumentList *mdefAl = new ArgumentList; - stringToArgumentList(mdef->argsString(),mdefAl); if (mdef->argumentList()) { + ArgumentList *mdefAl = new ArgumentList; + stringToArgumentList(mdef->argsString(),mdefAl); transferArgumentDocumentation(mdef->argumentList(),mdefAl); + mdec->setArgumentList(mdefAl); } - mdec->setArgumentList(mdefAl); } else if (!mdec->documentation().isEmpty()) { //printf("transfering docs mdec->mdef (%s->%s)\n",mdec->argsString(),mdef->argsString()); mdef->setDocumentation(mdec->documentation(),mdec->docFile(),mdec->docLine()); mdef->setDocsForDefinition(mdec->isDocsForDefinition()); - ArgumentList *mdecAl = new ArgumentList; - stringToArgumentList(mdec->argsString(),mdecAl); if (mdec->argumentList()) { + ArgumentList *mdecAl = new ArgumentList; + stringToArgumentList(mdec->argsString(),mdecAl); transferArgumentDocumentation(mdec->argumentList(),mdecAl); + mdef->setDeclArgumentList(mdecAl); } - mdef->setDeclArgumentList(mdecAl); } if (mdec->getStartBodyLine()!=-1 && mdef->getStartBodyLine()==-1) { @@ -6250,20 +6258,12 @@ static void generatePageDocs() outputList->endSection(si->label,si->type); } outputList->startTextBlock(); - QCString scName; - if (pd->getOuterScope() && - (pd->getOuterScope()->definitionType()==Definition::TypeClass || - pd->getOuterScope()->definitionType()==Definition::TypeNamespace - ) - ) - { - scName=pd->getOuterScope()->name(); - } outputList->parseDoc(pd->docFile(), pd->docLine(), - scName,0, + pd->getOuterScope(),0, pd->documentation(), - FALSE + TRUE, // index words + FALSE // not an example /*,pd->sectionDict*/); outputList->endTextBlock(); endFile(*outputList); @@ -6352,10 +6352,11 @@ static void generateExampleDocs() endTitle(*outputList,n,0); outputList->parseDoc(pd->docFile(), // file pd->docLine(), // startLine - pd->getOuterScope()?pd->getOuterScope()->name().data():0, // context + pd->getOuterScope(), // context 0, // memberDef pd->documentation()+"\n\\include "+pd->name(), // docs - TRUE, // is example + TRUE, // index words + TRUE, // is example pd->name() ); endFile(*outputList); @@ -6458,116 +6459,116 @@ static QCString fixSlashes(QCString &s) //---------------------------------------------------------------------------- // generate files for the search engine -static void generateSearchIndex() -{ - if (Config_getBool("SEARCHENGINE") && Config_getBool("GENERATE_HTML")) - { - // create search index - QCString fileName; - writeSearchButton(Config_getString("HTML_OUTPUT")); - -#if !defined(_WIN32) - // create cgi script - fileName = Config_getString("HTML_OUTPUT")+"/"+Config_getString("CGI_NAME"); - QFile f(fileName); - if (f.open(IO_WriteOnly)) - { - QTextStream t(&f); - t << "#!/bin/sh" << endl - << "DOXYSEARCH=" << Config_getString("BIN_ABSPATH") << "/doxysearch" << endl - << "DOXYPATH=\"" << Config_getString("DOC_ABSPATH") << " "; - - QStrList &extDocPaths=Config_getList("EXT_DOC_PATHS"); - char *s= extDocPaths.first(); - while (s) - { - t << s << " "; - s=extDocPaths.next(); - } - - t << "\"" << endl - << "if [ -f $DOXYSEARCH ]" << endl - << "then" << endl - << " $DOXYSEARCH $DOXYPATH" << endl - << "else" << endl - << " echo \"Content-Type: text/html\"" << endl - << " echo \"\"" << endl - << " echo \"<h2>Error: $DOXYSEARCH not found. Check cgi script!</h2>\"" << endl - << "fi" << endl; - - f.close(); - struct stat stat_struct; - stat(fileName,&stat_struct); - chmod(fileName,stat_struct.st_mode|S_IXUSR|S_IXGRP|S_IXOTH); - } - else - { - err("Error: Cannot open file %s for writing\n",fileName.data()); - } -#else /* Windows platform */ - // create cgi program - fileName = Config_getString("CGI_NAME").copy(); - if (fileName.right(4)==".cgi") - fileName=fileName.left(fileName.length()-4); - fileName+=".c"; - fileName.prepend(Config_getString("HTML_OUTPUT")+"/"); - QFile f(fileName); - if (f.open(IO_WriteOnly)) - { - QTextStream t(&f); - t << "#include <stdio.h>" << endl; - t << "#include <stdlib.h>" << endl; - t << "#include <process.h>" << endl; - t << endl; - t << "const char *DOXYSEARCH = \"" << - fixSlashes(Config_getString("BIN_ABSPATH")) << "\\\\doxysearch.exe\";" << endl; - t << "const char *DOXYPATH = \"" << - fixSlashes(Config_getString("DOC_ABSPATH")) << "\";" << endl; - t << endl; - t << "int main(void)" << endl; - t << "{" << endl; - t << " char buf[1024];" << endl; - t << " sprintf(buf,\"%s %s\",DOXYSEARCH,DOXYPATH);" << endl; - t << " if (system(buf))" << endl; - t << " {" << endl; - t << " printf(\"Content-Type: text/html\\n\\n\");" << endl; - t << " printf(\"<h2>Error: failed to execute %s</h2>\\n\",DOXYSEARCH);" << endl; - t << " exit(1);" << endl; - t << " }" << endl; - t << " return 0;" << endl; - t << "}" << endl; - f.close(); - } - else - { - err("Error: Cannot open file %s for writing\n",fileName.data()); - } -#endif /* !defined(_WIN32) */ - - // create config file - fileName = Config_getString("HTML_OUTPUT")+"/search.cfg"; - f.setName(fileName); - if (f.open(IO_WriteOnly)) - { - QTextStream t(&f); - t << Config_getString("DOC_URL") << "/" << endl - << Config_getString("CGI_URL") << "/" << Config_getString("CGI_NAME") << endl; - f.close(); - } - else - { - err("Error: Cannot open file %s for writing\n",fileName.data()); - } - //outputList->generateExternalIndex(); - outputList->pushGeneratorState(); - outputList->disableAllBut(OutputGenerator::Html); - startFile(*outputList,"header"+Doxygen::htmlFileExtension,0,"Search Engine",TRUE); - outputList->endPlainFile(); - outputList->startPlainFile("footer"+Doxygen::htmlFileExtension); - endFile(*outputList,TRUE); - outputList->popGeneratorState(); - } -} +//static void generateSearchIndex() +//{ +// if (Config_getBool("SEARCHENGINE") && Config_getBool("GENERATE_HTML")) +// { +// // create search index +// QCString fileName; +// writeSearchButton(Config_getString("HTML_OUTPUT")); +// +//#if !defined(_WIN32) +// // create cgi script +// fileName = Config_getString("HTML_OUTPUT")+"/"+Config_getString("CGI_NAME"); +// QFile f(fileName); +// if (f.open(IO_WriteOnly)) +// { +// QTextStream t(&f); +// t << "#!/bin/sh" << endl +// << "DOXYSEARCH=" << Config_getString("BIN_ABSPATH") << "/doxysearch" << endl +// << "DOXYPATH=\"" << Config_getString("DOC_ABSPATH") << " "; +// +// QStrList &extDocPaths=Config_getList("EXT_DOC_PATHS"); +// char *s= extDocPaths.first(); +// while (s) +// { +// t << s << " "; +// s=extDocPaths.next(); +// } +// +// t << "\"" << endl +// << "if [ -f $DOXYSEARCH ]" << endl +// << "then" << endl +// << " $DOXYSEARCH $DOXYPATH" << endl +// << "else" << endl +// << " echo \"Content-Type: text/html\"" << endl +// << " echo \"\"" << endl +// << " echo \"<h2>Error: $DOXYSEARCH not found. Check cgi script!</h2>\"" << endl +// << "fi" << endl; +// +// f.close(); +// struct stat stat_struct; +// stat(fileName,&stat_struct); +// chmod(fileName,stat_struct.st_mode|S_IXUSR|S_IXGRP|S_IXOTH); +// } +// else +// { +// err("Error: Cannot open file %s for writing\n",fileName.data()); +// } +//#else /* Windows platform */ +// // create cgi program +// fileName = Config_getString("CGI_NAME").copy(); +// if (fileName.right(4)==".cgi") +// fileName=fileName.left(fileName.length()-4); +// fileName+=".c"; +// fileName.prepend(Config_getString("HTML_OUTPUT")+"/"); +// QFile f(fileName); +// if (f.open(IO_WriteOnly)) +// { +// QTextStream t(&f); +// t << "#include <stdio.h>" << endl; +// t << "#include <stdlib.h>" << endl; +// t << "#include <process.h>" << endl; +// t << endl; +// t << "const char *DOXYSEARCH = \"" << +// fixSlashes(Config_getString("BIN_ABSPATH")) << "\\\\doxysearch.exe\";" << endl; +// t << "const char *DOXYPATH = \"" << +// fixSlashes(Config_getString("DOC_ABSPATH")) << "\";" << endl; +// t << endl; +// t << "int main(void)" << endl; +// t << "{" << endl; +// t << " char buf[1024];" << endl; +// t << " sprintf(buf,\"%s %s\",DOXYSEARCH,DOXYPATH);" << endl; +// t << " if (system(buf))" << endl; +// t << " {" << endl; +// t << " printf(\"Content-Type: text/html\\n\\n\");" << endl; +// t << " printf(\"<h2>Error: failed to execute %s</h2>\\n\",DOXYSEARCH);" << endl; +// t << " exit(1);" << endl; +// t << " }" << endl; +// t << " return 0;" << endl; +// t << "}" << endl; +// f.close(); +// } +// else +// { +// err("Error: Cannot open file %s for writing\n",fileName.data()); +// } +//#endif /* !defined(_WIN32) */ +// +// // create config file +// fileName = Config_getString("HTML_OUTPUT")+"/search.cfg"; +// f.setName(fileName); +// if (f.open(IO_WriteOnly)) +// { +// QTextStream t(&f); +// t << Config_getString("DOC_URL") << "/" << endl +// << Config_getString("CGI_URL") << "/" << Config_getString("CGI_NAME") << endl; +// f.close(); +// } +// else +// { +// err("Error: Cannot open file %s for writing\n",fileName.data()); +// } +// //outputList->generateExternalIndex(); +// outputList->pushGeneratorState(); +// outputList->disableAllBut(OutputGenerator::Html); +// startFile(*outputList,"header"+Doxygen::htmlFileExtension,0,"Search Engine",TRUE); +// outputList->endPlainFile(); +// outputList->startPlainFile("footer"+Doxygen::htmlFileExtension); +// endFile(*outputList,TRUE); +// outputList->popGeneratorState(); +// } +//} //---------------------------------------------------------------------------- @@ -7534,14 +7535,14 @@ void parseInput() Doxygen::imageNameDict = new FileNameDict(257); Doxygen::dotFileNameDict = new FileNameDict(257); - if (!Config_getString("DOC_URL").isEmpty()) - { - Doxygen::tagDestinationDict.insert("_doc",new QCString(Config_getString("DOC_URL"))); - } - if (!Config_getString("CGI_URL").isEmpty()) - { - Doxygen::tagDestinationDict.insert("_cgi",new QCString(Config_getString("CGI_URL")+"/"+Config_getString("CGI_NAME"))); - } + //if (!Config_getString("DOC_URL").isEmpty()) + //{ + // Doxygen::tagDestinationDict.insert("_doc",new QCString(Config_getString("DOC_URL"))); + //} + //if (!Config_getString("CGI_URL").isEmpty()) + //{ + // Doxygen::tagDestinationDict.insert("_cgi",new QCString(Config_getString("CGI_URL")+"/"+Config_getString("CGI_NAME"))); + //} /************************************************************************** * Initialize some global constants @@ -8025,6 +8026,32 @@ void generateOutput() * Initialize output generators * **************************************************************************/ + initDocParser(); + + //{ + // QCString fileName = Config_getString("HTML_OUTPUT")+"/filetree.html"; + // QFile f(fileName); + // if (f.open(IO_WriteOnly)) + // { + // QTextStream t(&f); + // t << "<html>\n"; + // t << " <head>\n"; + // t << " <style type=\"text/css\">\n"; + // t << " <!--\n"; + // t << " .directory { font-size: 10pt; font-weight: bold; }\n"; + // t << " .directory h3 { margin: 0px; margin-top: 1em; font-size: 11pt; }\n"; + // t << " .directory p { margin: 0px; white-space: nowrap; }\n"; + // t << " .directory div { display: visible; margin: 0px; }\n"; + // t << " .directory img { vertical-align: middle; }\n"; + // t << " -->\n"; + // t << " </style>\n"; + // t << " </head>\n"; + // t << " <body>\n"; + // generateFileTree(t); + // t << " </body>\n"; + // t << "</html>\n"; + // } + //} outputList = new OutputList(TRUE); if (Config_getBool("GENERATE_HTML")) @@ -8144,8 +8171,8 @@ void generateOutput() writeGraphInfo(*outputList); } - msg("Generating search index...\n"); - generateSearchIndex(); + //msg("Generating search index...\n"); + //generateSearchIndex(); msg("Generating style sheet...\n"); //printf("writing style info\n"); @@ -8237,7 +8264,12 @@ void generateOutput() } QDir::setCurrent(oldDir); } - cleanUpDoxygen(); + if (Config_getBool("SEARCHENGINE")) + { + msg("Generating search index\n"); + HtmlGenerator::writeSearchPage(); + Doxygen::searchIndex->write(Config_getString("HTML_OUTPUT")+"/search.idx"); + } if (Debug::isFlagSet(Debug::Time)) { msg("Total elapsed time: %.3f seconds\n(of which %.3f seconds waiting for external tools to finish)\n", @@ -8245,5 +8277,6 @@ void generateOutput() Doxygen::sysElapsedTime ); } + cleanUpDoxygen(); } diff --git a/src/doxygen.h b/src/doxygen.h index a24a4b6..9cca76d 100644 --- a/src/doxygen.h +++ b/src/doxygen.h @@ -39,6 +39,7 @@ class PageSList; class PageSDict; class PageDef; +class SearchIndex; typedef QList<QCString> StringList; typedef QDict<FileDef> FileDict; @@ -97,6 +98,7 @@ class Doxygen static bool parseSourcesNeeded; static double sysElapsedTime; static QTime runningTime; + static SearchIndex *searchIndex; }; void initDoxygen(); diff --git a/src/doxysearch.cpp b/src/doxysearch.cpp deleted file mode 100644 index ebdf223..0000000 --- a/src/doxysearch.cpp +++ /dev/null @@ -1,1080 +0,0 @@ -/****************************************************************************** - * - * - * - * Copyright (C) 1997-2003 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 - * for any purpose. It is provided "as is" without express or implied warranty. - * See the GNU General Public License for more details. - * - * Documents produced by Doxygen are derivative works derived from the - * input used in their production; they are not affected by this license. - * - */ - -// includes - -#ifdef _WIN32 -#include <windows.h> // for AllocConsole -#endif - - -#include <stdio.h> -#include <string.h> -#include <stdarg.h> -#include <stdlib.h> -#include <ctype.h> -#include <sys/stat.h> -#ifdef PROFILING -#include <sys/time.h> -#include <unistd.h> -#endif - -// defines - -#ifndef bool -#define bool int -#endif - -#define MAXSTRLEN 1024 -#ifndef TRUE -#define TRUE 1 -#endif -#ifndef FALSE -#define FALSE 0 -#endif - -#define NORMAL 1 // OR search results -#define INCLUDE 2 // AND search results -#define EXCLUDE 3 // AND NOT search results - -#define TERMMASK (1<<31) -#define OFFSETMASK (~TERMMASK) - -// structs - -//---------------------------------------------------------------------------- - -struct FileInfo -{ - FileInfo() { name[0]='\0'; f=0; url=0; } - ~FileInfo() { if (f) fclose(f); - delete[] url; - } - FILE *f; - char name[MAXSTRLEN]; - int index; - int refOffset; - char *url; - FileInfo *next; -}; - -//---------------------------------------------------------------------------- - -struct FileList -{ - FileList() { first=0; last=0; index=0; } - ~FileList() { FileInfo *fi=first; - while (fi) { FileInfo *ofi=fi; fi=fi->next; delete ofi; } - } - FileInfo *add() - { - FileInfo *nf=new FileInfo; - nf->next=0; - nf->index=index++; - if (last) { last->next=nf; last=nf; } else { first=nf; last=nf; } - return nf; - } - FileInfo *first; - FileInfo *last; - int index; -}; - -//---------------------------------------------------------------------------- - -struct WordInfo -{ - WordInfo() { word=0; } - ~WordInfo() { delete[] word; } - char *word; - int freq; - WordInfo *next; -}; - -//---------------------------------------------------------------------------- - -struct WordList -{ - WordList() { first=0; last=0; } - ~WordList() { WordInfo *wi=first; - while (wi) { WordInfo *owi=wi; wi=wi->next; delete owi; } - } - void add(const char *word,int freq) - { - WordInfo *nw=new WordInfo; - nw->word = new char[strlen(word)+1]; - strcpy(nw->word,word); - nw->freq=freq; - nw->next=0; - if (last) { last->next=nw; last=nw; } else { first=nw; last=nw; } - } - WordInfo *first; - WordInfo *last; -}; - -//---------------------------------------------------------------------------- - -struct SearchDoc -{ - FileInfo *fileInfo; - int index; - int freq; - double rank; - SearchDoc *next; -}; - -//---------------------------------------------------------------------------- - -struct SearchResults -{ - SearchResults() { totalFreq=0; docList=0; last=0; } - ~SearchResults() { SearchDoc *d=docList; - while (d) { SearchDoc *od=d; d=d->next; delete od; } - } - void add(FileInfo *fi,int index,int freq) - { - SearchDoc *nd=new SearchDoc; - nd->fileInfo=fi; - nd->index=index; - nd->freq=freq; - nd->next=0; - if (last) { last->next=nd; last=nd; } else { docList=nd; last=nd; } - } - SearchDoc *docList; - SearchDoc *last; - int totalFreq; -}; - -//---------------------------------------------------------------------------- - -// global vars - -static WordList wordList; -static FileList fileList; -static char cgiBin[MAXSTRLEN]; -static char queryInput[MAXSTRLEN]; -static char encQueryInput[MAXSTRLEN]; -static char firstDocUrl[MAXSTRLEN]; -static bool nameOnly; -static bool wordOnly; -static bool helpOnly; -static int page; -static char *headerBuf=0; -static char *footerBuf=0; - -//---------------------------------------------------------------------------- - -// functions - -void printHeader() -{ - if (headerBuf) - { - printf("Content-Type: text/html\r\n\r\n%s",headerBuf); - } - else - { - printf("Content-Type: text/html\r\n\r\n"); - printf("<html><head><title>Search the documentation</title></head>\n" - "<body bgcolor=\"#ffffff\" text=\"#000000\" link=\"#0000ee\" \n" - "vlink=\"#551a8b\" alink=\"#ff0000\">\n"); - } -} - -//---------------------------------------------------------------------------- - -void printFooter() -{ - if (footerBuf) - { - printf("%s",footerBuf); - } - else - { - printf("</body></html>\n"); - } -} - -//---------------------------------------------------------------------------- - -void message(const char *fmt,...) -{ - printHeader(); - printf("<h2>"); - va_list args; - va_start(args, fmt); - vfprintf(stdout, fmt, args); - va_end(args); - printf("</h2>"); - printFooter(); -} - -//---------------------------------------------------------------------------- - -void printSearchPage(bool open=FALSE) -{ - printf("<form name=doxyform method=GET action=\"%s\">\n" - "<center>\n" - "<input type=hidden name=page value=0>\n" - "<table border=0 bgcolor=\"#ffffcc\" cellspacing=0 cellpadding=4>\n" - " <tr>\n" - " <td valign=top><font size=-1 face=\"arial, helvetica\"><b>" - " Search for\n" - " <select name=which>\n" - " <option value=string %s>strings\n" - " <option value=word %s>words\n" - " </select>\n" - " in function and class\n" - " <select name=what>\n" - " <option value=doc %s>documentation\n" - " <option value=name %s>names</select></b></font>\n" - " </td>\n" - " <td valign=top align=right>\n" - " <a href=\"%s?help=on\"><font size=-1>Help</font></a>\n" - " </td>\n" - " </tr>\n" - " <tr>\n" - " <td><input name=query size=44 wrap=virtual maxlength=1000 value=\"%s\">\n" - " </td>\n" - " <td><input type=image src=\"%s/search.png\" height=26 width=120 border=0 name=\"search\">\n" - " </td>\n" - " </tr>\n", - cgiBin, - (wordOnly?"":"selected"),(wordOnly?"selected":""), - (nameOnly?"":"selected"),(nameOnly?"selected":""), - cgiBin,queryInput,firstDocUrl); - if (!open) - { - printf("</table>\n</center></form>\n"); - } -} - -//---------------------------------------------------------------------------- - -int readInt(FILE *f) -{ - unsigned char c_24 = fgetc(f); - unsigned char c_16 = fgetc(f); - unsigned char c_08 = fgetc(f); - unsigned char c_00 = fgetc(f); - return ((unsigned int)c_24<<24)+ - ((unsigned int)c_16<<16)+ - ((unsigned int)c_08<<8)+ - c_00; - //return (fgetc(f)<<24)+(fgetc(f)<<16)+(fgetc(f)<<8)+fgetc(f); -} - -//---------------------------------------------------------------------------- - -int readEncodedNumber(FILE *f) -{ - int n=0,b,s=0; - do { b=fgetc(f); n|=(b&0x7f)<<s; s+=7; } while (b&0x80); - return n; -} - -void readString(FILE *f,char *s,int n) -{ - int i=0,b; - if (n<=0) return; - while (i<n-1 && (b=fgetc(f))!=0) s[i++]=b; - s[i]='\0'; -} - -//---------------------------------------------------------------------------- - -bool searchRecursive(SearchResults *sr,FileInfo *fi,const char *word) -{ - char entry[MAXSTRLEN]; - readString(fi->f,entry,MAXSTRLEN); - while (entry[0]!='\0') - { - //printf("Found entry `%s'\n",entry); - int i=0, w=word[0], e=entry[0]; - while (w!=0 && e!=0 && w==e) { i++; w=word[i]; e=entry[i]; } - if (w==0 && e!=0) // word is a substring of entry - { - if (wordOnly) return FALSE; // no full word match - //printf("Word found as substring of `%s%s'\n",&word[-index],&entry[i]); - int offset=readInt(fi->f); // <= follow for extensions - if (!(offset&TERMMASK)) // extra info available - { - int tfreq=readEncodedNumber(fi->f); - sr->totalFreq+=tfreq; - //printf("Total frequency %d\n",tfreq); - int s=-1,k; - while ((k=readEncodedNumber(fi->f))!=0) - { - bool inName = (k&2)==2; - s+=(k>>3); - int freq=readEncodedNumber(fi->f); - //printf("Doc index %d frequency %d\n",s,freq); - if (!nameOnly || inName) - //addResult(fi,sr,s,freq); - sr->add(fi,s,freq); - } - } - return TRUE; - } - else if (e==0) // entry is a substring of word - { - if (w==0) // word is equal to entry => exact match found - { - int offset=readInt(fi->f); // <= follow for extensions - if (!(offset&TERMMASK)) // extra info available - { - //printf("Match found\n"); - int tfreq=readEncodedNumber(fi->f); - sr->totalFreq+=tfreq; - //printf("Total frequency %d\n",tfreq); - int s=-1,k; - while ((k=readEncodedNumber(fi->f))!=0) - { - bool fullWord = (k&1)==1; - bool inName = (k&2)==2; - bool wordInName = (k&4)==4; - s+=(k>>3); - int freq=readEncodedNumber(fi->f); - if (nameOnly && wordOnly) - { - if (wordInName) sr->add(fi,s,freq); - } - else if (!nameOnly && wordOnly) - { - if (fullWord) sr->add(fi,s,freq); - } - else if (nameOnly && !wordOnly) - { - if (inName) sr->add(fi,s,freq); - } - else // !nameOnly && !wordOnly - { - sr->add(fi,s,freq); - } - } - } - return TRUE; - } - else // follow branch to next entry - { - int offset=readInt(fi->f); - if ((offset&OFFSETMASK)==0) // no next entry (leaf node) - { - return FALSE; - } - else // follow branch - { - fseek(fi->f,offset&OFFSETMASK,SEEK_SET); - //printf("Recursive call; jump to %lx\n",ftell(f)); - return searchRecursive(sr,fi,&word[i]); - } - } - } - else // skip rest of the entry - { - int offset=readInt(fi->f); - if (!(offset&TERMMASK)) while (readEncodedNumber(fi->f)!=0); - } - readString(fi->f,entry,MAXSTRLEN); - } - //printf("Sorry no match found\n"); - return FALSE; -} - -//---------------------------------------------------------------------------- - - -void searchIndex(const char *word,SearchResults *results) -{ - FileInfo *fi=fileList.first; - while (fi) - { - fi->f = fopen(fi->name, "rb"); - fseek(fi->f,8,SEEK_SET); - searchRecursive(results,fi,word); - fclose(fi->f); - fi->f=0; - fi=fi->next; - } - - SearchDoc *ds = results->docList; - while (ds) - { - ds->rank = ds->freq/(double)results->totalFreq; - ds = ds->next; - } - - wordList.add(word,results->totalFreq); -} - -//---------------------------------------------------------------------------- - -extern "C" int sortResults(const void *a1,const void *a2) -{ - SearchDoc **d1=(SearchDoc **)a1; - SearchDoc **d2=(SearchDoc **)a2; - if ((*d1)->rank > (*d2)->rank) - return -1; - else if ((*d1)->rank == (*d2)->rank) - return 0; - else - return 1; -} - -//---------------------------------------------------------------------------- - -void generateResults(SearchResults *sr) -{ - // compute the maximum rank - SearchDoc *ds = sr->docList; - double maxRank = 0.00000001; - int resultCount=0; - if (ds) - { - while (ds) - { - if (ds->rank>maxRank) maxRank = ds->rank; - ds = ds->next; - } - - // scale ranks, so the highest is 1 and count the number of links - double oneOverMaxRank = 1.0/maxRank; - ds = sr->docList; - while (ds) - { - ds->rank *= oneOverMaxRank; - resultCount++; - ds = ds->next; - } - } - SearchDoc **docPtrArray=0; - if (resultCount>0) - { - docPtrArray=(SearchDoc **)calloc(resultCount,sizeof(SearchDoc *)); - int offset=0; - ds = sr->docList; - while (ds) - { - docPtrArray[offset++]=ds; - ds = ds->next; - } - qsort(docPtrArray,resultCount,sizeof(SearchDoc *),sortResults); - } - - // start generating output - printHeader(); - printSearchPage(TRUE); - - printf(" <tr bgcolor=#ffffff>\n" - " <td colspan=2>" - "<br><h3>Search results</h3>\n" - " </td>\n" - " </tr>\n"); - if (resultCount==0) // nothing found - { - printf(" <tr bgcolor=#ffffff>\n" - " <td colspan=2>Sorry, no documents matching your query.\n" - " </td>\n" - " </tr>\n"); - } - else // something found - { - printf(" <tr bgcolor=#ffffff>\n" - " <td colspan=2>" - "Found <b>%d</b> document%s matching your query. ", - resultCount,resultCount==1?"":"s"); - - if (resultCount>1) - printf("Showing best matches first.\n"); - - printf(" <br><br>\n"); - printf(" </td>\n" - " </tr>\n"); - - const int lpp=20; - int numPages = (resultCount+lpp-1)/lpp; - - // clip page - if (page<0) page=0; - if (page>=numPages) page=numPages-1; - int skipEntries = page * lpp; - int pageEntries = lpp; - - printf(" <tr><td colspan=2 bgcolor=\"#4040c0\">" - "<center><b><font color=\"#ffffff\">Page %d / %d</font></b>" - "</center></td></tr>\n",page+1,numPages); - printf(" <tr bgcolor=#ffffff>\n" - " <td colspan=2>\n" - " <table border=\"0\" cellspacing=\"2\" cellpadding=\"2\">\n"); - int i; - for (i=0 ; i < resultCount && pageEntries > 0; i++) - { - if (skipEntries == 0) - { - SearchDoc *d=docPtrArray[i]; - if (d->fileInfo->f == 0) - { - d->fileInfo->f = fopen(d->fileInfo->name, "rb"); - } - FILE *f=d->fileInfo->f; - fseek(f,d->fileInfo->refOffset+d->index*4,SEEK_SET); - int offset=readInt(f); - fseek(f,offset,SEEK_SET); - char linkName[MAXSTRLEN]; - char htmlName[MAXSTRLEN]; - readString(f,linkName,MAXSTRLEN); - readString(f,htmlName,MAXSTRLEN); - int rank=(int)(d->rank*100+0.5); - if (rank==0) rank++; - printf(" <tr><td align=\"right\"><b><font color=#%2x00%2x>%d</font></b>" - "</td><td><a href=\"%s/%s\">%s</a></td></tr>\n", - rank*2+55, 255-rank*2, rank, - d->fileInfo->url, htmlName, linkName); - pageEntries--; - if (d->fileInfo->f != 0) - { - fclose(d->fileInfo->f); - d->fileInfo->f = 0; - } - } - else - { - skipEntries--; - } - } - printf(" </table>\n" - " </td>\n" - " </tr>\n" - " <tr><td colspan=2 bgcolor=\"#4040c0\"><center> "); - - if (page>0) - { - printf("<a href=\"%s?page=%d&which=%s&what=%s&query=%s\">" - "<font color=\"ffffff\">prev</font></a> ", - cgiBin, page-1, - wordOnly?"word":"doc", - nameOnly?"name":"string", - encQueryInput); - } - int startPage = page-5 < 0 ? 0 : page-5; - int endPage = page+6 > numPages ? numPages : page+5; - if (endPage-startPage>1) - { - for (i=startPage;i<endPage;i++) - { - if (i!=page) - { - printf("<a href=\"%s?page=%d&which=%s&what=%s&query=%s\">" - "<font color=\"ffffff\">%d</font></a> ", - cgiBin, i, - wordOnly?"word":"doc", - nameOnly?"name":"string", - encQueryInput, i+1); - } - else - { - printf("<b><font color=\"ffffff\">%d</font></b></a> ",i+1); - } - } - } - if (page<numPages-1) - { - printf("<a href=\"%s?page=%d&which=%s&what=%s&query=%s\">" - "<font color=\"ffffff\">next</font></a>", - cgiBin, page+1, - wordOnly?"word":"doc", - nameOnly?"name":"string", - encQueryInput); - } - printf(" </center></td></tr>\n" - " <tr bgcolor=#ffffff>\n" - " <td colspan=2><p>\n" - " Occurrence count: "); - WordInfo *wi=wordList.first; - while (wi) - { - printf("<b><font color=#ff0000>%s</font></b> ",wi->word); - if (wi->freq>0) printf("(%d)",wi->freq); else printf("(ignored)"); - wi=wi->next; - if (wi) - { - if (wi->next) printf(", "); else printf(" and "); - } - } - printf("\n" - " </td>\n" - " </tr>\n"); - } - printf("</table>\n</center>\n</form>\n"); - printFooter(); - free(docPtrArray); -} - -//---------------------------------------------------------------------------- - -void generateHelpPage() -{ - printHeader(); - printf("<h3>Doxysearch help page</h3>\n" - "<b>Basic search instructions</b>\n" - "<ul>\n" - "Just type in one or more words or fragments of words and press the " - "search button. Doxysearch will return a list of functions and class names, " - "whose documentation or name matches one or more of the words. " - "Documents containing more matches will appear earlier in the list. " - "\n" - "</ul>\n" - "<b>Search modes</b>\n" - "<ul>\n" - "Doxysearch has four search modes. From least restrictive to most " - "restrictive they are:\n" - " <ul><p>\n" - " <li><em>Search for strings in the documentation:</em>\n" - " The words you type will be searched in the documentation as substrings." - " Typing the word "<b>the</b>" for example, will find " - " documents containing the words "<b>the</b>", " - " "<b>the</b>re", and "fea<b>the</b>r".<p>\n" - " <li><em>Search for words in the documentation:</em>\n" - " The words you type will be searched in the documentation as words." - " Typing the word "<b>the</b>" for example, will look " - " for documents containing the word "<b>the</b>" and not for" - " documents containing the word "<b>the</b>re".<p>\n" - " <li><em>Search for strings in the function and class names:</em>\n" - " The words you type will be searched in the function and class names " - " as substrings. Typing the word "<b>set</b>" for example, will " - " result in a list of links to the documentation of all functions and classes " - " that contain the word "<b>set</b>" in the name, such as the function " - " <code><b>set</b>Cursor</code>.<p>\n" - " <li><em>Search for words in the function and class names:</em>\n" - " The words you type will be matched against the function and class names." - " The result will be a list of links to the documentation of all function " - " and class names that are equal to one of the words.\n" - " </ul>\n" - "</ul>\n" - "<b>Requiring/Excluding words</b>\n" - "<ul>\n" - " Often you will know a word that will be guaranteed to appear in a document " - " for which you are searching. If this is the case, require that the word appears " - " in all of the results by attaching a "<b>+</b>" to the beginning of " - " the word. You can quickly reject results by adding a word that appears only " - " in unwanted documents with a "<b>-</b>" before it." - "</ul>\n" - ); - - printFooter(); -} - -//---------------------------------------------------------------------------- - -void mergeSearchResults(SearchResults *totalResults, - SearchResults *sr,int mode) -{ - SearchDoc *otd = 0, - *td = totalResults->docList, - *d = sr->docList; - totalResults->totalFreq += sr->totalFreq; - if (!d) return; // nothing to add - while (td && d) - { - int otdih = otd ? otd->fileInfo->index : -1, - otdil = otd ? otd->index : -1, - tdih = td->fileInfo->index, - tdil = td->index, - dih = d->fileInfo->index, - dil = d->index; - if (tdih==dih && tdil==dil) // combine results - { - if (mode != EXCLUDE) - { - td->rank += d->rank; - td->rank *= 2; // put extra emphasis on multiple word matches - td->freq += d->freq; - d = d->next; - otd = td; td = td->next; - } - else // mode == EXCLUDE => remove entry from results - { - SearchDoc *tmp=td; - td=td->next; - if (otd) otd->next=td; else totalResults->docList = td; - delete tmp; - } - } - else if ((otdih<dih || (otdih==dih && otdil<dil)) && - (tdih>dih || (tdih==dih && tdil>dil))) // insert - { - if (mode == NORMAL) - { - SearchDoc *nd = new SearchDoc(*d); - if (otd) otd->next = nd; else totalResults->docList = nd; - nd->next = td; - td = nd; - } - d = d->next; - } - else if (tdih<dih || (tdih==dih && tdil<dil)) // remove or skip - { - if (mode == INCLUDE) - { - SearchDoc *tmp=td; - td=td->next; - if (otd) otd->next=td; else totalResults->docList = td; - delete tmp; - } - else // mode == EXCLUDE or mode == NORMAL - { - otd = td; td = td->next; - } - } - } - if (td==0 && d && mode==NORMAL) // append rest of sr to totalResults - { - while (d) - { - SearchDoc *nd = new SearchDoc(*d); - if (otd) otd->next = nd; else totalResults->docList = nd; - nd->next = 0; - d = d->next; - otd = nd; - } - } - if (td && d==0 && mode==INCLUDE) // delete the rest of the results - { - while (td) - { - SearchDoc *tmp=td; - td=td->next; - if (otd) otd->next = td; else totalResults->docList = td; - delete tmp; - } - } -} - -//---------------------------------------------------------------------------- - -int asciiToHex(char c) -{ - char l=tolower(c); - if (l>='0' && l<='9') - return l-'0'; - else if (l>='a' && l<='f') - return l+10-'a'; - else // invalid hex char - return 0; -} - -//---------------------------------------------------------------------------- - -void fileToBuf(const char *name, char **buf) -{ - FILE *f; - struct stat file_stats; - if ((f=fopen(name,"rb"))==NULL) return; - if (stat(name,&file_stats)==-1) - { - message("Error: could not fstat file %s\n",name); - exit(1); - } - unsigned int len=file_stats.st_size; - if ((*buf=(char *)malloc(len+1))==NULL) - { - message("Error: out of memory\n"); - exit(1); - } - if (fread(*buf,1,len,f)!=len) - { - message("Error: could not read file %s\n",name); - exit(1); - } - (*buf)[len]='\0'; - fclose(f); -} - -//---------------------------------------------------------------------------- - -void getConfig(const char *s) -{ - int l; - char configFile[MAXSTRLEN]; - strcpy(configFile,s); -#if defined(_WIN32) - strcat(configFile,"\\search.cfg"); -#else - strcat(configFile,"/search.cfg"); -#endif - - FILE *f; - if ((f=fopen(configFile,"r"))==NULL) - { - message("Error: could not open config file %s\n",configFile); - exit(1); - } - - // get the URL to the documentation - fgets(firstDocUrl,MAXSTRLEN,f); - l=strlen(firstDocUrl)-1; - if (firstDocUrl[l]=='\n') firstDocUrl[l]='\0'; - l=strlen(firstDocUrl); - if (firstDocUrl[l]=='/') firstDocUrl[l]='\0'; - - // get the URL to the cgi script - fgets(cgiBin,MAXSTRLEN,f); - l=strlen(cgiBin)-1; - if (cgiBin[l]=='\n') cgiBin[l]='\0'; - - fclose(f); - - char headerFile[MAXSTRLEN]; - strcpy(headerFile,s); -#if defined(_WIN32) - strcat(headerFile,"\\header.html"); -#else - strcat(headerFile,"/header.html"); -#endif - fileToBuf(headerFile,&headerBuf); - - char footerFile[MAXSTRLEN]; - strcpy(footerFile,s); -#if defined(_WIN32) - strcat(footerFile,"\\footer.html"); -#else - strcat(footerFile,"/footer.html"); -#endif - fileToBuf(footerFile,&footerBuf); - -} - -//---------------------------------------------------------------------------- -// copy and convert string to lower case - -void strlowercpy(char *d,const char *s) -{ - while (*s!='\0') *d++=tolower(*s++); *d='\0'; -} - -//---------------------------------------------------------------------------- - -int main(int argc,char **argv) -{ -#ifdef _WIN32 - AllocConsole(); -#endif - -#ifdef PROFILING - struct timeval tv_start,tv_end; - gettimeofday(&tv_start,0); -#endif - char *argString=getenv("QUERY_STRING"); - if (argc==1) - { - message("Error: invalid number of arguments. " - "Usage: %s doc_path [doc_path ...]",argv[0]); - exit(1); - } - // read the configuration file for this instance of the search engine - getConfig(argv[1]); - - if (!argString) - { - printHeader(); - printSearchPage(); - printFooter(); - exit(1); - } - - SearchResults tsr; - - // parse cgi arguments - char *arg=strtok(argString,"&"); - char *query = 0; - char *what = 0; - char *which = 0; - char *help = 0; - page = 0; - while (arg) - { - int namelen=strcspn(arg,"="); - if (!strncmp(arg,"query", namelen)) query = &arg[namelen+1]; - else if (!strncmp(arg,"what", namelen)) what = &arg[namelen+1]; - else if (!strncmp(arg,"which", namelen)) which = &arg[namelen+1]; - else if (!strncmp(arg,"help", namelen)) help = &arg[namelen+1]; - else if (!strncmp(arg,"page", namelen)) page = atoi(&arg[namelen+1]); - arg=strtok(0,"&"); - } - - wordOnly=which ? strcmp(which,"word")==0 : FALSE; - nameOnly=what ? strcmp(what, "name")==0 : FALSE; - helpOnly=help ? strcmp(help, "on" )==0 : FALSE; - - // store encoded query string - if (query) strcpy(encQueryInput,query); else encQueryInput[0]='\0'; - - // convert query string to original input - char *s=query,*d=queryInput; - if (s) - { - while (*s!='\0') - { - char c=*s++; - if (c=='+') - *d++=' '; - else if (c=='%') - { - *d=asciiToHex(*s++)*16; - *d+=asciiToHex(*s++); - d++; - } - else - *d++=c; - } - } - *d='\0'; - - if (helpOnly) - { - generateHelpPage(); - exit(1); - } - - // read search index files - int argIndex=0; - for (argIndex=1;argIndex<argc;argIndex++) - { - char configFile[MAXSTRLEN]; - strcpy(configFile,argv[argIndex]); -#if defined(_WIN32) - strcat(configFile,"\\search.cfg"); -#else - strcat(configFile,"/search.cfg"); -#endif - - char indexFile[MAXSTRLEN]; - strcpy(indexFile,argv[argIndex]); -#if defined(_WIN32) - strcat(indexFile,"\\search.idx"); -#else - strcat(indexFile,"/search.idx"); -#endif - - FileInfo *fi=fileList.add(); - FILE *g; - - strcpy(fi->name,indexFile); - if ((fi->f=fopen(indexFile,"rb"))==NULL) - { - message("Error: could not open index file %s\n",indexFile); - exit(1); - } - if ((g=fopen(configFile,"r"))==NULL) - { - message("Error: could not open config file %s\n",configFile); - exit(1); - } - - // get URL to the documentation - char tmp[MAXSTRLEN]; - fgets(tmp,MAXSTRLEN,g); - if (tmp[strlen(tmp)-1]=='\n') tmp[strlen(tmp)-1]='\0'; - if (tmp[strlen(tmp)-1]=='/') tmp[strlen(tmp)-1]='\0'; - fi->url = new char[strlen(tmp)+1]; - strcpy(fi->url,tmp); - fclose(g); - - // read & check the format of the search index file - fseek(fi->f,0,SEEK_SET); - char header[5]; - if (fread(header,1,4,fi->f)!=4) - { - message("Error: Couldn't read header of the index file %s\n",indexFile); - exit(1); - } - header[4]='\0'; - if (strcmp(header,"DOXI")) - { - message("Error: Index file %s has an unknown format\n",indexFile); - exit(1); - } - // read and store the offset to the link index - fi->refOffset=readInt(fi->f); - fclose(fi->f); - fi->f = 0; - } - - char *word; - char wordString[MAXSTRLEN]; - - // search for included words - strlowercpy(wordString,queryInput); - word=strtok(wordString," "); - bool first=TRUE; - while (word) - { - if (word[0]=='+') // + character => include - { - SearchResults sr; - searchIndex(&word[1],&sr); - if (first) - mergeSearchResults(&tsr,&sr,NORMAL); - else - mergeSearchResults(&tsr,&sr,INCLUDE); - first=FALSE; - } - word=strtok(0," "); - } - - // search for normal words - strlowercpy(wordString,queryInput); - word=strtok(wordString," "); - while (word) - { - if (word[0]!='-' && word[0]!='+') // normal word - { - SearchResults sr; - searchIndex(word,&sr); - mergeSearchResults(&tsr,&sr,NORMAL); - } - word=strtok(0," "); - } - - // search for excluded words - strlowercpy(wordString,queryInput); - word=strtok(wordString," "); - while (word) - { - if (word[0]=='-') // - character => exclude - { - SearchResults sr; - searchIndex(&word[1],&sr); - mergeSearchResults(&tsr,&sr,EXCLUDE); - } - word=strtok(0," "); - } - - // write results to HTML page - generateResults(&tsr); - - free(headerBuf); - free(footerBuf); - -#ifdef PROFILING - gettimeofday(&tv_end,0); - printf("processing time %3.3f msec\n", - ((tv_end.tv_sec-tv_start.tv_sec)*1000000+ - tv_end.tv_usec-tv_start.tv_usec)/1000.0 - ); -#endif - return 0; -} diff --git a/src/doxysearch.pro.in b/src/doxysearch.pro.in deleted file mode 100644 index 07865cd..0000000 --- a/src/doxysearch.pro.in +++ /dev/null @@ -1,20 +0,0 @@ -# -# -# -# Copyright (C) 1997-2003 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 -# for any purpose. It is provided "as is" without express or implied warranty. -# See the GNU General Public License for more details. -# -# Documents produced by Doxygen are derivative works derived from the -# input used in their production; they are not affected by this license. - -TEMPLATE = app.t -CONFIG = console warn_on $extraopts -SOURCES = doxysearch.cpp -TARGET = ../bin/doxysearch -OBJECTS_DIR = ../objects -win32-g++:TMAKE_CXXFLAGS += -fno-exceptions -fno-rtti diff --git a/src/doxytag.l b/src/doxytag.l index d5a3edc..91dfac5 100644 --- a/src/doxytag.l +++ b/src/doxytag.l @@ -32,8 +32,8 @@ #include <qdir.h> #include "version.h" -#include "suffixtree.h" -#include "searchindex.h" +//#include "suffixtree.h" +//#include "searchindex.h" #include "logos.h" static QCString convertToXML(const char *s) @@ -95,7 +95,7 @@ static QCString docBaseLink; static QCString docAnchor; static QCString docRefName; static bool nameBug; -static SearchIndex searchIndex; +//static SearchIndex searchIndex; #define YY_NEVER_INTERACTIVE 1 @@ -162,14 +162,14 @@ static void addReference() { //printf("addReference() key: %s ref:%s\n", // docRefName.data(),(docBaseLink+"#"+docAnchor).data()); - if (genIndex && !docRefName.isEmpty() && !docBaseLink.isEmpty()) - { - if (docAnchor.isEmpty()) - searchIndex.addReference(docRefName,docBaseLink); - else - searchIndex.addReference(docRefName,docBaseLink+"#"+docAnchor); - searchIndex.addWord(docRefName,docRefName,TRUE); - } + //if (genIndex && !docRefName.isEmpty() && !docBaseLink.isEmpty()) + //{ + // if (docAnchor.isEmpty()) + // searchIndex.addReference(docRefName,docBaseLink); + // else + // searchIndex.addReference(docRefName,docBaseLink+"#"+docAnchor); + // searchIndex.addWord(docRefName,docRefName,TRUE); + //} } QCString unhtmlify(const char *str) @@ -247,10 +247,10 @@ QCString unhtmlify(const char *str) //printf("tag: %s#%s ref: %s word: `%s'\n", // docBaseLink.data(),docAnchor.data(), // docRefName.data(),yytext); - if (genIndex && !docRefName.isEmpty() && yyleng>2) - searchIndex.addWord(docRefName, - yytext,FALSE - ); + //if (genIndex && !docRefName.isEmpty() && yyleng>2) + // searchIndex.addWord(docRefName, + // yytext,FALSE + // ); } <SkipPreformated>"</pre>" { BEGIN( Start ); @@ -458,8 +458,8 @@ void parseFile(QFileInfo &fi) QCString input(fi.size()+1); docBaseLink=fi.fileName(); docRefName=fi.fileName().copy(); - searchIndex.addReference(docRefName,docBaseLink); - searchIndex.addWord(docRefName,docRefName,TRUE); + //searchIndex.addReference(docRefName,docBaseLink); + //searchIndex.addWord(docRefName,docRefName,TRUE); f.readBlock(input.data(),fi.size()); input.at(fi.size())='\0'; parse(input); @@ -584,46 +584,48 @@ int main(int argc,char **argv) } if (genIndex) { - //printf("Writing search index\n"); - if (!searchIndex.saveIndex(indexName)) - { - fprintf(stderr,"Error: Could not write search index\n"); - } - QFileInfo fi(indexName); - if (fi.exists()) - { - QCString dir=convertToQCString(fi.dir().absPath()); - fi.setFile(dir+"/search.png"); - if (!fi.exists()) writeSearchButton(dir); - fi.setFile(dir+"/doxygen.png"); - if (!fi.exists()) writeLogo(dir); - fi.setFile(dir+"/search.cgi"); - if (!fi.exists()) - { - QFile f; - f.setName(dir+"/search.cgi"); - if (f.open(IO_WriteOnly)) - { - QTextStream t(&f); - t << "#!/bin/sh" << endl - << "DOXYSEARCH=" << endl - << "DOXYPATH=" << endl - << "if [ -f $DOXYSEARCH ]" << endl - << "then" << endl - << " $DOXYSEARCH $DOXYPATH" << endl - << "else" << endl - << " echo \"Content-Type: text/html\"" << endl - << " echo \"\"" << endl - << " echo \"<H1>Error: $DOXYSEARCH not found. Check cgi script!\"" << endl - << "fi" << endl; - f.close(); - } - else - { - fprintf(stderr,"Error: could not open file %s for writing\n",(dir+"/search.cgi").data()); - } - } - } + fprintf(stderr,"Error: doxytag cannot be used to generate a search index anymore.\n" + "This functionality has been integrated into doxygen.\n"); +// printf("Writing search index\n"); +// if (!searchIndex.saveIndex(indexName)) +// { +// fprintf(stderr,"Error: Could not write search index\n"); +// } +// QFileInfo fi(indexName); +// if (fi.exists()) +// { +// QCString dir=convertToQCString(fi.dir().absPath()); +// fi.setFile(dir+"/search.png"); +// if (!fi.exists()) writeSearchButton(dir); +// fi.setFile(dir+"/doxygen.png"); +// if (!fi.exists()) writeLogo(dir); +// fi.setFile(dir+"/search.cgi"); +// if (!fi.exists()) +// { +// QFile f; +// f.setName(dir+"/search.cgi"); +// if (f.open(IO_WriteOnly)) +// { +// QTextStream t(&f); +// t << "#!/bin/sh" << endl +// << "DOXYSEARCH=" << endl +// << "DOXYPATH=" << endl +// << "if [ -f $DOXYSEARCH ]" << endl +// << "then" << endl +// << " $DOXYSEARCH $DOXYPATH" << endl +// << "else" << endl +// << " echo \"Content-Type: text/html\"" << endl +// << " echo \"\"" << endl +// << " echo \"<H1>Error: $DOXYSEARCH not found. Check cgi script!\"" << endl +// << "fi" << endl; +// f.close(); +// } +// else +// { +// fprintf(stderr,"Error: could not open file %s for writing\n",(dir+"/search.cgi").data()); +// } +// } +// } } if (genTag) { diff --git a/src/doxytag.pro.in b/src/doxytag.pro.in index 6900938..820c094 100644 --- a/src/doxytag.pro.in +++ b/src/doxytag.pro.in @@ -16,9 +16,8 @@ TEMPLATE = doxytag.t CONFIG = console warn_on $extraopts -HEADERS = suffixtree.h searchindex.h logos.h version.h -SOURCES = doxytag.cpp suffixtree.cpp searchindex.cpp \ - logos.cpp version.cpp +HEADERS = logos.h version.h +SOURCES = doxytag.cpp logos.cpp version.cpp unix:LIBS += -L../lib -lqtools win32:INCLUDEPATH += . win32-mingw:LIBS += -L../lib -lqtools diff --git a/src/entry.h b/src/entry.h index 594a3c8..ef50658 100644 --- a/src/entry.h +++ b/src/entry.h @@ -135,9 +135,9 @@ struct Grouping { GROUPING_LOWEST, GROUPING_AUTO_WEAK = - GROUPING_LOWEST, //!< membership in group was defined via \@weakgroup \@{ \@} - GROUPING_AUTO_ADD, //!< membership in group was defined via \@add[to]group \@{ \@} - GROUPING_AUTO_DEF, //!< membership in group was defined via \@defgroup \@{ \@} + GROUPING_LOWEST, //!< membership in group was defined via \@weakgroup + GROUPING_AUTO_ADD, //!< membership in group was defined via \@add[to]group + GROUPING_AUTO_DEF, //!< membership in group was defined via \@defgroup GROUPING_AUTO_HIGHEST = GROUPING_AUTO_DEF, GROUPING_INGROUP, //!< membership in group was defined by \@ingroup GROUPING_HIGHEST = GROUPING_INGROUP diff --git a/src/filedef.cpp b/src/filedef.cpp index 0e9104e..0278688 100644 --- a/src/filedef.cpp +++ b/src/filedef.cpp @@ -30,6 +30,7 @@ #include "message.h" #include "code.h" #include "docparser.h" +#include "ftvhelp.h" //#include "xml.h" class DevNullCodeDocInterface : public BaseCodeDocInterface @@ -159,7 +160,7 @@ void FileDef::writeDetailedDocumentation(OutputList &ol) ol.endGroupHeader(); if (!briefDescription().isEmpty() && Config_getBool("REPEAT_BRIEF")) { - ol.parseDoc(briefFile(),briefLine(),0,0,briefDescription(),FALSE); + ol.parseDoc(briefFile(),briefLine(),this,0,briefDescription(),FALSE,FALSE); } if (!briefDescription().isEmpty() && Config_getBool("REPEAT_BRIEF") && !documentation().isEmpty()) @@ -176,7 +177,7 @@ void FileDef::writeDetailedDocumentation(OutputList &ol) { //if (doc.at(dl-1)!='.' && doc.at(dl-1)!='!' && doc.at(dl-1)!='?') // doc+='.'; - ol.parseDoc(docFile(),docLine(),0,0,documentation()+"\n",FALSE); + ol.parseDoc(docFile(),docLine(),this,0,documentation()+"\n",TRUE,FALSE); } //printf("Writing source ref for file %s\n",name().data()); if (Config_getBool("SOURCE_BROWSER")) @@ -237,7 +238,7 @@ void FileDef::writeDocumentation(OutputList &ol) } else if (briefDescription()) { - ol.parseDoc(briefFile(),briefLine(),0,0,briefDescription(),FALSE); + ol.parseDoc(briefFile(),briefLine(),this,0,briefDescription(),TRUE,FALSE); ol.writeString(" \n"); ol.disableAllBut(OutputGenerator::Html); ol.startTextLink(0,"_details"); @@ -779,3 +780,217 @@ void FileDef::addListReferences() docVarMembers.addListReferences(this); } +//------------------------------------------------------------------- + +static int findMatchingPart(const QCString &path,const QCString dir) +{ + int si1; + int pos1=0,pos2=0; + while ((si1=path.find('/',pos1))!=-1) + { + int si2=dir.find('/',pos2); + //printf(" found slash at pos %d in path %d: %s<->%s\n",si1,si2, + // path.mid(pos1,si1-pos2).data(),dir.mid(pos2).data()); + if (si2==-1 && path.mid(pos1,si1-pos2)==dir.mid(pos2)) // match at end + { + return dir.length(); + } + if (si1!=si2 || path.mid(pos1,si1-pos2)!=dir.mid(pos2,si2-pos2)) // no match in middle + { + return QMAX(pos1-1,0); + } + pos1=si1+1; + pos2=si2+1; + } + return 0; +} + +static Directory *findDirNode(Directory *root,const QCString &name) +{ + QListIterator<DirEntry> dli(root->children()); + DirEntry *de; + for (dli.toFirst();(de=dli.current());++dli) + { + if (de->kind()==DirEntry::Dir) + { + Directory *dir = (Directory *)de; + QCString dirName=dir->name(); + int sp=findMatchingPart(name,dirName); + //printf("findMatchingPart(%s,%s)=%d\n",name.data(),dirName.data(),sp); + if (sp>0) // match found + { + if ((uint)sp==dirName.length()) // whole directory matches + { + // recurse into the directory + return findDirNode(dir,name.mid(dirName.length()+1)); + } + else // partial match => we need to split the path into three parts + { + QCString baseName =dirName.left(sp); + QCString oldBranchName=dirName.mid(sp+1); + QCString newBranchName=name.mid(sp+1); + // strip file name from path + int newIndex=newBranchName.findRev('/'); + if (newIndex>0) newBranchName=newBranchName.left(newIndex); + + //printf("Splitting off part in new branch \n" + // "base=%s old=%s new=%s\n", + // baseName.data(), + // oldBranchName.data(), + // newBranchName.data() + // ); + Directory *base = new Directory(root,baseName); + Directory *newBranch = new Directory(base,newBranchName); + dir->reParent(base); + dir->rename(oldBranchName); + base->addChild(dir); + base->addChild(newBranch); + dir->setLast(FALSE); + // remove DirEntry container from list (without deleting it) + root->children().setAutoDelete(FALSE); + root->children().removeRef(dir); + root->children().setAutoDelete(TRUE); + // add new branch to the root + if (!root->children().isEmpty()) + { + root->children().last()->setLast(FALSE); + } + root->addChild(base); + return newBranch; + } + } + } + } + int si=name.findRev('/'); + if (si==-1) // no subdir + { + return root; // put the file under the root node. + } + else // need to create a subdir + { + QCString baseName = name.left(si); + //printf("new subdir %s\n",baseName.data()); + Directory *newBranch = new Directory(root,baseName); + if (!root->children().isEmpty()) + { + root->children().last()->setLast(FALSE); + } + root->addChild(newBranch); + return newBranch; + } +} + +static void mergeFileDef(Directory *root,FileDef *fd) +{ + QCString rootPath = root->name(); + QCString filePath = fd->absFilePath(); + //printf("merging %s\n",filePath.data()); + Directory *dirNode = findDirNode(root,filePath); + if (!dirNode->children().isEmpty()) + { + dirNode->children().last()->setLast(FALSE); + } + DirEntry *e=new DirEntry(dirNode,fd); + dirNode->addChild(e); +} + +static void generateIndent(QTextStream &t,DirEntry *de,int level) +{ + if (de->parent()) + { + generateIndent(t,de->parent(),level+1); + } + // from the root up to node n do... + if (level==0) // item before a dir or document + { + if (de->isLast()) + { + if (de->kind()==DirEntry::Dir) + { + t << "<img " << FTV_IMGATTRIBS(plastnode) << "/>"; + } + else + { + t << "<img " << FTV_IMGATTRIBS(lastnode) << "/>"; + } + } + else + { + if (de->kind()==DirEntry::Dir) + { + t << "<img " << FTV_IMGATTRIBS(pnode) << "/>"; + } + else + { + t << "<img " << FTV_IMGATTRIBS(node) << "/>"; + } + } + } + else // item at another level + { + if (de->isLast()) + { + t << "<img " << FTV_IMGATTRIBS(blank) << "/>"; + } + else + { + t << "<img " << FTV_IMGATTRIBS(vertline) << "/>"; + } + } +} + + +static void writeDirTreeNode(QTextStream &t,Directory *root,int level) +{ + QCString indent; + indent.fill(' ',level*2); + QListIterator<DirEntry> dli(root->children()); + DirEntry *de; + for (dli.toFirst();(de=dli.current());++dli) + { + t << indent << "<p>"; + generateIndent(t,de,0); + if (de->kind()==DirEntry::Dir) + { + Directory *dir=(Directory *)de; + //printf("%s [dir]: %s (last=%d,dir=%d)\n",indent.data(),dir->name().data(),dir->isLast(),dir->kind()==DirEntry::Dir); + t << "<img " << FTV_IMGATTRIBS(folderclosed) << "/>"; + t << dir->name(); + t << "</p>\n"; + t << indent << "<div>\n"; + writeDirTreeNode(t,dir,level+1); + t << indent << "</div>\n"; + } + else + { + //printf("%s [file]: %s (last=%d,dir=%d)\n",indent.data(),de->file()->name().data(),de->isLast(),de->kind()==DirEntry::Dir); + t << "<img " << FTV_IMGATTRIBS(doc) << "/>"; + t << de->file()->name(); + t << "</p>\n"; + } + } +} + +void generateFileTree(QTextStream &t) +{ + FTVHelp::generateTreeViewImages(); + + Directory *root=new Directory(0,""); + root->setLast(TRUE); + FileNameListIterator fnli(Doxygen::inputNameList); + FileName *fn; + for (fnli.toFirst();(fn=fnli.current());++fnli) + { + FileNameIterator fni(*fn); + FileDef *fd; + for (;(fd=fni.current());++fni) + { + mergeFileDef(root,fd); + } + } + t << "<div class=\"directory\">\n"; + writeDirTreeNode(t,root,0); + t << "</div>\n"; + delete root; +} + diff --git a/src/filedef.h b/src/filedef.h index 13b3b2c..d0e7c02 100644 --- a/src/filedef.h +++ b/src/filedef.h @@ -241,4 +241,51 @@ class OutputNameDict : public QDict<FileList> ~OutputNameDict() {} }; +class Directory; + +class DirEntry +{ + public: + enum EntryKind { Dir, File }; + DirEntry::DirEntry(DirEntry *parent,FileDef *fd) + : m_parent(parent), m_kind(File), m_fd(fd), m_isLast(FALSE) { } + DirEntry::DirEntry(DirEntry *parent) + : m_parent(parent), m_kind(Dir), m_fd(0), m_isLast(FALSE) { } + virtual ~DirEntry() { } + EntryKind kind() const { return m_kind; } + FileDef *file() const { return m_fd; } + bool isLast() const { return m_isLast; } + void setLast(bool b) { m_isLast=b; } + DirEntry *parent() const { return m_parent; } + + protected: + DirEntry *m_parent; + private: + EntryKind m_kind; + FileDef *m_fd; + int num; + bool m_isLast; +}; + +class Directory : public DirEntry +{ + public: + Directory(Directory *parent,const QCString &name) + : DirEntry(parent), m_name(name) + { m_children.setAutoDelete(TRUE); } + virtual ~Directory() {} + void addChild(DirEntry *d) { m_children.append(d); d->setLast(TRUE); } + QList<DirEntry> &children() { return m_children; } + void rename(const QCString &name) { m_name=name; } + void reParent(Directory *parent) { m_parent=parent; } + QCString name() const { return m_name; } + + private: + QCString m_name; + QList<DirEntry> m_children; +}; + +void generateFileTree(QTextStream &t); + #endif + diff --git a/src/ftvhelp.cpp b/src/ftvhelp.cpp index f196253..941808d 100644 --- a/src/ftvhelp.cpp +++ b/src/ftvhelp.cpp @@ -291,65 +291,23 @@ unsigned char ftv2vertline_png[] = { }; -struct ImageInfo -{ - const char *alt; - const char *name; - const unsigned char *data; - unsigned int len; - unsigned short width, height; -} image_info[] = +FTVImageInfo image_info[] = { { " ", "ftv2blank.png",ftv2blank_png,174,16,22 }, -#define FTVIMG_blank 0 - - { "*", "ftv2doc.png",ftv2doc_png,255,24,22 }, -#define FTVIMG_doc 1 - - { "+", "ftv2folderclosed.png",ftv2folderclosed_png,259,24,22 }, -#define FTVIMG_folderclosed 2 - - { "-", "ftv2folderopen.png",ftv2folderopen_png,261,24,22 }, -#define FTVIMG_folderopen 3 - + { "*", "ftv2doc.png",ftv2doc_png,255,24,22 }, + { "+", "ftv2folderclosed.png",ftv2folderclosed_png,259,24,22 }, + { "-", "ftv2folderopen.png",ftv2folderopen_png,261,24,22 }, { "\\", "ftv2lastnode.png",ftv2lastnode_png,233,16,22 }, -#define FTVIMG_lastnode 4 - - { "-", "ftv2link.png",ftv2link_png,358,24,22 }, -#define FTVIMG_link 5 - + { "-", "ftv2link.png",ftv2link_png,358,24,22 }, { "\\", "ftv2mlastnode.png",ftv2mlastnode_png,160,16,22 }, -#define FTVIMG_mlastnode 6 - - { "o", "ftv2mnode.png",ftv2mnode_png,194,16,22 }, -#define FTVIMG_mnode 7 - - { "o", "ftv2node.png",ftv2node_png,235,16,22 }, -#define FTVIMG_node 8 - + { "o", "ftv2mnode.png",ftv2mnode_png,194,16,22 }, + { "o", "ftv2node.png",ftv2node_png,235,16,22 }, { "\\", "ftv2plastnode.png",ftv2plastnode_png,165,16,22 }, -#define FTVIMG_plastnode 9 - - { "o", "ftv2pnode.png",ftv2pnode_png,200,16,22 }, -#define FTVIMG_pnode 10 - - { "|", "ftv2vertline.png",ftv2vertline_png,229,16,22 }, -#define FTVIMG_vertline 11 - + { "o", "ftv2pnode.png",ftv2pnode_png,200,16,22 }, + { "|", "ftv2vertline.png",ftv2vertline_png,229,16,22 }, { 0,0,0,0,0,0 } -#define FTVIMG_UNUSED 12 }; -#define _S(nym) #nym -#define FTV_ICON_FILE(nym) "ftv2" _S(nym) ".png" -#define FTVIMG_INDEX(nym) FTVIMG_ ## nym -#define _INFO(nym) ( image_info[FTVIMG_INDEX(nym)] ) -#define IMG_PREAMBLE(nym) \ - "<img src=\"" FTV_ICON_FILE(nym) "\" " \ - "alt=\"" << _INFO(nym).alt << "\" " \ - "width=" << _INFO(nym).width << " " \ - "height=" << _INFO(nym).height << " " - struct FTVNode { FTVNode(bool dir,const char *r,const char *f,const char *a,const char *n) @@ -410,11 +368,7 @@ void FTVHelp::initialize() */ void FTVHelp::finalize() { - //m_cts.unsetDevice(); - //m_cf->close(); - //delete m_cf; generateTreeView(); - //generateFolderTreeViewData(); } /*! Increase the level of the contents hierarchy. @@ -496,22 +450,22 @@ void FTVHelp::generateIndent(QTextStream &t, FTVNode *n,int level) { if (n->isDir) { - t << IMG_PREAMBLE(plastnode) << "onclick=\"toggleFolder('folder" << folderId << "', this)\"/>"; + t << "<img " << FTV_IMGATTRIBS(plastnode) << "onclick=\"toggleFolder('folder" << folderId << "', this)\"/>"; } else { - t << IMG_PREAMBLE(lastnode) << "/>"; + t << "<img " << FTV_IMGATTRIBS(lastnode) << "/>"; } } else { if (n->isDir) { - t << IMG_PREAMBLE(pnode) << "onclick=\"toggleFolder('folder" << folderId << "', this)\"/>"; + t << "<img " << FTV_IMGATTRIBS(pnode) << "onclick=\"toggleFolder('folder" << folderId << "', this)\"/>"; } else { - t << IMG_PREAMBLE(node) << "/>"; + t << "<img " << FTV_IMGATTRIBS(node) << "/>"; } } } @@ -519,11 +473,11 @@ void FTVHelp::generateIndent(QTextStream &t, FTVNode *n,int level) { if (n->isLast) { - t << IMG_PREAMBLE(blank) << "/>"; + t << "<img " << FTV_IMGATTRIBS(blank) << "/>"; } else { - t << IMG_PREAMBLE(vertline) << "/>"; + t << "<img " << FTV_IMGATTRIBS(vertline) << "/>"; } } } @@ -579,7 +533,7 @@ void FTVHelp::generateTree(QTextStream &t, const QList<FTVNode> &nl,int level) generateIndent(t,n,0); if (n->isDir) { - t << IMG_PREAMBLE(folderclosed) << "onclick=\"toggleFolder('folder" << folderId << "', this)\"/>"; + t << "<img " << FTV_IMGATTRIBS(folderclosed) << "onclick=\"toggleFolder('folder" << folderId << "', this)\"/>"; generateLink(t,n); t << "</p>\n"; t << spaces << "<div id=\"folder" << folderId << "\">\n"; @@ -589,13 +543,38 @@ void FTVHelp::generateTree(QTextStream &t, const QList<FTVNode> &nl,int level) } else { - t << IMG_PREAMBLE(doc) << "/>"; + t << "<img " << FTV_IMGATTRIBS(doc) << "/>"; generateLink(t,n); t << "</p>\n"; } } } +void FTVHelp::generateTreeViewImages() +{ + static bool done=FALSE; + if (done) return; + done=TRUE; + + // Generate tree view images + FTVImageInfo *p = image_info; + while (p->name) + { + QCString fileName=Config_getString("HTML_OUTPUT")+"/"+p->name; + QFile f(fileName); + if (f.open(IO_WriteOnly)) + { + f.writeBlock((char *)p->data,p->len); + } + else + { + fprintf(stderr,"Warning: Cannot open file %s for writing\n",fileName.data()); + } + f.close(); + p++; + } +} + void FTVHelp::generateTreeView() { // Generate alternative index.html as a frame @@ -792,21 +771,7 @@ void FTVHelp::generateTreeView() t << " </body>\n"; t << "</html>\n"; } + generateTreeViewImages(); - // Generate tree view images - ImageInfo *p = image_info; - while (p->name) - { - QCString fileName=Config_getString("HTML_OUTPUT")+"/"+p->name; - QFile f(fileName); - if (f.open(IO_WriteOnly)) - f.writeBlock((char *)p->data,p->len); - else - { - fprintf(stderr,"Warning: Cannot open file %s for writing\n",fileName.data()); - } - f.close(); - p++; - } } diff --git a/src/ftvhelp.h b/src/ftvhelp.h index 3bcd7b9..8fdca6a 100644 --- a/src/ftvhelp.h +++ b/src/ftvhelp.h @@ -18,10 +18,41 @@ class QFile; struct FTVNode; -/*! A class that generated the FTV Help specific file. - * This file is used in conjunction with additional FTV web browser code - * that can be obtained from: - * http://www.geocities.com/Paris/LeftBank/2178/ftexample.html +struct FTVImageInfo +{ + const char *alt; + const char *name; + const unsigned char *data; + unsigned int len; + unsigned short width, height; +}; + +extern FTVImageInfo image_info[]; + +#define FTVIMG_blank 0 +#define FTVIMG_doc 1 +#define FTVIMG_folderclosed 2 +#define FTVIMG_folderopen 3 +#define FTVIMG_lastnode 4 +#define FTVIMG_link 5 +#define FTVIMG_mlastnode 6 +#define FTVIMG_mnode 7 +#define FTVIMG_node 8 +#define FTVIMG_plastnode 9 +#define FTVIMG_pnode 10 +#define FTVIMG_vertline 11 + +#define FTV_S(name) #name +#define FTV_ICON_FILE(name) "ftv2" FTV_S(name) ".png" +#define FTVIMG_INDEX(name) FTVIMG_ ## name +#define FTV_INFO(name) ( image_info[FTVIMG_INDEX(name)] ) +#define FTV_IMGATTRIBS(name) \ + "src=\"" FTV_ICON_FILE(name) "\" " \ + "alt=\"" << FTV_INFO(name).alt << "\" " \ + "width=" << FTV_INFO(name).width << " " \ + "height=" << FTV_INFO(name).height << " " + +/*! A class that generates a dynamic tree view side panel. */ class FTVHelp { @@ -38,6 +69,7 @@ class FTVHelp const char *file, const char *anchor, const char *name); + static void generateTreeViewImages(); private: void generateTreeView(); @@ -54,5 +86,6 @@ class FTVHelp int m_indent; }; + #endif /* FTVHELP_H */ diff --git a/src/groupdef.cpp b/src/groupdef.cpp index b6b6401..28e21db 100644 --- a/src/groupdef.cpp +++ b/src/groupdef.cpp @@ -389,7 +389,7 @@ void GroupDef::writeDetailedDocumentation(OutputList &ol) // repeat brief description if (!briefDescription().isEmpty() && Config_getBool("REPEAT_BRIEF")) { - ol.parseDoc(briefFile(),briefLine(),name(),0,briefDescription(),FALSE); + ol.parseDoc(briefFile(),briefLine(),this,0,briefDescription(),FALSE,FALSE); ol.newParagraph(); } } @@ -397,7 +397,7 @@ void GroupDef::writeDetailedDocumentation(OutputList &ol) // write documentation if (!documentation().isEmpty()) { - ol.parseDoc(docFile(),docLine(),name(),0,documentation()+"\n",FALSE); + ol.parseDoc(docFile(),docLine(),this,0,documentation()+"\n",TRUE,FALSE); } } } @@ -420,7 +420,7 @@ void GroupDef::writeDocumentation(OutputList &ol) } else if (!briefDescription().isEmpty()) { - ol.parseDoc(briefFile(),briefLine(),name(),0,briefDescription(),FALSE); + ol.parseDoc(briefFile(),briefLine(),this,0,briefDescription(),TRUE,FALSE); ol.writeString(" \n"); ol.pushGeneratorState(); ol.disable(OutputGenerator::Latex); @@ -464,7 +464,7 @@ void GroupDef::writeDocumentation(OutputList &ol) if (!fd->briefDescription().isEmpty() && Config_getBool("BRIEF_MEMBER_DESC")) { ol.startMemberDescription(); - ol.parseDoc(briefFile(),briefLine(),0,0,fd->briefDescription(),FALSE); + ol.parseDoc(briefFile(),briefLine(),fd,0,fd->briefDescription(),FALSE,FALSE); ol.endMemberDescription(); ol.newParagraph(); } @@ -495,7 +495,7 @@ void GroupDef::writeDocumentation(OutputList &ol) if (!nd->briefDescription().isEmpty() && Config_getBool("BRIEF_MEMBER_DESC")) { ol.startMemberDescription(); - ol.parseDoc(briefFile(),briefLine(),0,0,nd->briefDescription(),FALSE); + ol.parseDoc(briefFile(),briefLine(),nd,0,nd->briefDescription(),FALSE,FALSE); ol.endMemberDescription(); ol.newParagraph(); } @@ -525,7 +525,7 @@ void GroupDef::writeDocumentation(OutputList &ol) if (!gd->briefDescription().isEmpty() && Config_getBool("BRIEF_MEMBER_DESC")) { ol.startMemberDescription(); - ol.parseDoc(briefFile(),briefLine(),0,0,gd->briefDescription(),FALSE); + ol.parseDoc(briefFile(),briefLine(),gd,0,gd->briefDescription(),FALSE,FALSE); ol.endMemberDescription(); ol.newParagraph(); } @@ -585,7 +585,7 @@ void GroupDef::writeDocumentation(OutputList &ol) ol.endSection(si->label,SectionInfo::Subsection); } ol.startTextBlock(); - ol.parseDoc(pd->docFile(),pd->docLine(),0,0,pd->documentation(),FALSE); + ol.parseDoc(pd->docFile(),pd->docLine(),pd,0,pd->documentation(),TRUE,FALSE); ol.endTextBlock(); } } diff --git a/src/htmldocvisitor.cpp b/src/htmldocvisitor.cpp index 8d75de9..23c7a6d 100644 --- a/src/htmldocvisitor.cpp +++ b/src/htmldocvisitor.cpp @@ -100,6 +100,7 @@ void HtmlDocVisitor::visit(DocSymbol *s) case DocSymbol::Acute: m_t << "&" << s->letter() << "acute;"; break; case DocSymbol::Grave: m_t << "&" << s->letter() << "grave;"; break; case DocSymbol::Circ: m_t << "&" << s->letter() << "circ;"; break; + case DocSymbol::Slash: m_t << "&" << s->letter() << "slash;"; break; case DocSymbol::Tilde: m_t << "&" << s->letter() << "tilde;"; break; case DocSymbol::Szlig: m_t << "ß"; break; case DocSymbol::Cedil: m_t << "&" << s->letter() << "cedil;"; break; @@ -207,7 +208,7 @@ void HtmlDocVisitor::visit(DocVerbatim *s) void HtmlDocVisitor::visit(DocAnchor *anc) { if (m_hide) return; - m_t << "<a name=\"" /*<< anc->file() << "#"*/ << anc->anchor() << "\"/></a>"; + m_t << "<a class=\"anchor\" name=\"" << anc->anchor() << "\"></a>"; } void HtmlDocVisitor::visit(DocInclude *inc) @@ -328,6 +329,20 @@ void HtmlDocVisitor::visitPost(DocAutoListItem *) void HtmlDocVisitor::visitPre(DocPara *) { + if (m_hide) return; + + // TODO: + // Paragraph should be surrounded by <p>..</p>, but + // + // A list item (li), description data (dd), or table data (td) should + // only have paragraph markers if there are multiple paragraphs (otherwise + // the output looks ugly). + // + // A list or table should be placed outside the paragraph context, + // so the current paragraph should be ended and restarted. To avoid + // empty paragraphs, it has to be checked if the list or table is the + // first or last child within the paragraph. + } void HtmlDocVisitor::visitPost(DocPara *p) @@ -345,12 +360,10 @@ void HtmlDocVisitor::visitPost(DocPara *p) void HtmlDocVisitor::visitPre(DocRoot *) { - //m_t << "<hr><h4><font color=\"red\">New parser:</font></h4>\n"; } void HtmlDocVisitor::visitPost(DocRoot *) { - //m_t << "<hr><h4><font color=\"red\">Old parser:</font></h4>\n"; } void HtmlDocVisitor::visitPre(DocSimpleSect *s) @@ -446,10 +459,10 @@ void HtmlDocVisitor::visitPre(DocSection *s) { if (m_hide) return; m_t << "<h" << s->level()+1 << ">"; - m_t << "<a name=\"" << s->anchor(); - m_t << "\"></a>" << endl; + m_t << "<a class=\"anchor\" name=\"" << s->anchor(); + m_t << "\">" << endl; filter(s->title()); - m_t << "</h" << s->level()+1 << ">\n"; + m_t << "</a></h" << s->level()+1 << ">\n"; } void HtmlDocVisitor::visitPost(DocSection *) @@ -488,18 +501,6 @@ void HtmlDocVisitor::visitPost(DocHtmlListItem *) m_t << "</li>\n"; } -//void HtmlDocVisitor::visitPre(DocHtmlPre *p) -//{ -// m_t << "<pre" << htmlAttribsToString(p->attribs()) << ">\n"; -// m_insidePre=TRUE; -//} - -//void HtmlDocVisitor::visitPost(DocHtmlPre *) -//{ -// m_insidePre=FALSE; -// m_t << "</pre>\n"; -//} - void HtmlDocVisitor::visitPre(DocHtmlDescList *dl) { if (m_hide) return; @@ -747,14 +748,14 @@ void HtmlDocVisitor::visitPost(DocLink *) void HtmlDocVisitor::visitPre(DocRef *ref) { if (m_hide) return; - startLink(ref->ref(),ref->file(),ref->anchor()); + if (!ref->file().isEmpty()) startLink(ref->ref(),ref->file(),ref->anchor()); if (!ref->hasLinkText()) filter(ref->targetTitle()); } -void HtmlDocVisitor::visitPost(DocRef *) +void HtmlDocVisitor::visitPost(DocRef *ref) { if (m_hide) return; - endLink(); + if (!ref->file().isEmpty()) endLink(); //m_t << " "; } diff --git a/src/htmlgen.cpp b/src/htmlgen.cpp index 7e79ca8..0f65f07 100644 --- a/src/htmlgen.cpp +++ b/src/htmlgen.cpp @@ -32,6 +32,8 @@ #include "htmlhelp.h" #include "docparser.h" #include "htmldocvisitor.h" +#include "index.h" +#include "pagedef.h" // #define GROUP_COLOR "#ff8080" @@ -53,20 +55,15 @@ static const char *defaultStyleSheet = " text-align: center;\n" " margin-bottom: 2px\n" "}\n" -"A.qindex { text-decoration: none; font-weight: bold; }\n" +"A.qindex { text-decoration: none; font-weight: bold; color: #0000ee }\n" +"A.qindex:visited { text-decoration: none; font-weight: bold; color: #0000ee }\n" "A.qindex:hover { text-decoration: none; background-color: #ddddff }\n" "A.qindexHL { text-decoration: none; font-weight: bold;\n" " background-color: #6666cc;\n" " color: #ffffff\n" " }\n" -"A.qindexHL:hover { text-decoration: none; background-color: #6666cc }\n" -"A.qindexRef { text-decoration: none; font-weight: bold; }\n" -"A.qindexRef:hover { text-decoration: none; background-color: #ddddff }\n" -"A.qindexRefHL { text-decoration: none; font-weight: bold;\n" -" background-color: #6666cc;\n" -" color: #ffffff\n" -" }\n" -"A.qindexRefHL:hover { text-decoration: none; background-color: #6666cc }\n" +"A.qindexHL:hover { text-decoration: none; background-color: #6666cc; color: #ffffff }\n" +"A.qindexHL:visited { text-decoration: none; background-color: #6666cc; color: #ffffff }\n" "A.el { text-decoration: none; font-weight: bold }\n" "A.elRef { font-weight: bold }\n" "A.code { text-decoration: none; font-weight: normal; color: #4444ee }\n" @@ -198,11 +195,29 @@ static const char *defaultStyleSheet = " background-color: #FAFAFA;\n" " font-family: Geneva, Arial, Helvetica, sans-serif;\n" " font-size: 13px;\n" +"}\n" +".search { color: #0000ee;\n" +" font-weight: bold;\n" +"}\n" +"FORM.search {\n" +" margin-bottom: 0px;\n" +" margin-top: 0px;\n" +"}\n" +"INPUT.search { font-size: 75%;\n" +" color: #000080;\n" +" font-weight: normal;\n" +" background-color: #eeeeff;\n" +"}\n" +"TD.tiny { font-size: 75%;\n" "}\n"; static QCString g_header; static QCString g_footer; +const char search_script[]= +#include "search_php.h" +; + HtmlGenerator::HtmlGenerator() : OutputGenerator() { dir=Config_getString("HTML_OUTPUT"); @@ -234,22 +249,17 @@ void HtmlGenerator::writeStyleSheetFile(QFile &file) t << defaultStyleSheet; } -static void writeDefaultHeaderFile(QTextStream &t, const char *title, - bool external) +static void writeDefaultHeaderFile(QTextStream &t, const char *title) { - t << "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">\n" - "<html><head>" /*"<meta name=\"robots\" content=\"noindex\">\n"*/ + t << "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n" + "<html><head>" "<meta http-equiv=\"Content-Type\" content=\"text/html;charset=" << theTranslator->idLanguageCharset() << "\">\n" "<title>"; t << convertToHtml(title); t << "</title>\n"; t << "<link "; - if (external) - t << "doxygen=\"_doc:" << Config_getString("DOC_URL") - << "\" href=\"" << Config_getString("DOC_URL") << "/"; - else - t << "href=\""; + t << "href=\""; if (Config_getString("HTML_STYLESHEET").isEmpty()) { t << "doxygen.css"; @@ -275,7 +285,7 @@ void HtmlGenerator::writeHeaderFile(QFile &file) #if QT_VERSION >= 200 t.setEncoding(QTextStream::Latin1); #endif - writeDefaultHeaderFile(t,"$title",FALSE); + writeDefaultHeaderFile(t,"$title"); } void HtmlGenerator::writeFooterFile(QFile &file) @@ -294,7 +304,7 @@ void HtmlGenerator::writeFooterFile(QFile &file) void HtmlGenerator::startFile(const char *name,const char *, - const char *title,bool external) + const char *title) { //printf("HtmlGenerator::startFile(%s)\n",name); QCString fileName=name; @@ -319,7 +329,7 @@ void HtmlGenerator::startFile(const char *name,const char *, lastFile = fileName; if (g_header.isEmpty()) { - writeDefaultHeaderFile(t,dispTitle,external); + writeDefaultHeaderFile(t,dispTitle); } else { @@ -329,73 +339,59 @@ void HtmlGenerator::startFile(const char *name,const char *, << versionString << " -->" << endl; } -void HtmlGenerator::startQuickIndexItem(const char *s,const char *l) -{ - QCString *dest; - if (s) +//void HtmlGenerator::startQuickIndexItem(const char *s,const char *l) +//{ +// QCString *dest; +// if (s) +// { +// t << "<a class=\"qindexRef\" "; +// t << "doxygen=\"" << s << ":"; +// if ((dest=Doxygen::tagDestinationDict[s])) t << *dest; +// if (strcmp(s,"_cgi")!=0) t << "/"; // small hack to get the cgi binary link right +// t << "\" "; +// } +// else +// { +// t << "<a class=\"qindex\" "; +// } +// t << "href=\""; +// if (s) +// { +// if ((dest=Doxygen::tagDestinationDict[s])) t << *dest; +// if (strcmp(s,"_cgi")!=0) t << "/"; +// } +// t << l << "\">"; +//} +// +//void HtmlGenerator::endQuickIndexItem() +//{ +// t << "</a> "; +//} + +static void writePageFooter(QTextStream &t,const QCString lastTitle) +{ + if (g_footer.isEmpty()) { - t << "<a class=\"qindexRef\" "; - t << "doxygen=\"" << s << ":"; - if ((dest=Doxygen::tagDestinationDict[s])) t << *dest; - if (strcmp(s,"_cgi")!=0) t << "/"; // small hack to get the cgi binary link right - t << "\" "; + t << "<hr size=\"1\"><address style=\"align: right;\"><small>"; + t << theTranslator->trGeneratedAt( + dateToString(TRUE), + Config_getString("PROJECT_NAME") + ); + t << endl << "<a href=\"http://www.doxygen.org/index.html\">"; + t << endl << "<img src=\"doxygen.png\" alt=\"doxygen\" " + << "align=\"middle\" border=0 > " << endl << + "</a>" << versionString <<" "; + t << "</small></address>\n</body>\n</html>\n"; } else { - t << "<a class=\"qindex\" "; - } - t << "href=\""; - if (s) - { - if ((dest=Doxygen::tagDestinationDict[s])) t << *dest; - if (strcmp(s,"_cgi")!=0) t << "/"; + t << substituteKeywords(g_footer,convertToHtml(lastTitle)); } - t << l << "\">"; } -void HtmlGenerator::endQuickIndexItem() +void HtmlGenerator::writeFooter() { - t << "</a> "; -} - -void HtmlGenerator::writeFooter(int part,bool external) -{ - switch (part) - { - case 0: - if (g_footer.isEmpty()) - t << "<hr size=\"1\"><address style=\"align: right;\"><small>"; - else - t << substituteKeywords(g_footer,convertToHtml(lastTitle)); - break; - case 1: - if (g_footer.isEmpty()) - { - t << endl << "<a href=\"http://www.doxygen.org/index.html\">"; - t << endl << "<img "; - if (external) - { - t << "doxygen=\"_doc:" << Config_getString("DOC_URL") - << "\" src=\"" << Config_getString("DOC_URL") << "/"; - } - else - { - t << "src=\""; - } - t << "doxygen.png\" alt=\"doxygen\" " - << "align=\"middle\" border=0 > " << endl << - "</a>" << versionString <<" "; - } - break; - default: - if (g_footer.isEmpty()) - { - //t << " <a href=\"mailto:dimitri@stack.nl\">Dimitri van Heesch</a>,\n © 1997-2003"; - t << "</small></address>\n</body>\n</html>\n"; - } - break; - - } + writePageFooter(t,lastTitle); } void HtmlGenerator::endFile() @@ -454,7 +450,7 @@ void HtmlGenerator::writeStyleInfo(int part) void HtmlGenerator::startDoxyAnchor(const char *,const char *, const char *anchor, const char *name) { - t << "<a name=\"" << anchor << "\" doxytag=\"" << name << "\"></a>"; + t << "<a class=\"anchor\" name=\"" << anchor << "\" doxytag=\"" << name << "\" ></a>"; } void HtmlGenerator::endDoxyAnchor(const char *,const char *) @@ -633,12 +629,12 @@ void HtmlGenerator::startSection(const char *lab,const char *,SectionInfo::Secti case SectionInfo::Paragraph: t << "<h5>"; break; default: ASSERT(0); break; } - t << "<a name=\"" << lab << "\">"; + t << "<a class=\"anchor\" name=\"" << lab << "\">"; } void HtmlGenerator::endSection(const char *,SectionInfo::SectionType type) { - t << "</a>" << endl; + t << "</a>"; switch(type) { case SectionInfo::Page: t << "</h1>"; break; @@ -1212,3 +1208,239 @@ void HtmlGenerator::printDoc(DocNode *n) delete visitor; } +static void startQuickIndexItem(QTextStream &t,const char *l, + bool hl,bool compact,bool &first) +{ + if (!first && compact) t << " | "; + first=FALSE; + if (!compact) t << "<li>"; + if (hl && compact) + { + t << "<a class=\"qindexHL\" "; + } + else + { + t << "<a class=\"qindex\" "; + } + t << "href=\"" << l << "\">"; +} + +static void endQuickIndexItem(QTextStream &t) +{ + t << "</a>"; +} + +static QCString fixSpaces(const QCString &s) +{ + return substitute(s," "," "); +} + +static void writeDefaultQuickLinks(QTextStream &t,bool compact,HighlightedItem hli) +{ + bool first=TRUE; + if (compact) + { + t << "<div class=\"qindex\">"; + } + else + { + t << "<ul>"; + } + + if (Config_getBool("SEARCHENGINE")) + { + t << " <form class=\"search\" action=\"search.php\" method=\"get\">\n"; + } + + if (Config_getBool("GENERATE_TREEVIEW")) + { + startQuickIndexItem(t,"main"+Doxygen::htmlFileExtension, + hli==HLI_Main,compact,first); + } + else + { + startQuickIndexItem(t,"index"+Doxygen::htmlFileExtension, + hli==HLI_Main,compact,first); + } + t << fixSpaces(theTranslator->trMainPage()); + endQuickIndexItem(t); + + if (documentedGroups>0) + { + startQuickIndexItem(t,"modules"+Doxygen::htmlFileExtension, + hli==HLI_Modules,compact,first); + t << fixSpaces(theTranslator->trModules()); + endQuickIndexItem(t); + } + if (documentedNamespaces>0) + { + startQuickIndexItem(t,"namespaces"+Doxygen::htmlFileExtension, + hli==HLI_Namespaces,compact,first); + if (Config_getBool("OPTIMIZE_OUTPUT_JAVA")) + { + t << fixSpaces(theTranslator->trPackages()); + } + else + { + t << theTranslator->trNamespaceList(); + } + endQuickIndexItem(t); + } + if (hierarchyClasses>0) + { + startQuickIndexItem(t,"hierarchy"+Doxygen::htmlFileExtension, + hli==HLI_Hierarchy,compact,first); + t << fixSpaces(theTranslator->trClassHierarchy()); + endQuickIndexItem(t); + } + if (annotatedClasses>0) + { + if (Config_getBool("ALPHABETICAL_INDEX")) + { + startQuickIndexItem(t,"classes"+Doxygen::htmlFileExtension, + hli==HLI_Classes,compact,first); + t << fixSpaces(theTranslator->trAlphabeticalList()); + endQuickIndexItem(t); + } + startQuickIndexItem(t,"annotated"+Doxygen::htmlFileExtension, + hli==HLI_Annotated,compact,first); + t << fixSpaces(theTranslator->trCompoundList()); + endQuickIndexItem(t); + } + if (documentedHtmlFiles>0) + { + startQuickIndexItem(t,"files"+Doxygen::htmlFileExtension, + hli==HLI_Files,compact,first); + t << fixSpaces(theTranslator->trFileList()); + endQuickIndexItem(t); + } + if (documentedNamespaceMembers[NMHL_All]>0) + { + startQuickIndexItem(t,"namespacemembers"+Doxygen::htmlFileExtension, + hli==HLI_NamespaceMembers,compact,first); + t << fixSpaces(theTranslator->trNamespaceMembers()); + endQuickIndexItem(t); + } + if (documentedClassMembers[CMHL_All]>0) + { + startQuickIndexItem(t,"functions"+Doxygen::htmlFileExtension, + hli==HLI_Functions,compact,first); + t << fixSpaces(theTranslator->trCompoundMembers()); + endQuickIndexItem(t); + } + if (documentedFileMembers[FMHL_All]>0) + { + startQuickIndexItem(t,"globals"+Doxygen::htmlFileExtension, + hli==HLI_Globals,compact,first); + t << fixSpaces(theTranslator->trFileMembers()); + endQuickIndexItem(t); + } + if (indexedPages>0) + { + startQuickIndexItem(t,"pages"+Doxygen::htmlFileExtension, + hli==HLI_Pages,compact,first); + t << fixSpaces(theTranslator->trRelatedPages()); + endQuickIndexItem(t); + } + if (Doxygen::exampleSDict->count()>0) + { + startQuickIndexItem(t,"examples"+Doxygen::htmlFileExtension, + hli==HLI_Examples,compact,first); + t << fixSpaces(theTranslator->trExamples()); + endQuickIndexItem(t); + } + if (Config_getBool("SEARCHENGINE")) + { + if (compact) + { + t << " | "; + } + else + { + t << "<li>"; + } + t << "<span class=\"search"; + if (hli==HLI_Search) t << "HL"; + QCString searchFor = fixSpaces(theTranslator->trSearchForIndex()); + if (searchFor.at(0)=='S') searchFor="<u>S</u>"+searchFor.mid(1); + t << "\">" << searchFor << " "; + if (hli!=HLI_Search) + { + t << "<input class=\"search\" type=\"text\" name=\"query\" value=\"\" size=\"20\" accesskey=\"s\"/>" + "</span></form>"; + } + } + if (hli!=HLI_Search) + { + if (compact) + { + t << "</div>\n"; + } + else + { + t << "</ul>\n"; + } + } +} + +void HtmlGenerator::writeQuickLinks(bool compact,HighlightedItem hli) +{ + writeDefaultQuickLinks(t,compact,hli); +} + +void HtmlGenerator::writeSearchPage() +{ + if (Config_getBool("SEARCHENGINE") && Config_getBool("GENERATE_HTML")) + { + QCString fileName = Config_getString("HTML_OUTPUT")+"/search.php"; + QFile f(fileName); + if (f.open(IO_WriteOnly)) + { + QTextStream t(&f); + if (g_header.isEmpty()) + { + writeDefaultHeaderFile(t,"Search"); + } + else + { + t << substituteKeywords(g_header,"Search"); + } + t << "<!-- " << theTranslator->trGeneratedBy() << " Doxygen " + << versionString << " -->" << endl; + writeDefaultQuickLinks(t,TRUE,HLI_Search); + + t << "<?php \n\n"; + t << "function search_results()\n"; + t << "{\n"; + t << " return \"" << theTranslator->trSearchResultsTitle() << "\";\n"; + t << "}\n"; + t << "\n"; + t << "function matches_text($num)\n"; + t << "{\n"; + t << " if ($num==0)\n"; + t << " {\n"; + t << " return \"" << theTranslator->trSearchResults(0) << "\";\n"; + t << " }\n"; + t << " else if ($num==1)\n"; + t << " {\n"; + t << " return \"" << theTranslator->trSearchResults(1) << "\";\n"; + t << " }\n"; + t << " else // $num>1\n"; + t << " {\n"; + t << " return \"" << theTranslator->trSearchResults(2) << "\";\n"; + t << " }\n"; + t << "}\n"; + t << "\n"; + t << "function report_matches()\n"; + t << "{\n"; + t << " return \"" << theTranslator->trSearchMatches() << " \";\n"; + t << "}\n"; + t << "\n"; + t << search_script; + t << "\n"; + t << "?>\n"; + writePageFooter(t,"Search"); + } + } +} + diff --git a/src/htmlgen.h b/src/htmlgen.h index 103a193..47169e6 100644 --- a/src/htmlgen.h +++ b/src/htmlgen.h @@ -43,9 +43,8 @@ class HtmlGenerator : public OutputGenerator void printDoc(DocNode *); - void startFile(const char *name,const char *manName, - const char *title,bool external); - void writeFooter(int,bool); + void startFile(const char *name,const char *manName,const char *title); + void writeFooter(); void endFile(); void clearBuffer(); @@ -164,8 +163,9 @@ class HtmlGenerator : public OutputGenerator void endClassDiagram(ClassDiagram &,const char *,const char *); void startPageRef() {} void endPageRef(const char *,const char *) {} - void startQuickIndexItem(const char *,const char *); - void endQuickIndexItem(); + //void startQuickIndexItem(const char *,const char *); + //void endQuickIndexItem(); + void writeQuickLinks(bool compact,HighlightedItem hli); void writeNonBreakableSpace(int); void startDescTable() @@ -209,6 +209,7 @@ class HtmlGenerator : public OutputGenerator void writeCodeAnchor(const char *anchor) { t << "<a name=\"" << anchor << "\"></a>"; } + static void writeSearchPage(); private: QCString lastTitle; diff --git a/src/index.cpp b/src/index.cpp index c4d463a..e4fe138 100644 --- a/src/index.cpp +++ b/src/index.cpp @@ -36,52 +36,15 @@ #include "dot.h" #include "pagedef.h" -enum ClassMemberHighlight -{ - CMHL_All = 0, - CMHL_Functions, - CMHL_Variables, - CMHL_Typedefs, - CMHL_Enums, - CMHL_EnumValues, - CMHL_Related, - CMHL_Properties, - CMHL_Events, - CMHL_Total = CMHL_Events+1 -}; - -enum FileMemberHighlight -{ - FMHL_All = 0, - FMHL_Functions, - FMHL_Variables, - FMHL_Typedefs, - FMHL_Enums, - FMHL_EnumValues, - FMHL_Defines, - FMHL_Total = FMHL_Defines+1 -}; - -enum NamespaceMemberHighlight -{ - NMHL_All = 0, - NMHL_Functions, - NMHL_Variables, - NMHL_Typedefs, - NMHL_Enums, - NMHL_EnumValues, - NMHL_Total = FMHL_EnumValues+1 -}; - -static int annotatedClasses; -static int hierarchyClasses; -static int documentedFiles; -static int documentedGroups; -static int documentedNamespaces; -static int indexedPages; -static int documentedClassMembers[CMHL_Total]; -static int documentedFileMembers[FMHL_Total]; -static int documentedNamespaceMembers[NMHL_Total]; +int annotatedClasses; +int hierarchyClasses; +int documentedFiles; +int documentedGroups; +int documentedNamespaces; +int indexedPages; +int documentedClassMembers[CMHL_Total]; +int documentedFileMembers[FMHL_Total]; +int documentedNamespaceMembers[NMHL_Total]; int documentedHtmlFiles; int documentedPages; @@ -211,46 +174,21 @@ QCString abbreviate(const char *s,const char *name) //---------------------------------------------------------------------------- -static void startQuickIndexItem(OutputList &ol,const char *s,const char *l, +static void startQuickIndexItem(OutputList &ol,const char *l, bool hl,bool compact,bool &first) { if (!first && compact) ol.writeString(" | "); first=FALSE; if (!compact) ol.writeString("<li>"); - QCString *dest; - if (s) // external link + if (hl && compact) { - if (hl && compact) - { - ol.writeString("<a class=\"qindexRefHL\" doxygen=\""); - } - else - { - ol.writeString("<a class=\"qindexRef\" doxygen=\""); - } - ol.writeString(s); - ol.writeString(":"); - if ((dest=Doxygen::tagDestinationDict[s])) ol.writeString(*dest); - if (strcmp(s,"_cgi")!=0) ol.writeString("/"); // small hack to get the cgi binary link right - ol.writeString("\" "); + ol.writeString("<a class=\"qindexHL\" "); } - else // local link + else { - if (hl && compact) - { - ol.writeString("<a class=\"qindexHL\" "); - } - else - { - ol.writeString("<a class=\"qindex\" "); - } + ol.writeString("<a class=\"qindex\" "); } ol.writeString("href=\""); - if (s) // external link - { - if ((dest=Doxygen::tagDestinationDict[s])) ol.writeString(*dest); - if (strcmp(s,"_cgi")!=0) ol.writeString("/"); - } ol.writeString(l); ol.writeString("\">"); } @@ -260,141 +198,150 @@ static void endQuickIndexItem(OutputList &ol) ol.writeString("</a>"); } + static QCString fixSpaces(const QCString &s) { return substitute(s," "," "); } -void writeQuickLinks(OutputList &ol,bool compact,HighlightedItem hli,bool ext=FALSE) -{ - bool first=TRUE; - ol.pushGeneratorState(); - ol.disableAllBut(OutputGenerator::Html); - QCString extLink; - if (ext) { extLink="_doc"; } - if (compact) - { - ol.writeString("<div class=\"qindex\">"); - } - else - { - ol.startItemList(); - } - - if (Config_getBool("GENERATE_TREEVIEW")) - { - startQuickIndexItem(ol,extLink,"main"+Doxygen::htmlFileExtension, - hli==HLI_Main,compact,first); - } - else - { - startQuickIndexItem(ol,extLink,"index"+Doxygen::htmlFileExtension, - hli==HLI_Main,compact,first); - } - ol.parseText(fixSpaces(theTranslator->trMainPage())); - endQuickIndexItem(ol); - - if (documentedGroups>0) - { - startQuickIndexItem(ol,extLink,"modules"+Doxygen::htmlFileExtension, - hli==HLI_Modules,compact,first); - ol.parseText(fixSpaces(theTranslator->trModules())); - endQuickIndexItem(ol); - } - if (documentedNamespaces>0) - { - startQuickIndexItem(ol,extLink,"namespaces"+Doxygen::htmlFileExtension, - hli==HLI_Namespaces,compact,first); - if (Config_getBool("OPTIMIZE_OUTPUT_JAVA")) - { - ol.parseText(fixSpaces(theTranslator->trPackages())); - } - else - { - ol.parseText(theTranslator->trNamespaceList()); - } - endQuickIndexItem(ol); - } - if (hierarchyClasses>0) - { - startQuickIndexItem(ol,extLink,"hierarchy"+Doxygen::htmlFileExtension, - hli==HLI_Hierarchy,compact,first); - ol.parseText(fixSpaces(theTranslator->trClassHierarchy())); - endQuickIndexItem(ol); - } - if (annotatedClasses>0) - { - if (Config_getBool("ALPHABETICAL_INDEX")) - { - startQuickIndexItem(ol,extLink,"classes"+Doxygen::htmlFileExtension, - hli==HLI_Classes,compact,first); - ol.parseText(fixSpaces(theTranslator->trAlphabeticalList())); - endQuickIndexItem(ol); - } - if (!compact) ol.writeListItem(); - startQuickIndexItem(ol,extLink,"annotated"+Doxygen::htmlFileExtension, - hli==HLI_Annotated,compact,first); - ol.parseText(fixSpaces(theTranslator->trCompoundList())); - endQuickIndexItem(ol); - } - if (documentedHtmlFiles>0) - { - startQuickIndexItem(ol,extLink,"files"+Doxygen::htmlFileExtension, - hli==HLI_Files,compact,first); - ol.parseText(fixSpaces(theTranslator->trFileList())); - endQuickIndexItem(ol); - } - if (documentedNamespaceMembers[NMHL_All]>0) - { - startQuickIndexItem(ol,extLink,"namespacemembers"+Doxygen::htmlFileExtension, - hli==HLI_NamespaceMembers,compact,first); - ol.parseText(fixSpaces(theTranslator->trNamespaceMembers())); - endQuickIndexItem(ol); - } - if (documentedClassMembers[CMHL_All]>0) - { - startQuickIndexItem(ol,extLink,"functions"+Doxygen::htmlFileExtension, - hli==HLI_Functions,compact,first); - ol.parseText(fixSpaces(theTranslator->trCompoundMembers())); - endQuickIndexItem(ol); - } - if (documentedFileMembers[FMHL_All]>0) - { - startQuickIndexItem(ol,extLink,"globals"+Doxygen::htmlFileExtension, - hli==HLI_Globals,compact,first); - ol.parseText(fixSpaces(theTranslator->trFileMembers())); - endQuickIndexItem(ol); - } - if (indexedPages>0) - { - startQuickIndexItem(ol,extLink,"pages"+Doxygen::htmlFileExtension, - hli==HLI_Pages,compact,first); - ol.parseText(fixSpaces(theTranslator->trRelatedPages())); - endQuickIndexItem(ol); - } - if (Doxygen::exampleSDict->count()>0) - { - startQuickIndexItem(ol,extLink,"examples"+Doxygen::htmlFileExtension, - hli==HLI_Examples,compact,first); - ol.parseText(fixSpaces(theTranslator->trExamples())); - endQuickIndexItem(ol); - } - if (Config_getBool("SEARCHENGINE")) - { - startQuickIndexItem(ol,"_cgi","",hli==HLI_Search,compact,first); - ol.parseText(fixSpaces(theTranslator->trSearch())); - endQuickIndexItem(ol); - } - if (compact) - { - ol.writeString("</div>\n"); - } - else - { - ol.endItemList(); - } - ol.popGeneratorState(); -} +//void writeQuickLinks(OutputList &ol,bool compact,HighlightedItem hli,bool ext=FALSE) +//{ +// bool first=TRUE; +// ol.pushGeneratorState(); +// ol.disableAllBut(OutputGenerator::Html); +// QCString extLink; +// if (ext) { extLink="_doc"; } +// if (compact) +// { +// ol.writeString("<div class=\"qindex\">"); +// } +// else +// { +// ol.startItemList(); +// } +// +// if (Config_getBool("SEARCHENGINE")) +// { +// ol.writeString(" <form class=\"search\" action=\"search.php\" method=\"get\">\n"); +// } +// +// if (Config_getBool("GENERATE_TREEVIEW")) +// { +// startQuickIndexItem(ol,extLink,"main"+Doxygen::htmlFileExtension, +// hli==HLI_Main,compact,first); +// } +// else +// { +// startQuickIndexItem(ol,extLink,"index"+Doxygen::htmlFileExtension, +// hli==HLI_Main,compact,first); +// } +// ol.parseText(fixSpaces(theTranslator->trMainPage())); +// endQuickIndexItem(ol); +// +// if (documentedGroups>0) +// { +// startQuickIndexItem(ol,extLink,"modules"+Doxygen::htmlFileExtension, +// hli==HLI_Modules,compact,first); +// ol.parseText(fixSpaces(theTranslator->trModules())); +// endQuickIndexItem(ol); +// } +// if (documentedNamespaces>0) +// { +// startQuickIndexItem(ol,extLink,"namespaces"+Doxygen::htmlFileExtension, +// hli==HLI_Namespaces,compact,first); +// if (Config_getBool("OPTIMIZE_OUTPUT_JAVA")) +// { +// ol.parseText(fixSpaces(theTranslator->trPackages())); +// } +// else +// { +// ol.parseText(theTranslator->trNamespaceList()); +// } +// endQuickIndexItem(ol); +// } +// if (hierarchyClasses>0) +// { +// startQuickIndexItem(ol,extLink,"hierarchy"+Doxygen::htmlFileExtension, +// hli==HLI_Hierarchy,compact,first); +// ol.parseText(fixSpaces(theTranslator->trClassHierarchy())); +// endQuickIndexItem(ol); +// } +// if (annotatedClasses>0) +// { +// if (Config_getBool("ALPHABETICAL_INDEX")) +// { +// startQuickIndexItem(ol,extLink,"classes"+Doxygen::htmlFileExtension, +// hli==HLI_Classes,compact,first); +// ol.parseText(fixSpaces(theTranslator->trAlphabeticalList())); +// endQuickIndexItem(ol); +// } +// if (!compact) ol.writeListItem(); +// startQuickIndexItem(ol,extLink,"annotated"+Doxygen::htmlFileExtension, +// hli==HLI_Annotated,compact,first); +// ol.parseText(fixSpaces(theTranslator->trCompoundList())); +// endQuickIndexItem(ol); +// } +// if (documentedHtmlFiles>0) +// { +// startQuickIndexItem(ol,extLink,"files"+Doxygen::htmlFileExtension, +// hli==HLI_Files,compact,first); +// ol.parseText(fixSpaces(theTranslator->trFileList())); +// endQuickIndexItem(ol); +// } +// if (documentedNamespaceMembers[NMHL_All]>0) +// { +// startQuickIndexItem(ol,extLink,"namespacemembers"+Doxygen::htmlFileExtension, +// hli==HLI_NamespaceMembers,compact,first); +// ol.parseText(fixSpaces(theTranslator->trNamespaceMembers())); +// endQuickIndexItem(ol); +// } +// if (documentedClassMembers[CMHL_All]>0) +// { +// startQuickIndexItem(ol,extLink,"functions"+Doxygen::htmlFileExtension, +// hli==HLI_Functions,compact,first); +// ol.parseText(fixSpaces(theTranslator->trCompoundMembers())); +// endQuickIndexItem(ol); +// } +// if (documentedFileMembers[FMHL_All]>0) +// { +// startQuickIndexItem(ol,extLink,"globals"+Doxygen::htmlFileExtension, +// hli==HLI_Globals,compact,first); +// ol.parseText(fixSpaces(theTranslator->trFileMembers())); +// endQuickIndexItem(ol); +// } +// if (indexedPages>0) +// { +// startQuickIndexItem(ol,extLink,"pages"+Doxygen::htmlFileExtension, +// hli==HLI_Pages,compact,first); +// ol.parseText(fixSpaces(theTranslator->trRelatedPages())); +// endQuickIndexItem(ol); +// } +// if (Doxygen::exampleSDict->count()>0) +// { +// startQuickIndexItem(ol,extLink,"examples"+Doxygen::htmlFileExtension, +// hli==HLI_Examples,compact,first); +// ol.parseText(fixSpaces(theTranslator->trExamples())); +// endQuickIndexItem(ol); +// } +// if (Config_getBool("SEARCHENGINE")) +// { +// //startQuickIndexItem(ol,"_cgi","",hli==HLI_Search,compact,first); +// //ol.parseText(fixSpaces(theTranslator->trSearch())); +// //endQuickIndexItem(ol); +// ol.writeString(" | <span class=\"search\"><u>S</u>earch for " +// "<input class=\"search\" type=\"text\" name=\"query\" value=\"\" size=\"30\" accesskey=\"s\"/>" +// "</span>"); +// } +// if (compact) +// { +// ol.writeString("</div>\n"); +// } +// else +// { +// ol.endItemList(); +// } +// ol.popGeneratorState(); +//} void startTitle(OutputList &ol,const char *fileName) { @@ -410,30 +357,30 @@ void endTitle(OutputList &ol,const char *fileName,const char *name) } void startFile(OutputList &ol,const char *name,const char *manName, - const char *title,bool external,HighlightedItem hli) + const char *title,HighlightedItem hli) { - ol.startFile(name,manName,title,external); - if (!Config_getBool("DISABLE_INDEX")) writeQuickLinks(ol,TRUE,hli,external); + ol.startFile(name,manName,title); + if (!Config_getBool("DISABLE_INDEX")) ol.writeQuickLinks(TRUE,hli); } -void endFile(OutputList &ol,bool external) +void endFile(OutputList &ol,bool) { ol.pushGeneratorState(); ol.disableAllBut(OutputGenerator::Html); - ol.writeFooter(0,external); // write the footer - if (Config_getString("HTML_FOOTER").isEmpty()) - { - ol.parseText(theTranslator->trGeneratedAt( - dateToString(TRUE), - Config_getString("PROJECT_NAME") - )); - } - ol.writeFooter(1,external); // write the link to the picture + ol.writeFooter(); // write the footer + //if (Config_getString("HTML_FOOTER").isEmpty()) + //{ + // ol.parseText(theTranslator->trGeneratedAt( + // dateToString(TRUE), + // Config_getString("PROJECT_NAME") + // )); + //} + //ol.writeFooter(1,external); // write the link to the picture //if (Config_getString("HTML_FOOTER").isEmpty()) //{ // parseText(ol,theTranslator->trWrittenBy()); //} - ol.writeFooter(2,external); // end the footer + //ol.writeFooter(2,external); // end the footer ol.popGeneratorState(); ol.endFile(); } @@ -787,7 +734,7 @@ void writeHierarchicalIndex(OutputList &ol) if (hierarchyClasses==0) return; ol.pushGeneratorState(); ol.disable(OutputGenerator::Man); - startFile(ol,"hierarchy",0,"Hierarchical Index",FALSE,HLI_Hierarchy); + startFile(ol,"hierarchy",0,"Hierarchical Index",HLI_Hierarchy); startTitle(ol,0); QCString title = theTranslator->trClassHierarchy(); QCString htmlHelpTitle = title; @@ -917,7 +864,7 @@ void writeFileIndex(OutputList &ol) ol.pushGeneratorState(); ol.disable(OutputGenerator::Man); if (documentedFiles==0) ol.disableAllBut(OutputGenerator::Html); - startFile(ol,"files",0,"File Index",FALSE,HLI_Files); + startFile(ol,"files",0,"File Index",HLI_Files); startTitle(ol,0); QCString title = theTranslator->trFileList(); QCString htmlHelpTitle = title; @@ -1095,9 +1042,10 @@ void writeFileIndex(OutputList &ol) //ol.docify(" ("); ol.parseDoc( fd->briefFile(),fd->briefLine(), - 0,0, + fd,0, abbreviate(fd->briefDescription(),fd->name()), - FALSE + FALSE, // index words + FALSE // isExample ); //ol.docify(")"); } @@ -1152,12 +1100,12 @@ void writeNamespaceIndex(OutputList &ol) QCString title; if (Config_getBool("OPTIMIZE_OUTPUT_JAVA")) { - startFile(ol,"namespaces",0,"Package Index",FALSE,HLI_Namespaces); + startFile(ol,"namespaces",0,"Package Index",HLI_Namespaces); title = theTranslator->trPackageList(); } else { - startFile(ol,"namespaces",0,"Namespace Index",FALSE,HLI_Namespaces); + startFile(ol,"namespaces",0,"Namespace Index",HLI_Namespaces); title = theTranslator->trNamespaceList(); } startTitle(ol,0); @@ -1220,9 +1168,10 @@ void writeNamespaceIndex(OutputList &ol) //ol.docify(" ("); ol.parseDoc( nd->briefFile(),nd->briefLine(), - nd->name(),0, + nd,0, abbreviate(nd->briefDescription(),nd->displayName()), - FALSE + FALSE, // index words + FALSE // isExample ); //ol.docify(")"); } @@ -1297,9 +1246,10 @@ void writeAnnotatedClassList(OutputList &ol) { ol.parseDoc( cd->briefFile(),cd->briefLine(), - cd->name(),0, + cd,0, abbreviate(cd->briefDescription(),cd->name()), - FALSE + FALSE, // indexWords + FALSE // isExample ); } ol.endIndexValue(cd->getOutputFileBase(),hasBrief); @@ -1343,7 +1293,7 @@ void writeAnnotatedClassList(OutputList &ol) // //ol.docify(" ("); // parseDoc(ol, // pd->getDefFileName(),pd->getDefLine(), -// pd->name(),0, +// pd,0, // abbreviate(pd->briefDescription(),pd->name())); // //ol.docify(")"); // } @@ -1542,7 +1492,7 @@ void writeAlphabeticalIndex(OutputList &ol) if (annotatedClasses==0) return; ol.pushGeneratorState(); ol.disableAllBut(OutputGenerator::Html); - startFile(ol,"classes"+Doxygen::htmlFileExtension,0,"Alphabetical index",FALSE,HLI_Classes); + startFile(ol,"classes"+Doxygen::htmlFileExtension,0,"Alphabetical index",HLI_Classes); startTitle(ol,0); ol.parseText(Config_getString("PROJECT_NAME")+" "+theTranslator->trCompoundIndex()); endTitle(ol,0,0); @@ -1563,7 +1513,7 @@ void writeAnnotatedIndex(OutputList &ol) ol.pushGeneratorState(); ol.disable(OutputGenerator::Man); - startFile(ol,"annotated",0,"Annotated Index",FALSE,HLI_Annotated); + startFile(ol,"annotated",0,"Annotated Index",HLI_Annotated); startTitle(ol,0); QCString title = theTranslator->trCompoundList(); QCString htmlHelpTitle = title; @@ -1806,7 +1756,7 @@ void writeQuickMemberIndex(OutputList &ol,bool *charUsed) char is[2];is[0]=(char)i;is[1]='\0'; if (charUsed[i]) { - startQuickIndexItem(ol,0,anchor+is,FALSE,TRUE,first); + startQuickIndexItem(ol,anchor+is,FALSE,TRUE,first); ol.writeString(is); endQuickIndexItem(ol); first=FALSE; @@ -1824,7 +1774,7 @@ static void writeMemberIndexFiltered(OutputList &ol, if (documentedClassMembers[hl]==0) return; ol.pushGeneratorState(); ol.disableAllBut(OutputGenerator::Html); - startFile(ol,fileName,0,"Compound Member Index",FALSE,HLI_Functions); + startFile(ol,fileName,0,"Compound Member Index",HLI_Functions); QCString title = theTranslator->trCompoundMembers(); QCString htmlHelpTitle = title; QCString ftvHelpTitle = title; @@ -1836,63 +1786,63 @@ static void writeMemberIndexFiltered(OutputList &ol, ol.writeString("<div class=\"qindex\">"); bool first=TRUE; - startQuickIndexItem(ol,0, + startQuickIndexItem(ol, "functions"+Doxygen::htmlFileExtension,hl==CMHL_All,TRUE,first); ol.writeString(fixSpaces(theTranslator->trAll())); endQuickIndexItem(ol); if (documentedClassMembers[CMHL_Functions]>0) { - startQuickIndexItem(ol,0, + startQuickIndexItem(ol, "functions_func"+Doxygen::htmlFileExtension,hl==CMHL_Functions,TRUE,first); ol.writeString(fixSpaces(theTranslator->trFunctions())); endQuickIndexItem(ol); } if (documentedClassMembers[CMHL_Variables]>0) { - startQuickIndexItem(ol,0, + startQuickIndexItem(ol, "functions_vars"+Doxygen::htmlFileExtension,hl==CMHL_Variables,TRUE,first); ol.writeString(fixSpaces(theTranslator->trVariables())); endQuickIndexItem(ol); } if (documentedClassMembers[CMHL_Typedefs]>0) { - startQuickIndexItem(ol,0, + startQuickIndexItem(ol, "functions_type"+Doxygen::htmlFileExtension,hl==CMHL_Typedefs,TRUE,first); ol.writeString(fixSpaces(theTranslator->trTypedefs())); endQuickIndexItem(ol); } if (documentedClassMembers[CMHL_Enums]>0) { - startQuickIndexItem(ol,0, + startQuickIndexItem(ol, "functions_enum"+Doxygen::htmlFileExtension,hl==CMHL_Enums,TRUE,first); ol.writeString(fixSpaces(theTranslator->trEnumerations())); endQuickIndexItem(ol); } if (documentedClassMembers[CMHL_EnumValues]>0) { - startQuickIndexItem(ol,0, + startQuickIndexItem(ol, "functions_eval"+Doxygen::htmlFileExtension,hl==CMHL_EnumValues,TRUE,first); ol.writeString(fixSpaces(theTranslator->trEnumerationValues())); endQuickIndexItem(ol); } if (documentedClassMembers[CMHL_Properties]>0) { - startQuickIndexItem(ol,0, + startQuickIndexItem(ol, "functions_prop"+Doxygen::htmlFileExtension,hl==CMHL_Properties,TRUE,first); ol.writeString(fixSpaces(theTranslator->trProperties())); endQuickIndexItem(ol); } if (documentedClassMembers[CMHL_Events]>0) { - startQuickIndexItem(ol,0, + startQuickIndexItem(ol, "functions_evnt"+Doxygen::htmlFileExtension,hl==CMHL_Events,TRUE,first); ol.writeString(fixSpaces(theTranslator->trEvents())); endQuickIndexItem(ol); } if (documentedClassMembers[CMHL_Related]>0) { - startQuickIndexItem(ol,0, + startQuickIndexItem(ol, "functions_rela"+Doxygen::htmlFileExtension,hl==CMHL_Related,TRUE,first); ol.writeString(fixSpaces(theTranslator->trRelatedFunctions())); endQuickIndexItem(ol); @@ -2214,7 +2164,7 @@ static void writeFileMemberIndexFiltered(OutputList &ol, if (documentedFileMembers[hl]==0) return; ol.pushGeneratorState(); ol.disableAllBut(OutputGenerator::Html); - startFile(ol,fileName,0,"File Member Index",FALSE,HLI_Globals); + startFile(ol,fileName,0,"File Member Index",HLI_Globals); QCString title = theTranslator->trFileMembers(); QCString htmlHelpTitle = title; QCString ftvHelpTitle = title; @@ -2222,49 +2172,49 @@ static void writeFileMemberIndexFiltered(OutputList &ol, ol.writeString("<div class=\"qindex\">"); bool first=TRUE; - startQuickIndexItem(ol,0, + startQuickIndexItem(ol, "globals"+Doxygen::htmlFileExtension,hl==FMHL_All,TRUE,first); ol.writeString(fixSpaces(theTranslator->trAll())); endQuickIndexItem(ol); if (documentedFileMembers[FMHL_Functions]>0) { - startQuickIndexItem(ol,0, + startQuickIndexItem(ol, "globals_func"+Doxygen::htmlFileExtension,hl==FMHL_Functions,TRUE,first); ol.writeString(fixSpaces(theTranslator->trFunctions())); endQuickIndexItem(ol); } if (documentedFileMembers[FMHL_Variables]>0) { - startQuickIndexItem(ol,0, + startQuickIndexItem(ol, "globals_vars"+Doxygen::htmlFileExtension,hl==FMHL_Variables,TRUE,first); ol.writeString(fixSpaces(theTranslator->trVariables())); endQuickIndexItem(ol); } if (documentedFileMembers[FMHL_Typedefs]>0) { - startQuickIndexItem(ol,0, + startQuickIndexItem(ol, "globals_type"+Doxygen::htmlFileExtension,hl==FMHL_Typedefs,TRUE,first); ol.writeString(fixSpaces(theTranslator->trTypedefs())); endQuickIndexItem(ol); } if (documentedFileMembers[FMHL_Enums]>0) { - startQuickIndexItem(ol,0, + startQuickIndexItem(ol, "globals_enum"+Doxygen::htmlFileExtension,hl==FMHL_Enums,TRUE,first); ol.writeString(fixSpaces(theTranslator->trEnumerations())); endQuickIndexItem(ol); } if (documentedFileMembers[FMHL_EnumValues]>0) { - startQuickIndexItem(ol,0, + startQuickIndexItem(ol, "globals_eval"+Doxygen::htmlFileExtension,hl==FMHL_EnumValues,TRUE,first); ol.writeString(fixSpaces(theTranslator->trEnumerationValues())); endQuickIndexItem(ol); } if (documentedFileMembers[FMHL_Defines]>0) { - startQuickIndexItem(ol,0, + startQuickIndexItem(ol, "globals_defs"+Doxygen::htmlFileExtension,hl==FMHL_Defines,TRUE,first); ol.writeString(fixSpaces(theTranslator->trDefines())); endQuickIndexItem(ol); @@ -2322,7 +2272,7 @@ static void writeNamespaceMemberIndexFiltered(OutputList &ol, if (documentedNamespaceMembers[hl]==0) return; ol.pushGeneratorState(); ol.disableAllBut(OutputGenerator::Html); - startFile(ol,fileName,0,"Namespace Member Index",FALSE,HLI_NamespaceMembers); + startFile(ol,fileName,0,"Namespace Member Index",HLI_NamespaceMembers); QCString title = theTranslator->trNamespaceMembers(); QCString htmlHelpTitle = title; QCString ftvHelpTitle = title; @@ -2334,42 +2284,42 @@ static void writeNamespaceMemberIndexFiltered(OutputList &ol, ol.writeString("<div class=\"qindex\">"); bool first=TRUE; - startQuickIndexItem(ol,0, + startQuickIndexItem(ol, "namespacemembers"+Doxygen::htmlFileExtension,hl==NMHL_All,TRUE,first); ol.writeString(fixSpaces(theTranslator->trAll())); endQuickIndexItem(ol); if (documentedNamespaceMembers[NMHL_Functions]>0) { - startQuickIndexItem(ol,0, + startQuickIndexItem(ol, "namespacemembers_func"+Doxygen::htmlFileExtension,hl==NMHL_Functions,TRUE,first); ol.writeString(fixSpaces(theTranslator->trFunctions())); endQuickIndexItem(ol); } if (documentedNamespaceMembers[NMHL_Variables]>0) { - startQuickIndexItem(ol,0, + startQuickIndexItem(ol, "namespacemembers_vars"+Doxygen::htmlFileExtension,hl==NMHL_Variables,TRUE,first); ol.writeString(fixSpaces(theTranslator->trVariables())); endQuickIndexItem(ol); } if (documentedNamespaceMembers[NMHL_Typedefs]>0) { - startQuickIndexItem(ol,0, + startQuickIndexItem(ol, "namespacemembers_type"+Doxygen::htmlFileExtension,hl==NMHL_Typedefs,TRUE,first); ol.writeString(fixSpaces(theTranslator->trTypedefs())); endQuickIndexItem(ol); } if (documentedNamespaceMembers[NMHL_Enums]>0) { - startQuickIndexItem(ol,0, + startQuickIndexItem(ol, "namespacemembers_enum"+Doxygen::htmlFileExtension,hl==NMHL_Enums,TRUE,first); ol.writeString(fixSpaces(theTranslator->trEnumerations())); endQuickIndexItem(ol); } if (documentedNamespaceMembers[NMHL_EnumValues]>0) { - startQuickIndexItem(ol,0, + startQuickIndexItem(ol, "namespacemembers_eval"+Doxygen::htmlFileExtension,hl==NMHL_EnumValues,TRUE,first); ol.writeString(fixSpaces(theTranslator->trEnumerationValues())); endQuickIndexItem(ol); @@ -2422,7 +2372,7 @@ void writeExampleIndex(OutputList &ol) if (Doxygen::exampleSDict->count()==0) return; ol.pushGeneratorState(); ol.disable(OutputGenerator::Man); - startFile(ol,"examples",0,"Example Index",FALSE,HLI_Examples); + startFile(ol,"examples",0,"Example Index",HLI_Examples); startTitle(ol,0); QCString title = theTranslator->trExamples(); QCString htmlHelpTitle = title; @@ -2510,7 +2460,7 @@ void writePageIndex(OutputList &ol) if (indexedPages==0) return; ol.pushGeneratorState(); ol.disable(OutputGenerator::Man); - startFile(ol,"pages",0,"Page Index",FALSE,HLI_Pages); + startFile(ol,"pages",0,"Page Index",HLI_Pages); startTitle(ol,0); QCString title = theTranslator->trRelatedPages(); QCString htmlHelpTitle = title; @@ -2611,7 +2561,7 @@ void writeGraphInfo(OutputList &ol) bool oldStripCommentsState = Config_getBool("STRIP_CODE_COMMENTS"); // temporarily disable the stripping of comments for our own code example! Config_getBool("STRIP_CODE_COMMENTS") = FALSE; - ol.parseDoc("graph_legend",1,0,0,theTranslator->trLegendDocs(),FALSE); + ol.parseDoc("graph_legend",1,0,0,theTranslator->trLegendDocs(),FALSE,FALSE); Config_getBool("STRIP_CODE_COMMENTS") = oldStripCommentsState; endFile(ol); ol.popGeneratorState(); @@ -2976,7 +2926,7 @@ void writeGroupList(OutputList &ol) ol.endDescItem(); parseDoc(ol, gd->briefFile(),gd->briefLine(), - 0,0,gd->briefDescription()); + gd,0,gd->briefDescription()); ol.newParagraph(); //} @@ -3011,7 +2961,7 @@ void writeGroupIndex(OutputList &ol) if (documentedGroups==0) return; ol.pushGeneratorState(); ol.disable(OutputGenerator::Man); - startFile(ol,"modules",0,"Module Index",FALSE,HLI_Modules); + startFile(ol,"modules",0,"Module Index",HLI_Modules); startTitle(ol,0); QCString title = theTranslator->trModules(); QCString htmlHelpTitle = title; @@ -3087,7 +3037,7 @@ void writeIndex(OutputList &ol) QCString indexName="index"; if (Config_getBool("GENERATE_TREEVIEW")) indexName="main"; - ol.startFile(indexName,0,title,FALSE); + ol.startFile(indexName,0,title); bool &generateHtml = Config_getBool("GENERATE_HTML") ; bool hasHtmlHelp = generateHtml && Config_getBool("GENERATE_HTMLHELP"); @@ -3101,13 +3051,13 @@ void writeIndex(OutputList &ol) FTVHelp::getInstance()->addContentsItem(FALSE,0,indexName,0,title); } - if (!Config_getBool("DISABLE_INDEX")) writeQuickLinks(ol,TRUE,HLI_Main); + if (!Config_getBool("DISABLE_INDEX")) ol.writeQuickLinks(TRUE,HLI_Main); ol.startTitleHead(0); if (Doxygen::mainPage && !Doxygen::mainPage->title().isEmpty()) { if (Doxygen::mainPage->title().lower()!="notitle") { - ol.parseDoc(defFileName,defLine,0,0,Doxygen::mainPage->title(),FALSE); + ol.parseDoc(defFileName,defLine,Doxygen::mainPage,0,Doxygen::mainPage->title(),TRUE,FALSE); } } else @@ -3122,16 +3072,16 @@ void writeIndex(OutputList &ol) if (!Config_getString("PROJECT_NUMBER").isEmpty()) { ol.startProjectNumber(); - ol.parseDoc(defFileName,defLine,0,0,Config_getString("PROJECT_NUMBER"),FALSE); + ol.parseDoc(defFileName,defLine,Doxygen::mainPage,0,Config_getString("PROJECT_NUMBER"),TRUE,FALSE); ol.endProjectNumber(); } - if (Config_getBool("DISABLE_INDEX") && Doxygen::mainPage==0) writeQuickLinks(ol,FALSE,HLI_Main); + if (Config_getBool("DISABLE_INDEX") && Doxygen::mainPage==0) ol.writeQuickLinks(FALSE,HLI_Main); if (Doxygen::mainPage) { Doxygen::insideMainPage=TRUE; - ol.parseDoc(defFileName,defLine,0,0, - Doxygen::mainPage->documentation(),FALSE + ol.parseDoc(defFileName,defLine,Doxygen::mainPage,0, + Doxygen::mainPage->documentation(),TRUE,FALSE /*,Doxygen::mainPage->sectionDict*/); if (!Config_getString("GENERATE_TAGFILE").isEmpty()) @@ -3162,7 +3112,7 @@ void writeIndex(OutputList &ol) ol.enable(OutputGenerator::Latex); ol.enable(OutputGenerator::RTF); - ol.startFile("refman",0,0,FALSE); + ol.startFile("refman",0,0); ol.startIndexSection(isTitlePageStart); if (!Config_getString("LATEX_HEADER").isEmpty()) { @@ -3173,7 +3123,7 @@ void writeIndex(OutputList &ol) if (!Config_getString("PROJECT_NUMBER").isEmpty()) { ol.startProjectNumber(); - ol.parseDoc(defFileName,defLine,0,0,Config_getString("PROJECT_NUMBER"),FALSE); + ol.parseDoc(defFileName,defLine,Doxygen::mainPage,0,Config_getString("PROJECT_NUMBER"),FALSE,FALSE); ol.endProjectNumber(); } ol.endIndexSection(isTitlePageStart); @@ -3187,7 +3137,7 @@ void writeIndex(OutputList &ol) ol.startIndexSection(isMainPage); if (!Doxygen::mainPage->title().isEmpty()) { - ol.parseDoc(defFileName,defLine,0,0,Doxygen::mainPage->title(),FALSE); + ol.parseDoc(defFileName,defLine,Doxygen::mainPage,0,Doxygen::mainPage->title(),FALSE,FALSE); } else { @@ -3281,8 +3231,8 @@ void writeIndex(OutputList &ol) ol.disable(OutputGenerator::Man); startFile(ol,Doxygen::mainPage->name(),0,Doxygen::mainPage->title()); ol.startTextBlock(); - ol.parseDoc(defFileName,defLine,0,0, - Doxygen::mainPage->documentation(),FALSE + ol.parseDoc(defFileName,defLine,Doxygen::mainPage,0, + Doxygen::mainPage->documentation(),FALSE,FALSE /*,Doxygen::mainPage->sectionDict*/); ol.endTextBlock(); endFile(ol); @@ -3293,3 +3243,5 @@ void writeIndex(OutputList &ol) ol.popGeneratorState(); } + + diff --git a/src/index.h b/src/index.h index c4e8f8d..042b641 100644 --- a/src/index.h +++ b/src/index.h @@ -69,22 +69,6 @@ void writePackageIndex(OutputList &ol); void countDataStructures(); -#if 0 -extern int annotatedClasses; -extern int hierarchyClasses; -extern int documentedFunctions; -extern int documentedMembers; -extern int documentedDefines; -extern int documentedFiles; -extern int documentedGroups; -extern int documentedNamespaces; -extern int documentedNamespaceMembers; -extern int documentedIncludeFiles; -extern int indexedPages; -#endif -extern int documentedHtmlFiles; -extern int documentedPages; - enum HighlightedItem { HLI_None=0, @@ -103,10 +87,59 @@ enum HighlightedItem HLI_Search }; +enum ClassMemberHighlight +{ + CMHL_All = 0, + CMHL_Functions, + CMHL_Variables, + CMHL_Typedefs, + CMHL_Enums, + CMHL_EnumValues, + CMHL_Related, + CMHL_Properties, + CMHL_Events, + CMHL_Total = CMHL_Events+1 +}; + +enum FileMemberHighlight +{ + FMHL_All = 0, + FMHL_Functions, + FMHL_Variables, + FMHL_Typedefs, + FMHL_Enums, + FMHL_EnumValues, + FMHL_Defines, + FMHL_Total = FMHL_Defines+1 +}; + +enum NamespaceMemberHighlight +{ + NMHL_All = 0, + NMHL_Functions, + NMHL_Variables, + NMHL_Typedefs, + NMHL_Enums, + NMHL_EnumValues, + NMHL_Total = FMHL_EnumValues+1 +}; + +extern int annotatedClasses; +extern int hierarchyClasses; +extern int documentedFiles; +extern int documentedGroups; +extern int documentedNamespaces; +extern int indexedPages; +extern int documentedClassMembers[CMHL_Total]; +extern int documentedFileMembers[FMHL_Total]; +extern int documentedNamespaceMembers[NMHL_Total]; +extern int documentedHtmlFiles; +extern int documentedPages; + void startTitle(OutputList &ol,const char *fileName); void endTitle(OutputList &ol,const char *fileName,const char *name); void startFile(OutputList &ol,const char *name,const char *manName, - const char *title,bool external=FALSE,HighlightedItem hli=HLI_None); + const char *title,HighlightedItem hli=HLI_None); void endFile(OutputList &ol,bool external=FALSE); #endif diff --git a/src/language.cpp b/src/language.cpp index eb2dcb9..e6e052d 100644 --- a/src/language.cpp +++ b/src/language.cpp @@ -26,7 +26,7 @@ #include "translator_nl.h" #endif #ifdef LANG_SE -//#include "translator_se.h" +#include "translator_se.h" #endif #ifdef LANG_CZ #include "translator_cz.h" @@ -138,9 +138,7 @@ bool setTranslator(const char *langName) #ifdef LANG_SE else if (L_EQUAL("swedish")) { - //theTranslator=new TranslatorSwedish; - theTranslator=new TranslatorEnglish; - err(obsoleteMsg); + theTranslator=new TranslatorSwedish; } #endif #ifdef LANG_CZ diff --git a/src/latexdocvisitor.cpp b/src/latexdocvisitor.cpp index bc20db5..459fddb 100644 --- a/src/latexdocvisitor.cpp +++ b/src/latexdocvisitor.cpp @@ -157,6 +157,11 @@ void LatexDocVisitor::visit(DocSymbol *s) else m_t << "\\^{" << s->letter() << "}"; break; + case DocSymbol::Slash: if (tolower(s->letter())=='o') + m_t << "\\" << s->letter(); + else + m_t << s->letter(); + break; case DocSymbol::Tilde: m_t << "\\~{" << s->letter() << "}"; break; case DocSymbol::Szlig: m_t << "\"s"; break; case DocSymbol::Cedil: m_t << "\\c{" << s->letter() << "}"; break; @@ -405,33 +410,33 @@ void LatexDocVisitor::visitPre(DocSimpleSect *s) switch(s->type()) { case DocSimpleSect::See: - m_t << theTranslator->trSeeAlso(); break; + filter(theTranslator->trSeeAlso()); break; case DocSimpleSect::Return: - m_t << theTranslator->trReturns(); break; + filter(theTranslator->trReturns()); break; case DocSimpleSect::Author: - m_t << theTranslator->trAuthor(TRUE,TRUE); break; + filter(theTranslator->trAuthor(TRUE,TRUE)); break; case DocSimpleSect::Authors: - m_t << theTranslator->trAuthor(TRUE,FALSE); break; + filter(theTranslator->trAuthor(TRUE,FALSE)); break; case DocSimpleSect::Version: - m_t << theTranslator->trVersion(); break; + filter(theTranslator->trVersion()); break; case DocSimpleSect::Since: - m_t << theTranslator->trSince(); break; + filter(theTranslator->trSince()); break; case DocSimpleSect::Date: - m_t << theTranslator->trDate(); break; + filter(theTranslator->trDate()); break; case DocSimpleSect::Note: - m_t << theTranslator->trNote(); break; + filter(theTranslator->trNote()); break; case DocSimpleSect::Warning: - m_t << theTranslator->trWarning(); break; + filter(theTranslator->trWarning()); break; case DocSimpleSect::Pre: - m_t << theTranslator->trPrecondition(); break; + filter(theTranslator->trPrecondition()); break; case DocSimpleSect::Post: - m_t << theTranslator->trPostcondition(); break; + filter(theTranslator->trPostcondition()); break; case DocSimpleSect::Invar: - m_t << theTranslator->trInvariant(); break; + filter(theTranslator->trInvariant()); break; case DocSimpleSect::Remark: - m_t << theTranslator->trRemarks(); break; + filter(theTranslator->trRemarks()); break; case DocSimpleSect::Attention: - m_t << theTranslator->trAttention(); break; + filter(theTranslator->trAttention()); break; case DocSimpleSect::User: break; case DocSimpleSect::Rcs: break; case DocSimpleSect::Unknown: break; @@ -636,7 +641,7 @@ void LatexDocVisitor::visitPre(DocInternal *) { if (m_hide) return; m_t << "\\begin{Desc}" << endl - << "\\item[" << theTranslator->trForInternalUseOnly() << "]" << endl; + << "\\item["; filter(theTranslator->trForInternalUseOnly()); m_t << "]" << endl; } void LatexDocVisitor::visitPost(DocInternal *) @@ -806,14 +811,14 @@ void LatexDocVisitor::visitPost(DocLink *lnk) void LatexDocVisitor::visitPre(DocRef *ref) { if (m_hide) return; - startLink(ref->ref(),ref->file(),ref->anchor()); + if (!ref->file().isEmpty()) startLink(ref->ref(),ref->file(),ref->anchor()); if (!ref->hasLinkText()) filter(ref->targetTitle()); } void LatexDocVisitor::visitPost(DocRef *ref) { if (m_hide) return; - endLink(ref->ref(),ref->file(),ref->anchor()); + if (!ref->file().isEmpty()) endLink(ref->ref(),ref->file(),ref->anchor()); } void LatexDocVisitor::visitPre(DocSecRefItem *) @@ -871,11 +876,11 @@ void LatexDocVisitor::visitPre(DocParamSect *s) switch(s->type()) { case DocParamSect::Param: - m_t << theTranslator->trParameters(); break; + filter(theTranslator->trParameters()); break; case DocParamSect::RetVal: - m_t << theTranslator->trReturnValues(); break; + filter(theTranslator->trReturnValues()); break; case DocParamSect::Exception: - m_t << theTranslator->trExceptions(); break; + filter(theTranslator->trExceptions()); break; default: ASSERT(0); } @@ -991,7 +996,7 @@ void LatexDocVisitor::endLink(const QString &ref,const QString &file,const QStri m_t << "}"; if (ref.isEmpty() && !Config_getBool("PDF_HYPERLINKS")) { - m_t << "{\\rm (" << theTranslator->trPageAbbreviation(); + m_t << "{\\rm ("; filter(theTranslator->trPageAbbreviation()); m_t << "\\,\\pageref{" << file; if (!anchor.isEmpty()) m_t << "_" << anchor; m_t << "})}"; diff --git a/src/latexgen.cpp b/src/latexgen.cpp index a82b854..c931954 100644 --- a/src/latexgen.cpp +++ b/src/latexgen.cpp @@ -221,7 +221,7 @@ void LatexGenerator::init() t << endl << "clean:" << endl - << "\trm -f *.ps *.dvi *.aux *.toc *.idx *.ind *.ilg *.log *.out" << endl; + << "\trm -f *.ps *.dvi *.aux *.toc *.idx *.ind *.ilg *.log *.out *.pdf" << endl; } static void writeDefaultHeaderPart1(QTextStream &t) @@ -435,7 +435,7 @@ void LatexGenerator::writeStyleSheetFile(QFile &f) writeDefaultStyleSheetPart3(t); } -void LatexGenerator::startFile(const char *name,const char *,const char *,bool) +void LatexGenerator::startFile(const char *name,const char *,const char *) { QCString fileName=name; if (fileName.right(4)!=".tex" && fileName.right(4)!=".sty") fileName+=".tex"; diff --git a/src/latexgen.h b/src/latexgen.h index 5570002..f62f9a2 100644 --- a/src/latexgen.h +++ b/src/latexgen.h @@ -44,9 +44,8 @@ class LatexGenerator : public OutputGenerator void printDoc(DocNode *); - void startFile(const char *name,const char *manName, - const char *title, bool external); - void writeFooter(int,bool) {} + void startFile(const char *name,const char *manName,const char *title); + void writeFooter() {} void endFile(); void clearBuffer(); @@ -234,8 +233,9 @@ class LatexGenerator : public OutputGenerator //void endColorFont() {} void startPageRef(); void endPageRef(const char *,const char *); - void startQuickIndexItem(const char *,const char *) {} - void endQuickIndexItem() {} + //void startQuickIndexItem(const char *,const char *) {} + //void endQuickIndexItem() {} + void writeQuickLinks(bool,HighlightedItem) {} //void writeFormula(const char *,const char *); void writeNonBreakableSpace(int); //void startImage(const char *,const char *,bool); diff --git a/src/libdoxygen.pro.in b/src/libdoxygen.pro.in index a43ae1a..2944c2a 100644 --- a/src/libdoxygen.pro.in +++ b/src/libdoxygen.pro.in @@ -79,9 +79,9 @@ HEADERS = bufstr.h \ rtfstyle.h \ scanner.h \ searchindex.h \ + search_php.h \ section.h \ sortdict.h \ - suffixtree.h \ tagreader.h \ translator.h \ translator_adapter.h \ @@ -173,7 +173,6 @@ SOURCES = ce_lex.cpp \ rtfstyle.cpp \ scanner.cpp \ searchindex.cpp \ - suffixtree.cpp \ tagreader.cpp \ translator.cpp \ util.cpp \ diff --git a/src/libdoxygen.t b/src/libdoxygen.t index 1008cd9..48f34ee 100644 --- a/src/libdoxygen.t +++ b/src/libdoxygen.t @@ -82,3 +82,6 @@ index_xsd.h: index.xsd compound_xsd.h: compound.xsd cat compound.xsd | sed -e "s/\\\\/\\\\\\\\/g" -e "s/\"/\\\\\"/g" -e "s/^/\"/g" -e "s/$$/\\\\n\"/g" >compound_xsd.h +search_php.h: search.php + cat search.php | sed -e "s/\\\\/\\\\\\\\/g" -e "s/\"/\\\\\"/g" -e "s/^/\"/g" -e "s/$$/\\\\n\"/g" >search_php.h + diff --git a/src/mandocvisitor.cpp b/src/mandocvisitor.cpp index 2908460..341a50d 100644 --- a/src/mandocvisitor.cpp +++ b/src/mandocvisitor.cpp @@ -89,6 +89,7 @@ void ManDocVisitor::visit(DocSymbol *s) case DocSymbol::Acute: m_t << s->letter() << "\\*(`"; break; case DocSymbol::Grave: m_t << s->letter() << "\\*:"; break; case DocSymbol::Circ: m_t << s->letter() << "\\*^"; break; + case DocSymbol::Slash: m_t << s->letter(); break; /* todo: implement this */ case DocSymbol::Tilde: m_t << s->letter() << "\\*~"; break; case DocSymbol::Szlig: m_t << "s\\*:"; break; case DocSymbol::Cedil: m_t << s->letter() << "\\*,"; break; diff --git a/src/mangen.cpp b/src/mangen.cpp index 77cc5ce..673636e 100644 --- a/src/mangen.cpp +++ b/src/mangen.cpp @@ -137,8 +137,7 @@ static QCString buildFileName(const char *name) return fileName; } -void ManGenerator::startFile(const char *,const char *manName, - const char *,bool) +void ManGenerator::startFile(const char *,const char *manName,const char *) { startPlainFile( buildFileName( manName ) ); firstCol=TRUE; diff --git a/src/mangen.h b/src/mangen.h index d628358..94077d6 100644 --- a/src/mangen.h +++ b/src/mangen.h @@ -42,9 +42,8 @@ class ManGenerator : public OutputGenerator void printDoc(DocNode *); static void init(); - void startFile(const char *name,const char *manName, - const char *title,bool external); - void writeFooter(int,bool) {} + void startFile(const char *name,const char *manName,const char *title); + void writeFooter() {} void endFile(); void clearBuffer(); @@ -207,8 +206,9 @@ class ManGenerator : public OutputGenerator //void endColorFont() {} void startPageRef() {} void endPageRef(const char *,const char *) {} - void startQuickIndexItem(const char *,const char *) {} - void endQuickIndexItem() {} + //void startQuickIndexItem(const char *,const char *) {} + //void endQuickIndexItem() {} + void writeQuickLinks(bool,HighlightedItem) {} //void writeFormula(const char *,const char *) {} void writeNonBreakableSpace(int n) { int i; for (i=0;i<n;i++) t << " "; } //void startImage(const char *,const char *,bool) {} diff --git a/src/memberdef.cpp b/src/memberdef.cpp index dfa8d07..3fd6791 100644 --- a/src/memberdef.cpp +++ b/src/memberdef.cpp @@ -336,6 +336,7 @@ MemberDef::MemberDef(const char *df,int dl, { tArgList=0; } + //printf("new member al=%p\n",al); // copy function definition arguments (if any) if (al) { @@ -933,7 +934,7 @@ void MemberDef::writeDeclaration(OutputList &ol, !annMemb) { ol.startMemberDescription(); - ol.parseDoc(briefFile(),briefLine(),osname,this,briefDescription(),FALSE); + ol.parseDoc(briefFile(),briefLine(),getOuterScope()?getOuterScope():d,this,briefDescription(),TRUE,FALSE); if (detailsVisible) { ol.pushGeneratorState(); @@ -1291,14 +1292,14 @@ void MemberDef::writeDocumentation(MemberList *ml,OutputList &ol, ) ) { - ol.parseDoc(briefFile(),briefLine(),scopeName,this,brief,FALSE); + ol.parseDoc(briefFile(),briefLine(),getOuterScope()?getOuterScope():container,this,brief,FALSE,FALSE); ol.newParagraph(); } /* write detailed description */ if (!detailed.isEmpty()) { - ol.parseDoc(docFile(),docLine(),scopeName,this,detailed+"\n",FALSE); + ol.parseDoc(docFile(),docLine(),getOuterScope()?getOuterScope():container,this,detailed+"\n",TRUE,FALSE); ol.pushGeneratorState(); ol.disableAllBut(OutputGenerator::RTF); ol.newParagraph(); @@ -1333,7 +1334,7 @@ void MemberDef::writeDocumentation(MemberList *ml,OutputList &ol, ol.docify(a->name); ol.endDescTableTitle(); ol.startDescTableData(); - ol.parseDoc(docFile(),docLine(),scopeName,this,a->docs+"\n",FALSE); + ol.parseDoc(docFile(),docLine(),getOuterScope()?getOuterScope():container,this,a->docs+"\n",TRUE,FALSE); ol.endDescTableData(); } } @@ -1368,12 +1369,12 @@ void MemberDef::writeDocumentation(MemberList *ml,OutputList &ol, HtmlHelp::getInstance()->addIndexItem(cname,fmd->name(),cfname,fmd->anchor()); } //ol.writeListItem(); - ol.startDescTableTitle(); + ol.startDescTableTitle(); // this enables emphasis! ol.startDoxyAnchor(cfname,cname,fmd->anchor(),fmd->name()); first=FALSE; - ol.startEmphasis(); + //ol.startEmphasis(); ol.docify(fmd->name()); - ol.endEmphasis(); + //ol.endEmphasis(); ol.disableAllBut(OutputGenerator::Man); ol.writeString(" "); ol.enableAll(); @@ -1384,7 +1385,7 @@ void MemberDef::writeDocumentation(MemberList *ml,OutputList &ol, if (!fmd->briefDescription().isEmpty()) { - ol.parseDoc(fmd->briefFile(),fmd->briefLine(),scopeName,fmd,fmd->briefDescription(),FALSE); + ol.parseDoc(fmd->briefFile(),fmd->briefLine(),getOuterScope()?getOuterScope():container,fmd,fmd->briefDescription(),TRUE,FALSE); //ol.newParagraph(); } if (!fmd->briefDescription().isEmpty() && @@ -1394,7 +1395,7 @@ void MemberDef::writeDocumentation(MemberList *ml,OutputList &ol, } if (!fmd->documentation().isEmpty()) { - ol.parseDoc(fmd->docFile(),fmd->docLine(),scopeName,fmd,fmd->documentation()+"\n",FALSE); + ol.parseDoc(fmd->docFile(),fmd->docLine(),getOuterScope()?getOuterScope():container,fmd,fmd->documentation()+"\n",TRUE,FALSE); } ol.endDescTableData(); } @@ -1814,6 +1815,7 @@ void MemberDef::setInitializer(const char *initializer) void MemberDef::addListReference(Definition *d) { visited=TRUE; + if (!isLinkableInProject()) return; QCString memLabel; if (Config_getBool("OPTIMIZE_OUTPUT_FOR_C")) { diff --git a/src/memberlist.cpp b/src/memberlist.cpp index ef5e884..dfb9842 100644 --- a/src/memberlist.cpp +++ b/src/memberlist.cpp @@ -235,8 +235,9 @@ void MemberList::writePlainDeclarations(OutputList &ol, ol.startMemberDescription(); ol.parseDoc( md->briefFile(),md->briefLine(), - cd?cd->name().data():0,md, + cd,md, md->briefDescription(), + TRUE, FALSE ); if (md->isDetailedSectionLinkable()) @@ -322,7 +323,7 @@ void MemberList::writeDeclarations(OutputList &ol, { //printf("subtitle=`%s'\n",subtitle); ol.startMemberSubtitle(); - ol.parseDoc("<generated>",1,0,0,subtitle,FALSE); + ol.parseDoc("<generated>",1,0,0,subtitle,FALSE,FALSE); ol.endMemberSubtitle(); } @@ -346,7 +347,7 @@ void MemberList::writeDeclarations(OutputList &ol, { //printf("Member group has docs!\n"); ol.startMemberGroupDocs(); - ol.parseDoc("<generated>",1,0,0,mg->documentation()+"\n",FALSE); + ol.parseDoc("<generated>",1,0,0,mg->documentation()+"\n",FALSE,FALSE); ol.endMemberGroupDocs(); } ol.startMemberGroup(); diff --git a/src/namespacedef.cpp b/src/namespacedef.cpp index 1cb0dca..edd0add 100644 --- a/src/namespacedef.cpp +++ b/src/namespacedef.cpp @@ -221,7 +221,7 @@ void NamespaceDef::writeDetailedDocumentation(OutputList &ol) ol.startTextBlock(); if (!briefDescription().isEmpty() && Config_getBool("REPEAT_BRIEF")) { - ol.parseDoc(briefFile(),briefLine(),name(),0,briefDescription(),FALSE); + ol.parseDoc(briefFile(),briefLine(),this,0,briefDescription(),FALSE,FALSE); } if (!briefDescription().isEmpty() && Config_getBool("REPEAT_BRIEF") && !documentation().isEmpty()) @@ -236,7 +236,7 @@ void NamespaceDef::writeDetailedDocumentation(OutputList &ol) } if (!documentation().isEmpty()) { - ol.parseDoc(docFile(),docLine(),name(),0,documentation()+"\n",FALSE); + ol.parseDoc(docFile(),docLine(),this,0,documentation()+"\n",TRUE,FALSE); ol.newParagraph(); } ol.endTextBlock(); @@ -276,7 +276,7 @@ void NamespaceDef::writeDocumentation(OutputList &ol) } else if (!briefDescription().isEmpty()) { - ol.parseDoc(briefFile(),briefLine(),name(),0,briefDescription(),FALSE); + ol.parseDoc(briefFile(),briefLine(),this,0,briefDescription(),TRUE,FALSE); ol.writeString(" \n"); ol.pushGeneratorState(); ol.disableAllBut(OutputGenerator::Html); diff --git a/src/outputgen.h b/src/outputgen.h index 54be83a..8e85837 100644 --- a/src/outputgen.h +++ b/src/outputgen.h @@ -275,8 +275,8 @@ class OutputGenerator : public BaseOutputDocInterface // structural output interface /////////////////////////////////////////////////////////////// virtual void startFile(const char *name,const char *manName, - const char *title,bool ext) = 0; - virtual void writeFooter(int,bool) = 0; + const char *title) = 0; + virtual void writeFooter() = 0; virtual void endFile() = 0; virtual void startIndexSection(IndexSections) = 0; virtual void endIndexSection(IndexSections) = 0; @@ -338,8 +338,9 @@ class OutputGenerator : public BaseOutputDocInterface virtual void startCallGraph() = 0; virtual void endCallGraph(DotCallGraph &g) = 0; virtual void writeGraphicalHierarchy(DotGfxHierarchyTable &g) = 0; - virtual void startQuickIndexItem(const char *s,const char *l) = 0; - virtual void endQuickIndexItem() = 0; + //virtual void startQuickIndexItem(const char *s,const char *l) = 0; + //virtual void endQuickIndexItem() = 0; + virtual void writeQuickLinks(bool compact,HighlightedItem hli) = 0; virtual void startTextBlock(bool) = 0; virtual void endTextBlock() = 0; virtual void lastIndexPage() = 0; diff --git a/src/outputlist.cpp b/src/outputlist.cpp index a00875b..7f3648b 100644 --- a/src/outputlist.cpp +++ b/src/outputlist.cpp @@ -192,9 +192,9 @@ void OutputList::popGeneratorState() } void OutputList::parseDoc(const char *fileName,int startLine, - const char * clName,MemberDef * md, - const QCString &docStr,bool isExample, - const char *exampleName) + Definition *ctx,MemberDef * md, + const QCString &docStr,bool indexWords, + bool isExample,const char *exampleName) { int count=0; if (docStr.isEmpty()) return; @@ -211,12 +211,12 @@ void OutputList::parseDoc(const char *fileName,int startLine, if (docStr.at(docStr.length()-1)=='\n') { root = validatingParseDoc(fileName,startLine, - clName,md,docStr,isExample,exampleName); + ctx,md,docStr,indexWords,isExample,exampleName); } else { root = validatingParseDoc(fileName,startLine, - clName,md,docStr+"\n",isExample,exampleName); + ctx,md,docStr+"\n",indexWords,isExample,exampleName); } og=outputs->first(); @@ -334,6 +334,7 @@ FORALL2(bool a1,bool a2,a1,a2) FORALL4(const char *a1,const char *a2,const char *a3,bool a4,a1,a2,a3,a4) #endif FORALL2(int a1,bool a2,a1,a2) +FORALL2(bool a1,HighlightedItem a2,a1,a2) FORALL2(ParamListTypes a1,const char *a2,a1,a2) FORALL1(IndexSections a1,a1) FORALL2(const char *a1,const char *a2,a1,a2) diff --git a/src/outputlist.h b/src/outputlist.h index 9668c4f..08e0694 100644 --- a/src/outputlist.h +++ b/src/outputlist.h @@ -61,8 +61,8 @@ class OutputList : public OutputDocInterface ////////////////////////////////////////////////// void parseDoc(const char *fileName,int startLine, - const char *clName,MemberDef *md,const QCString &docStr, - bool isExample,const char *exampleName=0); + Definition *ctx,MemberDef *md,const QCString &docStr, + bool indexWords,bool isExample,const char *exampleName=0); void parseText(const QCString &textStr); @@ -76,11 +76,10 @@ class OutputList : public OutputDocInterface { forall(&OutputGenerator::endProjectNumber); } void writeStyleInfo(int part) { forall(&OutputGenerator::writeStyleInfo,part); } - void startFile(const char *name,const char *manName, - const char *title,bool external) - { forall(&OutputGenerator::startFile,name,manName,title,external); } - void writeFooter(int fase,bool external) - { forall(&OutputGenerator::writeFooter,fase,external); } + void startFile(const char *name,const char *manName,const char *title) + { forall(&OutputGenerator::startFile,name,manName,title); } + void writeFooter() + { forall(&OutputGenerator::writeFooter); } void endFile() { forall(&OutputGenerator::endFile); } void startTitleHead(const char *fileName) @@ -286,10 +285,12 @@ class OutputList : public OutputDocInterface { forall(&OutputGenerator::startPageRef); } void endPageRef(const char *c,const char *a) { forall(&OutputGenerator::endPageRef,c,a); } - void startQuickIndexItem(const char *s,const char *l) - { forall(&OutputGenerator::startQuickIndexItem,s,l); } - void endQuickIndexItem() - { forall(&OutputGenerator::endQuickIndexItem); } + //void startQuickIndexItem(const char *s,const char *l) + //{ forall(&OutputGenerator::startQuickIndexItem,s,l); } + //void endQuickIndexItem() + //{ forall(&OutputGenerator::endQuickIndexItem); } + void writeQuickLinks(bool compact,HighlightedItem hli) + { forall(&OutputGenerator::writeQuickLinks,compact,hli); } void writeNonBreakableSpace(int num) { forall(&OutputGenerator::writeNonBreakableSpace,num); } void startDescTable() @@ -390,6 +391,7 @@ class OutputList : public OutputDocInterface FORALLPROTO4(const char *,const char *,const char *,int); #endif FORALLPROTO2(int,bool); + FORALLPROTO2(bool,HighlightedItem); FORALLPROTO2(ParamListTypes,const char *); FORALLPROTO2(const char *,const char *); FORALLPROTO2(const char *,bool); diff --git a/src/packagedef.cpp b/src/packagedef.cpp deleted file mode 100644 index ecea2f7..0000000 --- a/src/packagedef.cpp +++ /dev/null @@ -1,126 +0,0 @@ -/****************************************************************************** - * - * - * - * Copyright (C) 1997-2003 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 - * for any purpose. It is provided "as is" without express or implied warranty. - * See the GNU General Public License for more details. - * - * Documents produced by Doxygen are derivative works derived from the - * input used in their production; they are not affected by this license. - * - */ - -#include <ctype.h> -#include "packagedef.h" -#include "qtbc.h" -#include "classdef.h" -#include "classlist.h" -#include "outputlist.h" -#include "util.h" -#include "config.h" -#include "language.h" -#include "doxygen.h" - -PackageDef::PackageDef(const char *df,int dl,const char *na,const char *ref) : - Definition(df,dl,na) -{ - classSDict = new ClassSDict(17); - packageFileName = (QCString)"package_"+na; - setReference(ref); -} - -PackageDef::~PackageDef() -{ - delete classSDict; -} - -void PackageDef::addClass(const ClassDef *cd) -{ - if (Config_getBool("SORT_MEMBER_DOCS")) - classSDict->inSort(cd->name(),cd); - else - classSDict->append(cd->name(),cd); -} - -void PackageDef::writeDocumentation(OutputList &ol) -{ - QCString title = theTranslator->trPackage(name()); - ol.pushGeneratorState(); - ol.disable(OutputGenerator::Man); - startFile(ol,getOutputFileBase(),name(),title); - startTitle(ol,getOutputFileBase()); - ol.docify(title); - endTitle(ol,getOutputFileBase(),title); - - if (!briefDescription().isEmpty()) - { - ol.parseDoc(briefFile(),briefLine(),name(),0,briefDescription(),FALSE); - ol.writeString(" \n"); - ol.pushGeneratorState(); - ol.disable(OutputGenerator::Latex); - ol.disable(OutputGenerator::RTF); - ol.startTextLink(0,"_details"); - ol.parseText(theTranslator->trMore()); - ol.endTextLink(); - ol.popGeneratorState(); - } - - if (!Config_getString("GENERATE_TAGFILE").isEmpty()) - { - Doxygen::tagFile << " <compound kind=\"package\">" << endl; - } - - ol.startMemberSections(); - ClassDef::CompoundType ct; - ct=ClassDef::Interface; - classSDict->writeDeclaration(ol,&ct,theTranslator->trInterfaces()); - ct=ClassDef::Class; - classSDict->writeDeclaration(ol,&ct,theTranslator->trClasses()); - ol.endMemberSections(); - - if (!Config_getString("GENERATE_TAGFILE").isEmpty()) - { - writeDocAnchorsToTagFile(); - Doxygen::tagFile << " </compound>" << endl; - } - - if (!briefDescription().isEmpty() || !documentation().isEmpty()) - { - ol.writeRuler(); - ol.pushGeneratorState(); - ol.disable(OutputGenerator::Latex); - ol.disable(OutputGenerator::RTF); - ol.writeAnchor(0,"_details"); - ol.popGeneratorState(); - ol.startGroupHeader(); - ol.parseText(theTranslator->trDetailedDescription()); - ol.endGroupHeader(); - - // repeat brief description - if (!briefDescription().isEmpty() && Config_getBool("REPEAT_BRIEF")) - { - ol.parseDoc(briefFile(),briefLine(),name(),0,briefDescription(),FALSE); - ol.newParagraph(); - } - - // write documentation - if (!documentation().isEmpty()) - { - ol.parseDoc(docFile(),docLine(),name(),0,documentation()+"\n",FALSE); - } - } - - endFile(ol); - ol.popGeneratorState(); -} - -QCString PackageDef::getOutputFileBase() const -{ - return convertNameToFile(packageFileName); -} - diff --git a/src/packagedef.h b/src/packagedef.h deleted file mode 100644 index 0835f74..0000000 --- a/src/packagedef.h +++ /dev/null @@ -1,68 +0,0 @@ -/****************************************************************************** - * - * - * - * Copyright (C) 1997-2003 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 - * for any purpose. It is provided "as is" without express or implied warranty. - * See the GNU General Public License for more details. - * - * Documents produced by Doxygen are derivative works derived from the - * input used in their production; they are not affected by this license. - * - */ - -#ifndef PACKAGEDEF_H -#define PACKAGEDEF_H - -#include "qtbc.h" -#include <qlist.h> -#include <qdict.h> -#include "definition.h" -#include "sortdict.h" - -class ClassSDict; -class ClassDef; -class PackageList; -class OutputList; - -class PackageDef : public Definition -{ - public: - PackageDef(const char *fName,int line, const char *name,const char *ref=0); - ~PackageDef(); - DefType definitionType() { return TypePackage; } - QCString getOutputFileBase() const ; - void addClass(const ClassDef *def); - void writeDocumentation(OutputList &ol); - bool isLinkableInProject() const - { - return hasDocumentation() && !isReference(); - } - bool isLinkable() const - { - return isLinkableInProject() || isReference(); - } - - private: - QCString packageFileName; // base name of the generated file - ClassSDict *classSDict; // list of classes in the package -}; - -class PackageSDict : public SDict<PackageDef> -{ - public: - PackageSDict(int size) : SDict<PackageDef>(size) {} - int compareItems(GCI item1,GCI item2) - { - return stricmp(((PackageDef *)item1)->name(), - ((PackageDef *)item2)->name() - ); - } -}; - -#endif - diff --git a/src/perlmodgen.cpp b/src/perlmodgen.cpp index 2574f6b..bd676ad 100644 --- a/src/perlmodgen.cpp +++ b/src/perlmodgen.cpp @@ -537,6 +537,7 @@ void PerlModDocVisitor::visit(DocSymbol *sy) case DocSymbol::Acute: accent = "acute"; break; case DocSymbol::Grave: accent = "grave"; break; case DocSymbol::Circ: accent = "circ"; break; + case DocSymbol::Slash: accent = "slash"; break; case DocSymbol::Tilde: accent = "tilde"; break; case DocSymbol::Cedil: accent = "cedilla"; break; case DocSymbol::Ring: accent = "ring"; break; @@ -1265,7 +1266,7 @@ static void addPerlModDocBlock(PerlModOutput &output, const char *name, const QCString &fileName, int lineNr, - const QCString &scope, + Definition *scope, MemberDef *md, const QCString &text) { @@ -1395,12 +1396,6 @@ void PerlModGenerator::generatePerlModForMember(MemberDef *md,Definition *) case MemberDef::Event: memType="event"; break; } - QCString scopeName; - if (md->getClassDef()) - scopeName=md->getClassDef()->name(); - else if (md->getNamespaceDef()) - scopeName=md->getNamespaceDef()->name(); - m_output.openHash() .addFieldQuotedString("kind", memType) .addFieldQuotedString("name", md->name()) @@ -1408,8 +1403,8 @@ void PerlModGenerator::generatePerlModForMember(MemberDef *md,Definition *) .addFieldQuotedString("protection", getProtectionName(md->protection())) .addFieldBoolean("static", md->isStatic()); - addPerlModDocBlock(m_output,"brief",md->getDefFileName(),md->getDefLine(),scopeName,md,md->briefDescription()); - addPerlModDocBlock(m_output,"detailed",md->getDefFileName(),md->getDefLine(),scopeName,md,md->documentation()); + addPerlModDocBlock(m_output,"brief",md->getDefFileName(),md->getDefLine(),md->getOuterScope(),md,md->briefDescription()); + addPerlModDocBlock(m_output,"detailed",md->getDefFileName(),md->getDefLine(),md->getOuterScope(),md,md->documentation()); if (md->memberType()!=MemberDef::Define && md->memberType()!=MemberDef::Enumeration) m_output.addFieldQuotedString("type", md->typeString()); @@ -1492,9 +1487,9 @@ void PerlModGenerator::generatePerlModForMember(MemberDef *md,Definition *) if (!emd->initializer().isEmpty()) m_output.addFieldQuotedString("initializer", emd->initializer()); - addPerlModDocBlock(m_output,"brief",emd->getDefFileName(),emd->getDefLine(),scopeName,emd,emd->briefDescription()); + addPerlModDocBlock(m_output,"brief",emd->getDefFileName(),emd->getDefLine(),emd->getOuterScope(),emd,emd->briefDescription()); - addPerlModDocBlock(m_output,"detailed",emd->getDefFileName(),emd->getDefLine(),scopeName,emd,emd->documentation()); + addPerlModDocBlock(m_output,"detailed",emd->getDefFileName(),emd->getDefLine(),emd->getOuterScope(),emd,emd->documentation()); m_output.closeHash(); } @@ -1690,8 +1685,8 @@ void PerlModGenerator::generatePerlModForClass(ClassDef *cd) generatePerlModSection(cd,&cd->friends,"friend_methods"); generatePerlModSection(cd,&cd->related,"related_methods"); - addPerlModDocBlock(m_output,"brief",cd->getDefFileName(),cd->getDefLine(),cd->name(),0,cd->briefDescription()); - addPerlModDocBlock(m_output,"detailed",cd->getDefFileName(),cd->getDefLine(),cd->name(),0,cd->documentation()); + addPerlModDocBlock(m_output,"brief",cd->getDefFileName(),cd->getDefLine(),cd,0,cd->briefDescription()); + addPerlModDocBlock(m_output,"detailed",cd->getDefFileName(),cd->getDefLine(),cd,0,cd->documentation()); #if 0 DotClassGraph inheritanceGraph(cd,DotClassGraph::Inheritance); @@ -1979,10 +1979,11 @@ void preprocessFile(const char *fileName,BufStr &output) g_expandedDict->clear(); // add predefined macros - char *defStr = Config_getList("PREDEFINED").first(); - while (defStr) + char *defStr; + QStrList &predefList = Config_getList("PREDEFINED"); + QStrListIterator sli(predefList); + for (sli.toFirst();(defStr=sli.current());++sli) { - //printf("Predefined: `%s'\n",defStr); QCString ds = defStr; int i_equals=ds.find('='); int i_obrace=ds.find('('); @@ -2068,7 +2069,6 @@ void preprocessFile(const char *fileName,BufStr &output) // def->name.data(),def->definition.data(),def->nargs); } - defStr=Config_getList("PREDEFINED").next(); } QCString &inputFilter = Config_getString("INPUT_FILTER"); diff --git a/src/rtfdocvisitor.cpp b/src/rtfdocvisitor.cpp index 2221d2d..8cbfc4f 100644 --- a/src/rtfdocvisitor.cpp +++ b/src/rtfdocvisitor.cpp @@ -182,6 +182,13 @@ void RTFDocVisitor::visit(DocSymbol *s) default: m_t << '?'; break; } break; + case DocSymbol::Slash: switch(s->letter()) + { + case 'O' : m_t << '\330'; break; + case 'o' : m_t << '\370'; break; + default: m_t << '?'; break; + } + break; case DocSymbol::Ring: switch(s->letter()) { case 'A' : m_t << '\305'; break; @@ -899,14 +906,14 @@ void RTFDocVisitor::visitPost(DocLink *lnk) void RTFDocVisitor::visitPre(DocRef *ref) { if (m_hide) return; - startLink(ref->ref(),ref->file(),ref->anchor()); + if (!ref->file().isEmpty()) startLink(ref->ref(),ref->file(),ref->anchor()); if (!ref->hasLinkText()) filter(ref->targetTitle()); } void RTFDocVisitor::visitPost(DocRef *ref) { if (m_hide) return; - endLink(ref->ref()); + if (!ref->file().isEmpty()) endLink(ref->ref()); m_t << " "; } diff --git a/src/rtfgen.cpp b/src/rtfgen.cpp index 3c5d7a3..43dc994 100644 --- a/src/rtfgen.cpp +++ b/src/rtfgen.cpp @@ -319,8 +319,7 @@ void RTFGenerator::beginRTFSection() t << rtf_Style["Heading2"]->reference << "\n"; } -void RTFGenerator::startFile(const char *name,const char *, - const char *, bool ) +void RTFGenerator::startFile(const char *name,const char *,const char *) { QCString fileName=name; diff --git a/src/rtfgen.h b/src/rtfgen.h index 099ca31..0e58d7c 100644 --- a/src/rtfgen.h +++ b/src/rtfgen.h @@ -44,9 +44,8 @@ class RTFGenerator : public OutputGenerator void printDoc(DocNode *); - void startFile(const char *name,const char *manName, - const char *title, bool external); - void writeFooter(int,bool) {} + void startFile(const char *name,const char *manName,const char *title); + void writeFooter() {} void endFile(); void clearBuffer(); @@ -203,8 +202,9 @@ class RTFGenerator : public OutputGenerator //void endColorFont() {} void startPageRef(); void endPageRef(const char *,const char *); - void startQuickIndexItem(const char *,const char *) {} - void endQuickIndexItem() {} + //void startQuickIndexItem(const char *,const char *) {} + //void endQuickIndexItem() {} + void writeQuickLinks(bool,HighlightedItem) {} //void writeFormula(const char *,const char *); void writeNonBreakableSpace(int); //void startImage(const char *,const char *,bool); diff --git a/src/scanner.l b/src/scanner.l index 23d1b29..1c33319 100644 --- a/src/scanner.l +++ b/src/scanner.l @@ -3210,7 +3210,7 @@ PHPKW ("require"|"require_once"|"include"|"include_once"|"echo")[^a-zA-Z0-9_;] } BEGIN( LineDoc ); } -<FindMembers>"extern"{BN}+"\"C"("++")?"\""{BN}*("{")? { +<FindMembers>"extern"{BN}*"\"C"("++")?"\""{BN}*("{")? { lineCount(); } <FindMembers>"{" { @@ -3852,10 +3852,10 @@ PHPKW ("require"|"require_once"|"include"|"include_once"|"echo")[^a-zA-Z0-9_;] BEGIN(AnchorLabel); } <Doc,PageDoc,ClassDoc>("\\\\"|"@@")("verbatim"|"latexonly"|"htmlonly")/[^a-z_A-Z0-9] { - current->doc+="\\\\verbatim"; + current->doc+=yytext; } <JavaDoc>("\\\\"|"@@")("verbatim"|"latexonly"|"htmlonly")/[^a-z_A-Z0-9] { - current->brief+="\\\\verbatim"; + current->brief+=yytext; } <Doc,PageDoc,ClassDoc>{CMD}"verbatim"/[^a-z_A-Z0-9] { lastVerbState=YY_START; diff --git a/src/search.php b/src/search.php new file mode 100644 index 0000000..3900f6b --- /dev/null +++ b/src/search.php @@ -0,0 +1,303 @@ +function readInt($file) +{ + $b1 = ord(fgetc($file)); $b2 = ord(fgetc($file)); + $b3 = ord(fgetc($file)); $b4 = ord(fgetc($file)); + return ($b1<<24)|($b2<<16)|($b3<<8)|$b4; +} + +function readString($file) +{ + $result=""; + while (ord($c=fgetc($file))) $result.=$c; + return $result; +} + +function readHeader($file) +{ + $header =fgetc($file); $header.=fgetc($file); + $header.=fgetc($file); $header.=fgetc($file); + return $header; +} + +function computeIndex($word) +{ + if (strlen($word)<2) return -1; + // high char of the index + $hi = ord($word{0}); + if ($hi==0) return -1; + // low char of the index + $lo = ord($word{1}); + if ($lo==0) return -1; + // return index + return $hi*256+$lo; +} + +function search($file,$word,&$statsList) +{ + $index = computeIndex($word); + if ($index!=-1) // found a valid index + { + fseek($file,$index*4+4); // 4 bytes per entry, skip header + $index = readInt($file); + if ($index) // found words matching first two characters + { + $start=sizeof($statsList); + $count=$start; + fseek($file,$index); + $w = readString($file); + while ($w) + { + $statIdx = readInt($file); + if ($word==substr($w,0,strlen($word))) + { // found word that matches (as substring) + $statsList[$count++]=array( + "word"=>$word, + "match"=>$w, + "index"=>$statIdx, + "full"=>strlen($w)==strlen($word), + "docs"=>array() + ); + } + $w = readString($file); + } + $totalFreq=0; + for ($count=$start;$count<sizeof($statsList);$count++) + { + $statInfo = &$statsList[$count]; + fseek($file,$statInfo["index"]); + $numDocs = readInt($file); + $docInfo = array(); + // read docs info + occurrence frequency of the word + for ($i=0;$i<$numDocs;$i++) + { + $idx=readInt($file); + $freq=readInt($file); + $docInfo[$i]=array("idx"=>$idx,"freq"=>$freq,"rank"=>0.0); + $totalFreq+=$freq; + if ($statInfo["full"]) $totalfreq+=$freq; + } + // read name an url info for the doc + for ($i=0;$i<$numDocs;$i++) + { + fseek($file,$docInfo[$i]["idx"]); + $docInfo[$i]["name"]=readString($file); + $docInfo[$i]["url"]=readString($file); + } + $statInfo["docs"]=$docInfo; + } + for ($count=$start;$count<sizeof($statsList);$count++) + { + $statInfo = &$statsList[$count]; + for ($i=0;$i<sizeof($statInfo["docs"]);$i++) + { + $docInfo = &$statInfo["docs"]; + // compute frequency rank of the word in each doc + $statInfo["docs"][$i]["rank"]= + (float)$docInfo[$i]["freq"]/$totalFreq; + } + } + } + } + return $statsList; +} + +function combine_results($results,&$docs) +{ + foreach ($results as $wordInfo) + { + $docsList = &$wordInfo["docs"]; + foreach ($docsList as $di) + { + $key=$di["url"]; + $rank=$di["rank"]; + if (in_array($key, array_keys($docs))) + { + $docs[$key]["rank"]+=$rank; + $docs[$key]["rank"]*=2; // multiple matches increases rank + } + else + { + $docs[$key] = array("url"=>$key, + "name"=>$di["name"], + "rank"=>$rank + ); + } + $docs[$key]["words"][] = array( + "word"=>$wordInfo["word"], + "match"=>$wordInfo["match"], + "freq"=>$di["freq"] + ); + } + } + return $docs; +} + +function normalize_ranking(&$docs) +{ + $maxRank = 0.0000001; + // compute maximal rank + foreach ($docs as $doc) + { + if ($doc["rank"]>$maxRank) + { + $maxRank=$doc["rank"]; + } + } + reset($docs); + // normalize rankings + while (list ($key, $val) = each ($docs)) + { + $docs[$key]["rank"]*=100/$maxRank; + } +} + +function filter_results($docs,&$requiredWords,&$forbiddenWords) +{ + $filteredDocs=array(); + while (list ($key, $val) = each ($docs)) + { + $words = &$docs[$key]["words"]; + $copy=1; // copy entry by default + if (sizeof($requiredWords)>0) + { + foreach ($requiredWords as $reqWord) + { + $found=0; + foreach ($words as $wordInfo) + { + $found = $wordInfo["word"]==$reqWord; + if ($found) break; + } + if (!$found) + { + $copy=0; // document contains none of the required words + break; + } + } + } + if (sizeof($forbiddenWords)>0) + { + foreach ($words as $wordInfo) + { + if (in_array($wordInfo["word"],$forbiddenWords)) + { + $copy=0; // document contains a forbidden word + break; + } + } + } + if ($copy) $filteredDocs[$key]=$docs[$key]; + } + return $filteredDocs; +} + +function compare_rank($a,$b) +{ + return ($a["rank"]>$b["rank"]) ? -1 : 1; +} + +function sort_results($docs,&$sorted) +{ + $sorted = $docs; + usort($sorted,"compare_rank"); + return $sorted; +} + +function report_results(&$docs) +{ + echo "<table cellspacing=\"2\">\n"; + echo " <tr>\n"; + echo " <td colspan=\"2\"><h2>".search_results()."</h2></td>\n"; + echo " </tr>\n"; + $numDocs = sizeof($docs); + if ($numDocs==0) + { + echo " <tr>\n"; + echo " <td colspan=\"2\">".matches_text(0)."</td>\n"; + echo " </tr>\n"; + } + else + { + echo " <tr>\n"; + echo " <td colspan=\"2\">".matches_text($numDocs); + echo "\n"; + echo " </td>\n"; + echo " </tr>\n"; + $num=1; + foreach ($docs as $doc) + { + echo " <tr>\n"; + echo " <td align=\"right\">$num.</td>"; + echo "<td><a class=\"el\" href=\"".$doc["url"]."\">".$doc["name"]."</a></td>\n"; + echo " <tr>\n"; + echo " <td></td><td class=\"tiny\">".report_matches()." "; + foreach ($doc["words"] as $wordInfo) + { + $word = $wordInfo["word"]; + $matchRight = substr($wordInfo["match"],strlen($word)); + echo "<b>$word</b>$matchRight(".$wordInfo["freq"].") "; + } + echo " </td>\n"; + echo " </tr>\n"; + $num++; + } + } + echo "</table>\n"; +} + +function main() +{ + if(strcmp('4.1.0', phpversion()) > 0) + { + die("Error: PHP version 4.1.0 or above required!"); + } + if (!($file=fopen("search.idx","rb"))) + { + die("Error: Search index file could NOT be opened!"); + } + if (readHeader($file)!="DOXS") + { + die("Error: Header of index file is invalid!"); + } + $query=""; + if (array_key_exists("query", $_GET)) + { + $query=$_GET["query"]; + } + echo "<input class=\"search\" type=\"text\" name=\"query\" value=\"$query\" size=\"20\" accesskey=\"s\"/>\n"; + echo "</span>\n"; + echo "</form>\n"; + echo "</div>\n"; + $results = array(); + $requiredWords = array(); + $forbiddenWords = array(); + $foundWords = array(); + $word=strtolower(strtok($query," ")); + while ($word) // for each word in the search query + { + if (($word{0}=='+')) { $word=substr($word,1); $requiredWords[]=$word; } + if (($word{0}=='-')) { $word=substr($word,1); $forbiddenWords[]=$word; } + if (!in_array($word,$foundWords)) + { + $foundWords[]=$word; + search($file,$word,$results); + } + $word=strtolower(strtok(" ")); + } + $docs = array(); + combine_results($results,$docs); + // filter out documents with forbidden word or that do not contain + // required words + $filteredDocs = filter_results($docs,$requiredWords,$forbiddenWords); + // normalize rankings so they are in the range [0-100] + normalize_ranking($filteredDocs); + // sort the results based on rank + $sorted = array(); + sort_results($filteredDocs,$sorted); + // report results to the user + report_results($sorted); + fclose($file); +} + +main(); + diff --git a/src/search_php.h b/src/search_php.h new file mode 100644 index 0000000..7cabda2 --- /dev/null +++ b/src/search_php.h @@ -0,0 +1,303 @@ +"function readInt($file)\n" +"{\n" +" $b1 = ord(fgetc($file)); $b2 = ord(fgetc($file));\n" +" $b3 = ord(fgetc($file)); $b4 = ord(fgetc($file));\n" +" return ($b1<<24)|($b2<<16)|($b3<<8)|$b4;\n" +"}\n" +"\n" +"function readString($file)\n" +"{\n" +" $result=\"\";\n" +" while (ord($c=fgetc($file))) $result.=$c;\n" +" return $result;\n" +"}\n" +"\n" +"function readHeader($file)\n" +"{\n" +" $header =fgetc($file); $header.=fgetc($file);\n" +" $header.=fgetc($file); $header.=fgetc($file);\n" +" return $header;\n" +"}\n" +"\n" +"function computeIndex($word)\n" +"{\n" +" if (strlen($word)<2) return -1;\n" +" // high char of the index\n" +" $hi = ord($word{0});\n" +" if ($hi==0) return -1;\n" +" // low char of the index\n" +" $lo = ord($word{1});\n" +" if ($lo==0) return -1;\n" +" // return index\n" +" return $hi*256+$lo;\n" +"}\n" +"\n" +"function search($file,$word,&$statsList)\n" +"{\n" +" $index = computeIndex($word);\n" +" if ($index!=-1) // found a valid index\n" +" {\n" +" fseek($file,$index*4+4); // 4 bytes per entry, skip header\n" +" $index = readInt($file);\n" +" if ($index) // found words matching first two characters\n" +" {\n" +" $start=sizeof($statsList);\n" +" $count=$start;\n" +" fseek($file,$index);\n" +" $w = readString($file);\n" +" while ($w)\n" +" {\n" +" $statIdx = readInt($file);\n" +" if ($word==substr($w,0,strlen($word)))\n" +" { // found word that matches (as substring)\n" +" $statsList[$count++]=array(\n" +" \"word\"=>$word,\n" +" \"match\"=>$w,\n" +" \"index\"=>$statIdx,\n" +" \"full\"=>strlen($w)==strlen($word),\n" +" \"docs\"=>array()\n" +" );\n" +" }\n" +" $w = readString($file);\n" +" }\n" +" $totalFreq=0;\n" +" for ($count=$start;$count<sizeof($statsList);$count++)\n" +" {\n" +" $statInfo = &$statsList[$count];\n" +" fseek($file,$statInfo[\"index\"]); \n" +" $numDocs = readInt($file);\n" +" $docInfo = array();\n" +" // read docs info + occurrence frequency of the word\n" +" for ($i=0;$i<$numDocs;$i++)\n" +" {\n" +" $idx=readInt($file); \n" +" $freq=readInt($file); \n" +" $docInfo[$i]=array(\"idx\"=>$idx,\"freq\"=>$freq,\"rank\"=>0.0);\n" +" $totalFreq+=$freq;\n" +" if ($statInfo[\"full\"]) $totalfreq+=$freq;\n" +" }\n" +" // read name an url info for the doc\n" +" for ($i=0;$i<$numDocs;$i++)\n" +" {\n" +" fseek($file,$docInfo[$i][\"idx\"]);\n" +" $docInfo[$i][\"name\"]=readString($file);\n" +" $docInfo[$i][\"url\"]=readString($file);\n" +" }\n" +" $statInfo[\"docs\"]=$docInfo;\n" +" }\n" +" for ($count=$start;$count<sizeof($statsList);$count++)\n" +" {\n" +" $statInfo = &$statsList[$count];\n" +" for ($i=0;$i<sizeof($statInfo[\"docs\"]);$i++)\n" +" {\n" +" $docInfo = &$statInfo[\"docs\"];\n" +" // compute frequency rank of the word in each doc\n" +" $statInfo[\"docs\"][$i][\"rank\"]=\n" +" (float)$docInfo[$i][\"freq\"]/$totalFreq;\n" +" }\n" +" }\n" +" }\n" +" }\n" +" return $statsList;\n" +"}\n" +"\n" +"function combine_results($results,&$docs)\n" +"{\n" +" foreach ($results as $wordInfo)\n" +" {\n" +" $docsList = &$wordInfo[\"docs\"];\n" +" foreach ($docsList as $di)\n" +" {\n" +" $key=$di[\"url\"];\n" +" $rank=$di[\"rank\"];\n" +" if (in_array($key, array_keys($docs)))\n" +" {\n" +" $docs[$key][\"rank\"]+=$rank;\n" +" $docs[$key][\"rank\"]*=2; // multiple matches increases rank \n" +" }\n" +" else\n" +" {\n" +" $docs[$key] = array(\"url\"=>$key,\n" +" \"name\"=>$di[\"name\"],\n" +" \"rank\"=>$rank\n" +" );\n" +" }\n" +" $docs[$key][\"words\"][] = array(\n" +" \"word\"=>$wordInfo[\"word\"],\n" +" \"match\"=>$wordInfo[\"match\"],\n" +" \"freq\"=>$di[\"freq\"]\n" +" );\n" +" }\n" +" }\n" +" return $docs;\n" +"}\n" +"\n" +"function normalize_ranking(&$docs)\n" +"{\n" +" $maxRank = 0.0000001;\n" +" // compute maximal rank\n" +" foreach ($docs as $doc) \n" +" {\n" +" if ($doc[\"rank\"]>$maxRank)\n" +" {\n" +" $maxRank=$doc[\"rank\"];\n" +" }\n" +" }\n" +" reset($docs);\n" +" // normalize rankings\n" +" while (list ($key, $val) = each ($docs)) \n" +" {\n" +" $docs[$key][\"rank\"]*=100/$maxRank;\n" +" }\n" +"}\n" +"\n" +"function filter_results($docs,&$requiredWords,&$forbiddenWords)\n" +"{\n" +" $filteredDocs=array();\n" +" while (list ($key, $val) = each ($docs)) \n" +" {\n" +" $words = &$docs[$key][\"words\"];\n" +" $copy=1; // copy entry by default\n" +" if (sizeof($requiredWords)>0)\n" +" {\n" +" foreach ($requiredWords as $reqWord)\n" +" {\n" +" $found=0;\n" +" foreach ($words as $wordInfo)\n" +" { \n" +" $found = $wordInfo[\"word\"]==$reqWord;\n" +" if ($found) break;\n" +" }\n" +" if (!$found) \n" +" {\n" +" $copy=0; // document contains none of the required words\n" +" break;\n" +" }\n" +" }\n" +" }\n" +" if (sizeof($forbiddenWords)>0)\n" +" {\n" +" foreach ($words as $wordInfo)\n" +" {\n" +" if (in_array($wordInfo[\"word\"],$forbiddenWords))\n" +" {\n" +" $copy=0; // document contains a forbidden word\n" +" break;\n" +" }\n" +" }\n" +" }\n" +" if ($copy) $filteredDocs[$key]=$docs[$key];\n" +" }\n" +" return $filteredDocs;\n" +"}\n" +"\n" +"function compare_rank($a,$b)\n" +"{\n" +" return ($a[\"rank\"]>$b[\"rank\"]) ? -1 : 1; \n" +"}\n" +"\n" +"function sort_results($docs,&$sorted)\n" +"{\n" +" $sorted = $docs;\n" +" usort($sorted,\"compare_rank\");\n" +" return $sorted;\n" +"}\n" +"\n" +"function report_results(&$docs)\n" +"{\n" +" echo \"<table cellspacing=\\\"2\\\">\\n\";\n" +" echo \" <tr>\\n\";\n" +" echo \" <td colspan=\\\"2\\\"><h2>\".search_results().\"</h2></td>\\n\";\n" +" echo \" </tr>\\n\";\n" +" $numDocs = sizeof($docs);\n" +" if ($numDocs==0)\n" +" {\n" +" echo \" <tr>\\n\";\n" +" echo \" <td colspan=\\\"2\\\">\".matches_text(0).\"</td>\\n\";\n" +" echo \" </tr>\\n\";\n" +" }\n" +" else\n" +" {\n" +" echo \" <tr>\\n\";\n" +" echo \" <td colspan=\\\"2\\\">\".matches_text($numDocs);\n" +" echo \"\\n\";\n" +" echo \" </td>\\n\";\n" +" echo \" </tr>\\n\";\n" +" $num=1;\n" +" foreach ($docs as $doc)\n" +" {\n" +" echo \" <tr>\\n\";\n" +" echo \" <td align=\\\"right\\\">$num.</td>\";\n" +" echo \"<td><a class=\\\"el\\\" href=\\\"\".$doc[\"url\"].\"\\\">\".$doc[\"name\"].\"</a></td>\\n\";\n" +" echo \" <tr>\\n\";\n" +" echo \" <td></td><td class=\\\"tiny\\\">\".report_matches().\" \";\n" +" foreach ($doc[\"words\"] as $wordInfo)\n" +" {\n" +" $word = $wordInfo[\"word\"];\n" +" $matchRight = substr($wordInfo[\"match\"],strlen($word));\n" +" echo \"<b>$word</b>$matchRight(\".$wordInfo[\"freq\"].\") \";\n" +" }\n" +" echo \" </td>\\n\";\n" +" echo \" </tr>\\n\";\n" +" $num++;\n" +" }\n" +" }\n" +" echo \"</table>\\n\";\n" +"}\n" +"\n" +"function main()\n" +"{\n" +" if(strcmp('4.1.0', phpversion()) > 0) \n" +" {\n" +" die(\"Error: PHP version 4.1.0 or above required!\");\n" +" }\n" +" if (!($file=fopen(\"search.idx\",\"rb\"))) \n" +" {\n" +" die(\"Error: Search index file could NOT be opened!\");\n" +" }\n" +" if (readHeader($file)!=\"DOXS\")\n" +" {\n" +" die(\"Error: Header of index file is invalid!\");\n" +" }\n" +" $query=\"\";\n" +" if (array_key_exists(\"query\", $_GET))\n" +" {\n" +" $query=$_GET[\"query\"];\n" +" }\n" +" echo \"<input class=\\\"search\\\" type=\\\"text\\\" name=\\\"query\\\" value=\\\"$query\\\" size=\\\"20\\\" accesskey=\\\"s\\\"/>\\n\";\n" +" echo \"</span>\\n\";\n" +" echo \"</form>\\n\";\n" +" echo \"</div>\\n\";\n" +" $results = array();\n" +" $requiredWords = array();\n" +" $forbiddenWords = array();\n" +" $foundWords = array();\n" +" $word=strtolower(strtok($query,\" \"));\n" +" while ($word) // for each word in the search query\n" +" {\n" +" if (($word{0}=='+')) { $word=substr($word,1); $requiredWords[]=$word; }\n" +" if (($word{0}=='-')) { $word=substr($word,1); $forbiddenWords[]=$word; }\n" +" if (!in_array($word,$foundWords))\n" +" {\n" +" $foundWords[]=$word;\n" +" search($file,$word,$results);\n" +" }\n" +" $word=strtolower(strtok(\" \"));\n" +" }\n" +" $docs = array();\n" +" combine_results($results,$docs);\n" +" // filter out documents with forbidden word or that do not contain\n" +" // required words\n" +" $filteredDocs = filter_results($docs,$requiredWords,$forbiddenWords);\n" +" // normalize rankings so they are in the range [0-100]\n" +" normalize_ranking($filteredDocs);\n" +" // sort the results based on rank\n" +" $sorted = array();\n" +" sort_results($filteredDocs,$sorted);\n" +" // report results to the user\n" +" report_results($sorted);\n" +" fclose($file);\n" +"}\n" +"\n" +"main();\n" +"\n" diff --git a/src/searchindex.cpp b/src/searchindex.cpp index 48047fb..36b416c 100644 --- a/src/searchindex.cpp +++ b/src/searchindex.cpp @@ -17,6 +17,9 @@ #include "qtbc.h" #include "searchindex.h" +#include <qfile.h> + +#if 0 #include "suffixtree.h" SearchIndex::SearchIndex() : refDict(10007), nameIndex(10007) @@ -124,3 +127,257 @@ bool SearchIndex::saveIndex(const char *fileName) //suffixTree->dump(); return TRUE; } +#endif + + +// file format: +// 4 byte header +// 256*256*4 byte index +// for each index entry: a zero terminated list of words +// for each word: a 0 terminated string + 4 bytes stats index +// padding bytes to align at 4 byte boundary +// for each word: a counter + for each url containing the word 8 bytes statistics +// for each url: a 0 terminated string + +const int numIndexEntries = 256*256; + +//-------------------------------------------------------------------- + +IndexWord::IndexWord(const char *word) : m_word(word), m_urls(17) +{ + m_urls.setAutoDelete(TRUE); +} + +void IndexWord::addUrlIndex(int idx) +{ + URLInfo *ui = m_urls.find(idx); + if (ui==0) + { + ui=new URLInfo(idx,0); + m_urls.insert(idx,ui); + } + ui->freq++; +} + +//-------------------------------------------------------------------- + +SearchIndex::SearchIndex() : m_words(328829), m_index(numIndexEntries), m_urlIndex(-1) +{ + int i; + m_words.setAutoDelete(TRUE); + m_urls.setAutoDelete(TRUE); + for (i=0;i<numIndexEntries;i++) m_index.insert(i,new QList<IndexWord>); +} + +void SearchIndex::setCurrentDoc(const char *name,const char *url) +{ + m_urlIndex++; + m_urls.insert(m_urlIndex,new URL(name,url)); +} + + +static int charsToIndex(const char *word) +{ + if (word==0) return -1; + int c1=word[0]; + if (c1==0) return -1; + int c2=word[1]; + if (c2==0) return -1; + return c1*256+c2; +} + +void SearchIndex::addWord(const char *word) +{ + IndexWord *w = m_words[word]; + if (w==0) + { + int idx=charsToIndex(word); + if (idx==-1) return; + w = new IndexWord(word); + //printf("addWord(%s) at index %d\n",word,idx); + m_index[idx]->append(w); + m_words.insert(word,w); + } + w->addUrlIndex(m_urlIndex); +} + + +static void writeInt(QFile &f,int index) +{ + f.putch(((uint)index)>>24); + f.putch((((uint)index)>>16)&0xff); + f.putch((((uint)index)>>8)&0xff); + f.putch(((uint)index)&0xff); +} + +static void writeString(QFile &f,const char *s) +{ + const char *p = s; + while (*p) f.putch(*p++); + f.putch(0); +} + +void SearchIndex::write(const char *fileName) +{ + int i; + int size=4; // for the header + size+=4*numIndexEntries; // for the index + int wordsOffset = size; + // first pass: compute the size of the wordlist + for (i=0;i<numIndexEntries;i++) + { + QList<IndexWord> *wlist = m_index[i]; + if (!wlist->isEmpty()) + { + QListIterator<IndexWord> iwi(*wlist); + IndexWord *iw; + for (iwi.toFirst();(iw=iwi.current());++iwi) + { + int ws = iw->word().length()+1; + size+=ws+4; // word + url info list offset + } + size+=1; // zero list terminator + } + } + + // second pass: compute the offsets in the index + int indexOffsets[numIndexEntries]; + int offset=wordsOffset; + for (i=0;i<numIndexEntries;i++) + { + QList<IndexWord> *wlist = m_index[i]; + if (!wlist->isEmpty()) + { + indexOffsets[i]=offset; + QListIterator<IndexWord> iwi(*wlist); + IndexWord *iw; + for (iwi.toFirst();(iw=iwi.current());++iwi) + { + offset+= iw->word().length()+1; + offset+=4; // word + offset to url info array + } + offset+=1; // zero list terminator + } + else + { + indexOffsets[i]=0; + } + } + int padding = size; + size = (size+3)&~3; // round up to 4 byte boundary + padding = size - padding; + + //int statsOffset = size; + QDictIterator<IndexWord> wdi(m_words); + //IndexWord *iw; + int *wordStatOffsets = new int[m_words.count()]; + + int count=0; + + // third pass: compute offset to stats info for each word + for (i=0;i<numIndexEntries;i++) + { + QList<IndexWord> *wlist = m_index[i]; + if (!wlist->isEmpty()) + { + QListIterator<IndexWord> iwi(*wlist); + IndexWord *iw; + for (iwi.toFirst();(iw=iwi.current());++iwi) + { + //printf("wordStatOffsets[%d]=%d\n",count,size); + wordStatOffsets[count++] = size; + size+=4+iw->urls().count()*8; // count + (url_index,freq) per url + } + } + } + int *urlOffsets = new int[m_urls.count()]; + //int urlsOffset = size; + QIntDictIterator<URL> udi(m_urls); + URL *url; + for (udi.toFirst();(url=udi.current());++udi) + { + urlOffsets[udi.currentKey()]=size; + size+=url->name.length()+1+ + url->url.length()+1; + } + //printf("Total size %x bytes (word=%x stats=%x urls=%x)\n",size,wordsOffset,statsOffset,urlsOffset); + QFile f(fileName); + if (f.open(IO_WriteOnly)) + { + // write header + f.putch('D'); f.putch('O'); f.putch('X'); f.putch('S'); + // write index + for (i=0;i<numIndexEntries;i++) + { + writeInt(f,indexOffsets[i]); + } + // write word lists + count=0; + for (i=0;i<numIndexEntries;i++) + { + QList<IndexWord> *wlist = m_index[i]; + if (!wlist->isEmpty()) + { + QListIterator<IndexWord> iwi(*wlist); + IndexWord *iw; + for (iwi.toFirst();(iw=iwi.current());++iwi) + { + writeString(f,iw->word()); + writeInt(f,wordStatOffsets[count++]); + } + f.putch(0); + } + } + // write extra padding bytes + for (i=0;i<padding;i++) f.putch(0); + // write word statistics + for (i=0;i<numIndexEntries;i++) + { + QList<IndexWord> *wlist = m_index[i]; + if (!wlist->isEmpty()) + { + QListIterator<IndexWord> iwi(*wlist); + IndexWord *iw; + for (iwi.toFirst();(iw=iwi.current());++iwi) + { + int numUrls = iw->urls().count(); + writeInt(f,numUrls); + QIntDictIterator<URLInfo> uli(iw->urls()); + URLInfo *ui; + for (uli.toFirst();(ui=uli.current());++uli) + { + writeInt(f,urlOffsets[ui->urlIdx]); + writeInt(f,ui->freq); + } + } + } + } + // write urls + QIntDictIterator<URL> udi(m_urls); + URL *url; + for (udi.toFirst();(url=udi.current());++udi) + { + writeString(f,url->name); + writeString(f,url->url); + } + } + + //for (wdi.toFirst();(iw=wdi.current());++wdi) + //{ + // printf("Word %s:\n",wdi.currentKey().data()); + // QIntDictIterator<URLInfo> udi(iw->urls()); + // URLInfo *ui; + // for (udi.toFirst();(ui=udi.current());++udi) + // { + // printf(" url[%d]=(name=%s,url=%s),freq=%d\n", + // ui->urlIdx, + // m_urls[ui->urlIdx]->name.data(), + // m_urls[ui->urlIdx]->url.data(), + // ui->freq); + // } + //} + + delete urlOffsets; + delete wordStatOffsets; +} + diff --git a/src/searchindex.h b/src/searchindex.h index f5ae41c..f9d9c2f 100644 --- a/src/searchindex.h +++ b/src/searchindex.h @@ -22,9 +22,12 @@ #include <qintdict.h> #include <qlist.h> #include <qdict.h> +#include <qintdict.h> +#include <qvector.h> -#include "suffixtree.h" +#if 0 // old version +#include "suffixtree.h" //class IndexTree; class SuffixTree; @@ -70,3 +73,48 @@ class SearchIndex }; #endif + +struct URL +{ + URL(const char *n,const char *u) : name(n), url(u) {} + QCString name; + QCString url; +}; + + +struct URLInfo +{ + URLInfo(int idx,int f) : urlIdx(idx), freq(f) {} + int urlIdx; + int freq; +}; + +class IndexWord +{ + public: + IndexWord(const char *word); + void addUrlIndex(int); + const QIntDict<URLInfo> &urls() const { return m_urls; } + QCString word() const { return m_word; } + + private: + QCString m_word; + QIntDict<URLInfo> m_urls; +}; + +class SearchIndex +{ + public: + SearchIndex(); + void setCurrentDoc(const char *name,const char *url); + void addWord(const char *word); + void write(const char *file); + private: + QDict<IndexWord> m_words; + QVector< QList<IndexWord> > m_index; + QIntDict<URL> m_urls; + int m_urlIndex; +}; + + +#endif diff --git a/src/suffixtree.cpp b/src/suffixtree.cpp deleted file mode 100644 index 641f502..0000000 --- a/src/suffixtree.cpp +++ /dev/null @@ -1,358 +0,0 @@ -/****************************************************************************** - * - * - * - * Copyright (C) 1997-2003 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 - * for any purpose. It is provided "as is" without express or implied warranty. - * See the GNU General Public License for more details. - * - * Documents produced by Doxygen are derivative works derived from the - * input used in their production; they are not affected by this license. - * - */ - -#include <stdio.h> - -#include "qtbc.h" -#include "suffixtree.h" - -#define MAXWORDLEN 1024 - -//---------------------------------------------------------------------------- - -bool writeString(QFile &f,const char *s) -{ - int len=strlen(s)+1; - return (f.writeBlock(s,len)!=len); -} - -bool writeNumber(QFile &f,int num) -{ - return (f.putch((num>>24)&0xff)==-1) || - (f.putch((num>>16)&0xff)==-1) || - (f.putch((num>>8)&0xff)==-1) || - (f.putch(num&0xff)==-1); -} - -static bool writeEncodedNumber(QFile &f,uint number) -{ - bool error=FALSE; - uint n=number; - while (n>=128) - { - int frac=n&0x7f; - error = error || (f.putch(frac|0x80)==-1); - n>>=7; - } - error = error || (f.putch(n)==-1); - return error; -} - -static int encodedNumberSize(uint number) -{ - uint n=number; - int size=1; - while (n>=128) { size++; n>>=7; } - return size; -} - -//---------------------------------------------------------------------------- - -int SuffixNodeList::compareItems(GCI item1,GCI item2) -{ - SuffixNode *n1=(SuffixNode *)item1; - SuffixNode *n2=(SuffixNode *)item2; - return strcmp(n1->label,n2->label); -} - -SuffixNode::SuffixNode(const char *lab) : references(0) -{ - children = new SuffixNodeList; - children->setAutoDelete(TRUE); - label=lab; - totalFreq=0; - branchOffset=0; -} - -SuffixNode::~SuffixNode() -{ - delete children; -} - -void SuffixNode::addReference(int refId,int inName,int fullWord) -{ - totalFreq++; - uint s=references.size(); - if (s>0 && references.at(s-1).id==refId) // word occured in the same document - { - references.at(s-1).freq++; // increase word's frequency - references.at(s-1).flags=((references.at(s-1).flags & INNAME_MASK) - | (inName<<INNAME_BIT)) - +((references.at(s-1).flags & FULLWORD_MASK) - | (fullWord<<FULLWORD_BIT)) - +((references.at(s-1).flags & WORDINNAME_MASK) - | ((inName & fullWord)<<WORDINNAME_BIT)); - } - else - { - references.resize(s+1); - references.at(s).id=refId; - references.at(s).freq=1; - references.at(s).flags=(inName<<INNAME_BIT) - +(fullWord<<FULLWORD_BIT) - +((inName && fullWord)<<WORDINNAME_BIT); - } -} - -int SuffixNode::insert(const char *word,int refId,int inName,int fullWord) -{ - int numNewNodes=0; - //printf("SuffixNode::insert(%s,%d)\n",word,refId); - SuffixNode *sn=children->first(); - while (sn) - { - const char *lab=sn->label.data(); - char w=word[0],l=lab[0],i=0; - while (w!=0 && l!=0 && w==l) { i++; w=word[i]; l=lab[i]; } - if (w==0 && l==0) // match found - { - sn->addReference(refId,inName,fullWord); - return numNewNodes; - } - if (i>0) // w and l contain a common prefix of length i - { - if (l==0) // w!=0 => follow this branch - { - sn->addReference(refId,inName,FALSE); - numNewNodes+=sn->insert(&word[i],refId,inName,fullWord); - } - else // l!=0 => split branch - { - char leftlab[MAXWORDLEN]; - memcpy(leftlab,lab,i); - leftlab[i]='\0'; - SuffixNode *r = new SuffixNode(leftlab); - numNewNodes++; - SuffixNode *n2 = children->take(); - // copy reference info - r->references = n2->references.copy(); - int j,refSize = r->references.size(); - for (j=0;j<refSize;j++) - { - //r->references[j].fullWord=FALSE; - //r->references[j].wordInName=FALSE; - r->references[j].flags &= ~(FULLWORD_MASK|WORDINNAME_MASK); - } - r->totalFreq = n2->totalFreq; - //printf("root branch `%s'\n",leftlab); - if (w!=0) // two sub branches - { - SuffixNode *n1 = new SuffixNode(&word[i]); - numNewNodes++; - n1->addReference(refId,inName,fullWord); - r->addReference(refId,inName,FALSE); - r->children->append(n1); - //printf("Right branch `%s'\n",&word[i]); - } - else // one sub branch - { - r->addReference(refId,inName,fullWord); - } - //printf("Left branch `%s'\n",&lab[i]); - n2->label=&lab[i]; - r->children->append(n2); - children->append(r); - } - return numNewNodes; - } - sn=children->next(); - } - //printf("new branch `%s'\n",word); - SuffixNode *n=new SuffixNode(word); - numNewNodes++; - n->addReference(refId,inName,fullWord); - children->append(n); - return numNewNodes; -} - -void SuffixNode::dump(int level,const char *prefix) -{ - uint i; - if (references.size()>0) - { - printf("%s (level=%d offset=%d freq=%d) ", - prefix,level,branchOffset,totalFreq); - for (i=0;i<references.size();i++) - printf("%d->%d ",references.at(i).id,references.at(i).freq); - printf("\n"); - } - SuffixNode *sn=children->first(); - while (sn) - { - sn->dump(level+1,prefix+("-"+sn->label)); - sn=children->next(); - } -} - -void SuffixNode::resolveForwardReferences(int &offset) -{ - if (children->count()>0) - { - if (!label.isEmpty()) offset++; // terminator for the previous level - branchOffset=offset; - } - else - branchOffset=0; - SuffixNode *sn=children->first(); - while (sn) - { - offset+=sn->label.length()+5; - uint i,refs=sn->references.size(); - if (refs>0) - { - offset+=encodedNumberSize(sn->totalFreq); - offset+=encodedNumberSize((sn->references[0].id<<3)+ - sn->references[0].flags); - offset+=encodedNumberSize(sn->references[0].freq); - for (i=1;i<refs;i++) - { - offset+=encodedNumberSize( - ((sn->references.at(i).id - sn->references.at(i-1).id)<<3)+ - sn->references.at(i).flags); - offset+=encodedNumberSize(sn->references.at(i).freq); - } - offset+=encodedNumberSize(0); - } - //printf("Lab=%s offset=%d\n",sn->lab.data(),offset); - sn=children->next(); - } - sn=children->first(); - while (sn) - { - //printf("Lab=%s offset=%d\n",sn->lab.data(),offset); - sn->resolveForwardReferences(offset); - sn=children->next(); - } -} - -int SuffixNode::size() -{ - int s=0; - if (!label.isEmpty() && children->count()>0) s++; // for the terminator - SuffixNode *sn=children->first(); - while (sn) - { - uint i,refs=sn->references.size(); - s+=sn->size()+sn->label.length()+5; - if (refs>0) - { - s+=encodedNumberSize(sn->totalFreq); - s+=encodedNumberSize( - (sn->references[0].id<<3)+ - sn->references[0].flags); - s+=encodedNumberSize(sn->references[0].freq); - for (i=1;i<refs;i++) - { - s+=encodedNumberSize( - ((sn->references.at(i).id - sn->references.at(i-1).id)<<3)+ - sn->references.at(i).flags); - s+=encodedNumberSize(sn->references.at(i).freq); - } - s+=encodedNumberSize(0); - } - sn=children->next(); - } - return s; -} - -bool SuffixNode::write(QFile &f) -{ - bool error=FALSE; - if (children->count()>0 && !label.isEmpty()) error=error || (f.putch(0)==-1); - SuffixNode *sn=children->first(); - while (sn) - { - //offset+=sn->lab.length()+1+2*sizeof(int); - int i,refs=sn->references.size(); - error=error || writeString(f,sn->label); - error=error || writeNumber(f,sn->branchOffset|((refs==0)?0x80000000:0)); - if (refs>0) - { - error=error || writeEncodedNumber(f,sn->totalFreq); - error=error || writeEncodedNumber(f, - (sn->references[0].id<<3)+ - sn->references[0].flags); - error=error || writeEncodedNumber(f,sn->references[0].freq); - for (i=1;i<refs;i++) - { - error=error || writeEncodedNumber(f, - ((sn->references[i].id - sn->references[i-1].id)<<3)+ - sn->references[i].flags); - error=error || writeEncodedNumber(f,sn->references[i].freq); - } - error=error || writeEncodedNumber(f,0); - } - //printf("Lab=%s offset=%d\n",sn->lab.data(),offset); - sn=children->next(); - } - sn=children->first(); - while (sn) - { - error=error || sn->write(f); - sn=children->next(); - } - return error; -} - -//---------------------------------------------------------------------------- - -SuffixTree::SuffixTree() -{ - root=new SuffixNode(""); - nodes=1; -} - -SuffixTree::~SuffixTree() -{ - delete root; -} - -void SuffixTree::insertWord(const char *word,int index,bool inName) -{ - QCString suffix=word; - uint i; - for (i=2;i<suffix.length();i++) - { - //printf("Inserting suffix %s\n",suffix.right(i).data()); - nodes+=root->insert(suffix.right(i),index,inName?1:0,FALSE); - } - nodes+=root->insert(word,index,inName?1:0,TRUE); -} - -void SuffixTree::dump() -{ - root->dump(0,""); -} - -void SuffixTree::resolveForwardReferences() -{ - int offset=8; - root->resolveForwardReferences(offset); -} - -int SuffixTree::size() -{ - return root->size(); -} - -bool SuffixTree::write(QFile &f) -{ - if (!f.isOpen()) { printf("File not open\n"); return FALSE; } - bool error=FALSE; - error = error || root->write(f); - return !error; -} diff --git a/src/suffixtree.h b/src/suffixtree.h deleted file mode 100644 index 28d2a6c..0000000 --- a/src/suffixtree.h +++ /dev/null @@ -1,89 +0,0 @@ -/****************************************************************************** - * - * - * - * Copyright (C) 1997-2003 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 - * for any purpose. It is provided "as is" without express or implied warranty. - * See the GNU General Public License for more details. - * - * Documents produced by Doxygen are derivative works derived from the - * input used in their production; they are not affected by this license. - * - */ - -#ifndef SUFFIXTREE_H -#define SUFFIXTREE_H - -#include "qtbc.h" -#include <qlist.h> -#include <qarray.h> -#include <qfile.h> - -class SuffixNodeList; -class IndexTree; - -enum WordRefMasks { WORDINNAME_MASK=4, INNAME_MASK=2, FULLWORD_MASK=1 }; -enum WordRefBits { WORDINNAME_BIT=2, INNAME_BIT=1, FULLWORD_BIT=0 }; - -struct WordRef -{ - int id; - short freq; - char flags; -}; - -class SuffixNode -{ - friend class SuffixTree; - friend class IndexNode; - friend class SuffixNodeList; - public: - SuffixNode(const char *); - ~SuffixNode(); - int insert(const char *word,int refId,int inName,int full); - void addReference(int refId,int inName,int fullWord); - void dump(int,const char *); - void resolveForwardReferences(int &offset); - int size(); // return the size of the tree whose root is this node - bool write(QFile &f); - private: - SuffixNodeList *children; - QArray<WordRef> references; - QCString label; - int branchOffset; - int totalFreq; -}; - -class SuffixNodeList : public QList<SuffixNode> -{ - public: - SuffixNodeList() : QList<SuffixNode>() {} - ~SuffixNodeList() {} - int compareItems(GCI item1,GCI item2); -}; - -class SuffixTree -{ - friend class SuffixNode; - public: - SuffixTree(); - ~SuffixTree(); - void insertWord(const char *word,int index,bool inName); - void resolveForwardReferences(); - void dump(); - int size(); // return the size of the (flat) tree in bytes - bool write(QFile &f); - int numberOfNodes() { return nodes; } - private: - int nodes; - SuffixNode *root; -}; - -extern bool writeNumber(QFile &f,int); -extern bool writeString(QFile &f,const char *s); - -#endif diff --git a/src/translator.h b/src/translator.h index 4b1679c..5741d51 100644 --- a/src/translator.h +++ b/src/translator.h @@ -407,6 +407,15 @@ class Translator virtual QCString trAll() = 0; virtual QCString trCallGraph() = 0; +////////////////////////////////////////////////////////////////////////// +// new since 1.3.3 +////////////////////////////////////////////////////////////////////////// + + virtual QCString trSearchForIndex() = 0; + virtual QCString trSearchResultsTitle() = 0; + virtual QCString trSearchResults(int numDocuments) = 0; + virtual QCString trSearchMatches() = 0; + }; #endif diff --git a/src/translator_adapter.h b/src/translator_adapter.h index 7aaa3ca..03dafd9 100644 --- a/src/translator_adapter.h +++ b/src/translator_adapter.h @@ -40,12 +40,28 @@ class TranslatorAdapterBase : public Translator }; -class TranslatorAdapter_1_3_1 : public TranslatorAdapterBase +class TranslatorAdapter_1_3_3 : public TranslatorAdapterBase { public: virtual QCString updateNeededMessage() - { return createUpdateNeededMessage(idLanguage(),"release 1.3.1"); } + { return createUpdateNeededMessage(idLanguage(),"release 1.3.3"); } + + virtual QCString trSearchForIndex() + { return english.trSearchForIndex(); } + virtual QCString trSearchResultsTitle() + { return english.trSearchResultsTitle(); } + virtual QCString trSearchResults(int numDocuments) + { return english.trSearchResults(numDocuments); } + virtual QCString trSearchMatches() + { return english.trSearchMatches(); } + +}; +class TranslatorAdapter_1_3_1 : public TranslatorAdapter_1_3_3 +{ + public: + virtual QCString updateNeededMessage() + { return createUpdateNeededMessage(idLanguage(),"release 1.3.1"); } virtual QCString trAll() { return english.trAll(); } virtual QCString trCallGraph() diff --git a/src/translator_br.h b/src/translator_br.h index 2f433b3..8f4e501 100644 --- a/src/translator_br.h +++ b/src/translator_br.h @@ -29,7 +29,7 @@ #ifndef TRANSLATOR_BR_H #define TRANSLATOR_BR_H -class TranslatorBrazilian: public Translator +class TranslatorBrazilian: public TranslatorAdapter_1_3_3 { public: diff --git a/src/translator_cz.h b/src/translator_cz.h index f826808..c2eb801 100644 --- a/src/translator_cz.h +++ b/src/translator_cz.h @@ -157,7 +157,7 @@ // Windows version. The version which does not call the function is // probably slightly faster. -class TranslatorCzech : public Translator +class TranslatorCzech : public TranslatorAdapter_1_3_3 { private: /*! The decode() inline assumes the source written in the diff --git a/src/translator_en.h b/src/translator_en.h index 9342828..b22bd27 100644 --- a/src/translator_en.h +++ b/src/translator_en.h @@ -181,7 +181,7 @@ class TranslatorEnglish : public Translator } else { - return "Compound List"; + return "Class List"; } } @@ -202,7 +202,7 @@ class TranslatorEnglish : public Translator } else { - return "Compound Members"; + return "Class Members"; } } @@ -377,7 +377,7 @@ class TranslatorEnglish : public Translator } else { - return "Compound Index"; + return "Class Index"; } } @@ -525,7 +525,7 @@ class TranslatorEnglish : public Translator } else { - return "Compounds"; + return "Classes"; } } @@ -1489,6 +1489,55 @@ class TranslatorEnglish : public Translator return "Here is the call graph for this function:"; } +////////////////////////////////////////////////////////////////////////// +// new since 1.3.3 +////////////////////////////////////////////////////////////////////////// + + /*! When the search engine is enabled this text is put in the index + * of each page before the search field. + */ + virtual QCString trSearchForIndex() + { + return "Search for"; + } + /*! This string is used as the title for the page listing the search + * results. + */ + virtual QCString trSearchResultsTitle() + { + return "Search Results"; + } + /*! This string is put just before listing the search results. The + * text can be different depending on the number of documents found. + * Inside the text you can put the special marker $num to insert + * the number representing the actual number of search results. + * The @a numDocuments parameter can be either 0, 1 or 2, where the + * value 2 represents 2 or more matches. HTML markup is allowed inside + * the returned string. + */ + virtual QCString trSearchResults(int numDocuments) + { + if (numDocuments==0) + { + return "Sorry, no documents matching your query."; + } + else if (numDocuments==1) + { + return "Found <b>1</b> document matching your query."; + } + else + { + return "Found <b>$num</b> documents matching your query. " + "Showing best matches first."; + } + } + /*! This string is put before the list of matched words, for each search + * result. What follows is the list of words that matched the query. + */ + virtual QCString trSearchMatches() + { + return "Matches:"; + } }; diff --git a/src/translator_fr.h b/src/translator_fr.h index ce136a0..810f934 100644 --- a/src/translator_fr.h +++ b/src/translator_fr.h @@ -54,7 +54,7 @@ #ifndef TRANSLATOR_FR_H #define TRANSLATOR_FR_H -class TranslatorFrench : public Translator +class TranslatorFrench : public TranslatorAdapter_1_3_3 { public: QCString idLanguage() diff --git a/src/translator_it.h b/src/translator_it.h index cebfd3d..302c0df 100644 --- a/src/translator_it.h +++ b/src/translator_it.h @@ -69,7 +69,7 @@ #ifndef TRANSLATOR_IT_H #define TRANSLATOR_IT_H -class TranslatorItalian : public Translator +class TranslatorItalian : public TranslatorAdapter_1_3_3 { public: diff --git a/src/translator_kr.h b/src/translator_kr.h index 3134893..461b47c 100644 --- a/src/translator_kr.h +++ b/src/translator_kr.h @@ -1389,6 +1389,62 @@ class TranslatorKorean : public TranslatorAdapter_1_3 return "À̺¥Æ® ¹®¼È"; } +////////////////////////////////////////////////////////////////////////// +// new since 1.3 +////////////////////////////////////////////////////////////////////////// + + /*! Used as a heading for a list of Java class types with package scope. + */ + virtual QCString trPackageTypes() + { + return "ÆÐÅ°Áö ŸÀÔ"; + } + /*! Used as a heading for a list of Java class functions with package + * scope. + */ + virtual QCString trPackageMembers() + { + return "ÆÐÅ°Áö ÇÔ¼ö"; + } + /*! Used as a heading for a list of static Java class functions with + * package scope. + */ + virtual QCString trStaticPackageMembers() + { + return "Á¤Àû ÆÐÅ°Áö ÇÔ¼ö"; + } + /*! Used as a heading for a list of Java class variables with package + * scope. + */ + virtual QCString trPackageAttribs() + { + return "ÆÐÅ°Áö ¼Ó¼º"; + } + /*! Used as a heading for a list of static Java class variables with + * package scope. + */ + virtual QCString trStaticPackageAttribs() + { + return "Á¤Àû ÆÐÅ°Áö ¼Ó¼º"; + } + +////////////////////////////////////////////////////////////////////////// +// new since 1.3.1 +////////////////////////////////////////////////////////////////////////// + + /*! Used in the quick index of a class/file/namespace member list page + * to link to the unfiltered list of all members. + */ + virtual QCString trAll() + { + return "All"; + } + /*! Put in front of the call graph for a function. */ + virtual QCString trCallGraph() + { + return "ÀÌ ÇÔ¼öÀÇ È£Ãâ»óŸ¦ ³ªÅ¸³½ ±×·¡ÇÁÀÔ´Ï´Ù."; + } + }; #endif diff --git a/src/translator_nl.h b/src/translator_nl.h index 7b18489..04929f0 100644 --- a/src/translator_nl.h +++ b/src/translator_nl.h @@ -88,13 +88,13 @@ class TranslatorDutch : public Translator QCString trClassHierarchy() { return "Klasse Hiërarchie"; } QCString trCompoundList() - { return "Compound Lijst"; } + { return "Klasse Lijst"; } QCString trFileList() { return "File Lijst"; } QCString trHeaderFiles() { return "Header Lijst"; } QCString trCompoundMembers() - { return "Compound Members"; } + { return "Klasse Members"; } QCString trFileMembers() { return "File members"; } QCString trRelatedPages() @@ -154,7 +154,7 @@ class TranslatorDutch : public Translator QCString trHierarchicalIndex() { return "Hiërarchische Index"; } QCString trCompoundIndex() - { return "Compound Index"; } + { return "Klasse Index"; } QCString trFileIndex() { return "File Index"; } QCString trModuleDocumentation() @@ -199,7 +199,7 @@ class TranslatorDutch : public Translator QCString trVariableDocumentation() { return "Documentatie van variabelen"; } QCString trCompounds() - { return "Compounds"; } + { return "Klassen"; } QCString trGeneratedAt(const char *date,const char *projName) { QCString result=(QCString)"Gegenereerd op "+date; @@ -1085,6 +1085,57 @@ class TranslatorDutch : public Translator { return "Hier is de call graaf voor deze functie:"; } + +////////////////////////////////////////////////////////////////////////// +// new since 1.3.3 +////////////////////////////////////////////////////////////////////////// + + /*! When the search engine is enabled this text is put in the index + * of each page before the search field. + */ + virtual QCString trSearchForIndex() + { + return "Zoek naar"; + } + /*! This string is used as the title for the page listing the search + * results. + */ + virtual QCString trSearchResultsTitle() + { + return "Zoek Resultaten"; + } + /*! This string is put just before listing the search results. The + * text can be different depending on the number of documents found. + * Inside the text you can put the special marker $num to insert + * the number representing the actual number of search results. + * The @a numDocuments parameter can be either 0, 1 or 2, where the + * value 2 represents 2 or more matches. HTML markup is allowed inside + * the returned string. + */ + virtual QCString trSearchResults(int numDocuments) + { + if (numDocuments==0) + { + return "Helaas, er zijn geen documenten gevonden die aan de zoekopdracht voldoen."; + } + else if (numDocuments==1) + { + return "Er is <b>1</b> document gevonden dat aan de zoekopdracht voldoet."; + } + else + { + return "Er zijn <b>$num</b> documenten gevonden die aan de zoekopdracht voldoen. " + "De beste resultaten worden eerst getoond."; + } + } + /*! This string is put before the list of matched words, for each search + * result. What follows is the list of words that matched the query. + */ + virtual QCString trSearchMatches() + { + return "Gevonden:"; + } + }; diff --git a/src/translator_pt.h b/src/translator_pt.h index 2bc323e..79506ac 100644 --- a/src/translator_pt.h +++ b/src/translator_pt.h @@ -40,7 +40,7 @@ #ifndef TRANSLATOR_PT_H #define TRANSLATOR_PT_H -class TranslatorPortuguese : public Translator +class TranslatorPortuguese : public TranslatorAdapter_1_3_3 { public: diff --git a/src/translator_se.h b/src/translator_se.h index c1b5cd2..fdbfd4e 100644 --- a/src/translator_se.h +++ b/src/translator_se.h @@ -20,6 +20,7 @@ Svensk översättning av: Samuel Hägglund <sahag96@ite.mh.se> Xet Erixon <xet@xeqt.com> +Mikael Hallin <mikaelhallin@yahoo.se> 2003-07-28 ================================================================================== Uppdateringar. 1999/04/29 @@ -57,122 +58,177 @@ Problem! av "namespace", så jag kör med det från och med nu. * "interface" heter numera "gränssnitt" +2003/07/28 +* Jag har updaterat översättningen efter ett par års träda.. +Problem! + Deprecated: nån hygglig svensk översättning??? + + Skicka gärna synpunkter. */ #ifndef TRANSLATOR_SE_H #define TRANSLATOR_SE_H -class TranslatorSwedish : public TranslatorEnglish +class TranslatorSwedish : public TranslatorAdapter_1_3_3 { public: - /*! This method is used to generate a warning message to signal - * the user that the translation of his/her language of choice - * needs updating. + + virtual QCString idLanguage() + { return "swedish"; } + + /*! Used to get the LaTeX command(s) for the language support. + * This method should return string with commands that switch + * LaTeX to the desired language. For example + * <pre>"\\usepackage[german]{babel}\n" + * </pre> + * or + * <pre>"\\usepackage{polski}\n" + * "\\usepackage[latin2]{inputenc}\n" + * "\\usepackage[T1]{fontenc}\n" + * </pre> + * + * The English LaTeX does not use such commands. Because of this + * the empty string is returned in this implementation. */ - virtual QCString updateNeededMessage() + virtual QCString latexLanguageSupportCommand() { - return "Warning: The Swedish translator is really obsolete.\n" - "It was not updated since version 1.0.0. As a result,\n" - "some sentences may appear in English.\n\n"; + return ""; } - QCString idLanguage() - { return "swedish"; } - QCString latexBabelPackage() - { return "swedish"; } + /*! return the language charset. This will be used for the HTML output */ + virtual QCString idLanguageCharset() + { + return "iso-8859-1"; + } - QCString trRelatedFunctions() + virtual QCString trRelatedFunctions() { return "Besläktade funktioner"; } - QCString trRelatedSubscript() + virtual QCString trRelatedSubscript() { return "(Observera att dessa inte är medlemsfunktioner)"; } - QCString trDetailedDescription() + virtual QCString trDetailedDescription() { return "Detaljerad beskrivning"; } - QCString trMemberTypedefDocumentation() - { return "Dokumentation över typdefinierade medlemmar"; } + virtual QCString trMemberTypedefDocumentation() + { return "Dokumentation av typdefinierade medlemmar"; } - QCString trMemberEnumerationDocumentation() - { return "Dokumentation över egenuppräknande medlemmar"; } + virtual QCString trMemberEnumerationDocumentation() + { return "Dokumentation av egenuppräknande medlemmar"; } - QCString trMemberFunctionDocumentation() - { return "Dokumentation över medlemsfunktioner"; } + virtual QCString trMemberFunctionDocumentation() + { return "Dokumentation av medlemsfunktioner"; } - QCString trMemberDataDocumentation() - { return "Dokumentation över datamedlemmar"; } + virtual QCString trMemberDataDocumentation() + { + if (Config_getBool("OPTIMIZE_OUTPUT_FOR_C")) + { + return "Fält dokumentation"; + } + else + { + return "Dokumentation av datamedlemmar"; + } + } - QCString trMore() + virtual QCString trMore() { return "Mer..."; } - QCString trListOfAllMembers() + virtual QCString trListOfAllMembers() { return "Lista över alla medlemmar."; } - QCString trMemberList() + virtual QCString trMemberList() { return "Medlemslista"; } - QCString trThisIsTheListOfAllMembers() + virtual QCString trThisIsTheListOfAllMembers() { return "Det här är en fullständig lista över medlemmar för "; } - QCString trIncludingInheritedMembers() + virtual QCString trIncludingInheritedMembers() { return " med alla ärvda medlemmar."; } - QCString trGeneratedAutomatically(const char *s) + virtual QCString trGeneratedAutomatically(const char *s) { QCString result="Automatiskt skapad av Doxygen"; if (s) result+=(QCString)" för "+s; result+=" från källkoden."; return result; } - QCString trEnumName() + virtual QCString trEnumName() { return "enum namn"; } - QCString trEnumValue() + virtual QCString trEnumValue() { return "enum värde"; } - QCString trDefinedIn() + virtual QCString trDefinedIn() { return "definierad i"; } - +/* QCString trVerbatimText(const char *f) { return (QCString)"Detta är den ordagranna texten från inkluderingsfilen "+f; } - - QCString trModules() +*/ + virtual QCString trModules() { return "Moduler"; } - QCString trClassHierarchy() + virtual QCString trClassHierarchy() { return "Klasshierarki"; } - QCString trCompoundList() - { return "Sammansatt klasslista"; } + virtual QCString trCompoundList() + { + if (Config_getBool("OPTIMIZE_OUTPUT_FOR_C")) + { + return "Datastrukturer"; + } + else + { + return "Sammansatt klasslista"; + } + } - QCString trFileList() + virtual QCString trFileList() { return "Fillista"; } - QCString trHeaderFiles() + virtual QCString trHeaderFiles() { return "Headerfiler"; } - QCString trCompoundMembers() - { return "Sammansatta klassmedlemmar"; } + virtual QCString trCompoundMembers() + { + if (Config_getBool("OPTIMIZE_OUTPUT_FOR_C")) + { + return "Data fält"; + } + else + { + return "Sammansatta klassmedlemmar"; + } + } - QCString trFileMembers() - { return "Filmedlemmar"; } + virtual QCString trFileMembers() + { + if (Config_getBool("OPTIMIZE_OUTPUT_FOR_C")) + { + return "Globala symboler"; + } + else + { + return "Filmedlemmar"; + } + } - QCString trRelatedPages() + virtual QCString trRelatedPages() { return "Besläktade sidor"; } - QCString trExamples() + virtual QCString trExamples() { return "Exempel"; } - QCString trSearch() + virtual QCString trSearch() { return "Sök"; } - QCString trClassHierarchyDescription() + virtual QCString trClassHierarchyDescription() { return "Denna lista över arv är grovt, men inte helt, " "sorterad i alfabetisk ordning:"; } - QCString trFileListDescription(bool extractAll) + virtual QCString trFileListDescription(bool extractAll) { QCString result="Här följer en lista över alla "; if (!extractAll) result+="dokumenterade "; @@ -180,128 +236,206 @@ class TranslatorSwedish : public TranslatorEnglish return result; } - QCString trCompoundListDescription() - { return "Här följer klasserna, strukterna och " - "unionerna med en kort beskrivning:"; + virtual QCString trCompoundListDescription() + { + + if (Config_getBool("OPTIMIZE_OUTPUT_FOR_C")) + { + return "Här följer datastrukturerna med korta beskrivningar:"; + } + else + { + return "Här följer klasserna, strukterna, unionerna och " + "gränssnitten med korta beskrivningar:"; + } } - QCString trCompoundMembersDescription(bool extractAll) + /*! This is an introduction to the page with all class members. */ + virtual QCString trCompoundMembersDescription(bool extractAll) { - - QCString result="Här följer en lista över alla "; - if (!extractAll) result+="dokumenterade "; - result+="klassmedlemmar med länkar till "; - if (!extractAll) result+="klassdokumentationen för varje medlem:"; - else result+="klasserna som de tillhör:"; + QCString result="Här är en lista över alla "; + if (!extractAll) + { + result+="dokumenterade "; + } + if (Config_getBool("OPTIMIZE_OUTPUT_FOR_C")) + { + result+="struktur- och unions-fält"; + } + else + { + result+="klassmedlemmar"; + } + result+=" med länkar till "; + if (!extractAll) + { + if (Config_getBool("OPTIMIZE_OUTPUT_FOR_C")) + { + result+="struktur/unions-dokumentationen för varje fält:"; + } + else + { + result+="klassdokumentationen för varje medlem:"; + } + } + else + { + if (Config_getBool("OPTIMIZE_OUTPUT_FOR_C")) + { + result+=" strukturerna/unionerna de tillhör:"; + } + else + { + result+="klasserna de tillhör:"; + } + } return result; } - QCString trFileMembersDescription(bool extractAll) + virtual QCString trFileMembersDescription(bool extractAll) { QCString result="Här följer en lista över alla "; if (!extractAll) result+="dokumenterade "; - result+="filmedlemmar med länkar till "; - if (extractAll) result+="dokumentationsfilen för varje medlem:"; - else result+="filerna som de tillhör:"; + + if (Config_getBool("OPTIMIZE_OUTPUT_FOR_C")) + { + result+="funktioner, variabler, definitioner, enumerationer " + "och typdefinitioner"; + } + else + { + result+= "filmedlemmar"; + } + result+= " med länkar till "; + if (extractAll) + result+= "filerna som de tillhör:"; + else + result+= "dokumentationen:"; return result; } - QCString trHeaderFilesDescription() + virtual QCString trHeaderFilesDescription() { return "Här följer headerfilerna som API:n består av:"; } - QCString trExamplesDescription() + virtual QCString trExamplesDescription() { return "Här följer en lista med alla exempel:"; } - QCString trRelatedPagesDescription() + virtual QCString trRelatedPagesDescription() { return "Här följer en lista över alla besläktade dokumentationssidor:";} - QCString trModulesDescription() + virtual QCString trModulesDescription() { return "Här följer en lista över alla moduler:"; } - QCString trNoDescriptionAvailable() + virtual QCString trNoDescriptionAvailable() { return "Beskrivning saknas"; } - QCString trDocumentation() + virtual QCString trDocumentation() { return "Dokumentation"; } - QCString trModuleIndex() + virtual QCString trModuleIndex() { return "Modulindex"; } - QCString trHierarchicalIndex() + virtual QCString trHierarchicalIndex() { return "Hierarkiskt Index"; } - QCString trCompoundIndex() - { return "Sammansatt Index"; } + /*! This is used in LaTeX as the title of the chapter with the + * annotated compound index. + */ + virtual QCString trCompoundIndex() + { + if (Config_getBool("OPTIMIZE_OUTPUT_FOR_C")) { + return "Index över datastrukturer"; + } else { + return "Index över sammensatta typer"; + } + } - QCString trFileIndex() + virtual QCString trFileIndex() { return "Filindex"; } - QCString trModuleDocumentation() + virtual QCString trModuleDocumentation() { return "Dokumentation över moduler"; } - QCString trClassDocumentation() - { return "Dokumentation över klasser"; } + /*! This is used in LaTeX as the title of the chapter containing + * the documentation of all classes, structs and unions. + */ + virtual QCString trClassDocumentation() + { + if (Config_getBool("OPTIMIZE_OUTPUT_FOR_C")) + { + return "Dokumentation över datastrukturer"; + } + else + { + return "Documentation över klasser"; + } + } - QCString trFileDocumentation() + virtual QCString trFileDocumentation() { return "Dokumentation över filer"; } - QCString trExampleDocumentation() + virtual QCString trExampleDocumentation() { return "Dokumentation över exempel"; } - QCString trPageDocumentation() + virtual QCString trPageDocumentation() { return "Dokumentation av sidor"; } - QCString trReferenceManual() + virtual QCString trReferenceManual() { return "Referensmanual"; } - QCString trDefines() + virtual QCString trDefines() { return "Definitioner"; } - QCString trFuncProtos() + virtual QCString trFuncProtos() { return "Funktionsprototyper"; } - QCString trTypedefs() + virtual QCString trTypedefs() { return "Typdefinitioner"; } - QCString trEnumerations() + virtual QCString trEnumerations() { return "Egenuppräknande typer"; } - QCString trFunctions() + virtual QCString trFunctions() { return "Funktioner"; } - - QCString trVariables() + virtual QCString trVariables() { return "Variabler"; } - QCString trEnumerationValues() + virtual QCString trEnumerationValues() { return "Egenuppräknade typers värden"; } - QCString trAuthor() - { return "Författare"; } - - QCString trDefineDocumentation() + virtual QCString trDefineDocumentation() { return "Dokumentation över definitioner"; } - QCString trFunctionPrototypeDocumentation() + virtual QCString trFunctionPrototypeDocumentation() { return "Dokumentation över funktionsprototyper"; } - QCString trTypedefDocumentation() + virtual QCString trTypedefDocumentation() { return "Dokumentation över typdefinitioner"; } - QCString trEnumerationTypeDocumentation() + virtual QCString trEnumerationTypeDocumentation() { return "Dokumentation över egenuppräknande typer"; } - QCString trEnumerationValueDocumentation() + virtual QCString trEnumerationValueDocumentation() { return "Dokumentation över egenuppräknande typers värden"; } - QCString trFunctionDocumentation() + virtual QCString trFunctionDocumentation() { return "Dokumentation över funktioner"; } - QCString trVariableDocumentation() + virtual QCString trVariableDocumentation() { return "Dokumentation över variabler"; } - QCString trCompounds() - { return "Sammansättning"; } - - QCString trFiles() - { return "Filer"; } + /*! This is used in the documentation of a file/namespace/group before + * the list of links to documented compounds + */ + virtual QCString trCompounds() + { + if (Config_getBool("OPTIMIZE_OUTPUT_FOR_C")) + { + return "Datastrukturer"; + } + else + { + return "Sammansättning"; + } + } - QCString trGeneratedAt(const char *date,const char *projName) + virtual QCString trGeneratedAt(const char *date,const char *projName) { QCString result=(QCString)"Skapad "+date; if (projName) result+=(QCString)" för "+projName; @@ -309,62 +443,59 @@ class TranslatorSwedish : public TranslatorEnglish return result; } - QCString trWrittenBy() + virtual QCString trWrittenBy() { return "skriven av"; } - QCString trClassDiagram(const char *clName) + virtual QCString trClassDiagram(const char *clName) { return (QCString)"Klassdiagram för "+clName; } - QCString trForInternalUseOnly() + virtual QCString trForInternalUseOnly() { return "Endast för internt bruk."; } - QCString trReimplementedForInternalReasons() - { return "Omskriven av intern anledning ; API:n påverkas inte.";} + virtual QCString trReimplementedForInternalReasons() + { return "Omskriven av intern anledning; API:n påverkas inte.";} - QCString trWarning() + virtual QCString trWarning() { return "Varning"; } - QCString trBugsAndLimitations() + virtual QCString trBugsAndLimitations() { return "Fel och begränsningar"; } - QCString trVersion() + virtual QCString trVersion() { return "Version"; } - QCString trDate() + virtual QCString trDate() { return "Datum"; } - QCString trAuthors() - { return "Författare"; } - - QCString trReturns() + virtual QCString trReturns() { return "Returnerar"; } - QCString trSeeAlso() + virtual QCString trSeeAlso() { return "Se även"; } - QCString trParameters() + virtual QCString trParameters() { return "Parametrar"; } - QCString trExceptions() + virtual QCString trExceptions() { return "Undantag"; } - QCString trGeneratedBy() + virtual QCString trGeneratedBy() { return "Skapad av"; } // new since 0.49-990307 virtual QCString trNamespaceList() - { return "Namnrymdlista"; } + { return "Namnrymdslista"; } virtual QCString trNamespaceListDescription(bool extractAll) { QCString result="Här är en lista över alla "; if (!extractAll) result+="dokumenterade "; - result+="namnrymder med en kort förklaring:"; + result+="namnrymder med en kort beskrivning:"; return result; } @@ -384,7 +515,7 @@ class TranslatorSwedish : public TranslatorEnglish virtual QCString trCompoundReference(const char *clName, ClassDef::CompoundType compType, - bool /*isTemplate*/) + bool isTemplate) { QCString result=(QCString)clName+" "; switch(compType) @@ -393,8 +524,9 @@ class TranslatorSwedish : public TranslatorEnglish case ClassDef::Struct: result+=" strukt"; break; case ClassDef::Union: result+=" union"; break; case ClassDef::Interface: result+=" gränssnitt"; break; - case ClassDef::Exception: result+=" exception"; break; + case ClassDef::Exception: result+=" undantag"; break; } + if (isTemplate) result+="template"; result+="referens"; return result; } @@ -531,7 +663,7 @@ class TranslatorSwedish : public TranslatorEnglish case ClassDef::Struct: result+="denna strukt "; break; case ClassDef::Union: result+="denna union "; break; case ClassDef::Interface: result+="detta gränssnitt "; break; - case ClassDef::Exception: result+="exception "; break; + case ClassDef::Exception: result+="detta undantag "; break; } result+="var genererad från följande fil"; if (single) result+=":"; else result+="er:"; @@ -580,6 +712,642 @@ class TranslatorSwedish : public TranslatorEnglish { return "Definition i filen @0."; } + +////////////////////////////////////////////////////////////////////////// +// new since 0.49-991205 +////////////////////////////////////////////////////////////////////////// + + virtual QCString trDeprecated() + { + return "Föråldrad"; + } + +////////////////////////////////////////////////////////////////////////// +// new since 1.0.0 +////////////////////////////////////////////////////////////////////////// + + /*! this text is put before a collaboration diagram */ + virtual QCString trCollaborationDiagram(const char *clName) + { + return (QCString)"Samarbetsdiagram för "+clName+":"; + } + + /*! this text is put before an include dependency graph */ + virtual QCString trInclDepGraph(const char *fName) + { + return (QCString)"Include-beroendediagram för "+fName+":"; + } + + /*! header that is put before the list of constructor/destructors. */ + virtual QCString trConstructorDocumentation() + { + return "Dokumentation av konstruktorer och destruktorer"; + } + + /*! Used in the file documentation to point to the corresponding sources. */ + virtual QCString trGotoSourceCode() + { + return "Gå till denna fils källkod."; + } + + /*! Used in the file sources to point to the corresponding documentation. */ + virtual QCString trGotoDocumentation() + { + return "Gå till denna fils dokumentation."; + } + + /*! Text for the \\pre command */ + virtual QCString trPrecondition() + { + return "Förhandsvillkor"; + } + + /*! Text for the \\post command */ + virtual QCString trPostcondition() + { + return "Resultat"; //"Postcondition"; + } + + /*! Text for the \\invariant command */ + virtual QCString trInvariant() + { + return "Invariant"; + } + + /*! Text shown before a multi-line variable/enum initialization */ + virtual QCString trInitialValue() + { + return "Begynnelsevärde:"; + } + /*! Text used the source code in the file index */ + virtual QCString trCode() + { + return "källkod"; + } + + virtual QCString trGraphicalHierarchy() + { + return "Grafisk klasshierarki"; + } + virtual QCString trGotoGraphicalHierarchy() + { + return "Gå till den grafiska klasshierarkin"; + } + virtual QCString trGotoTextualHierarchy() + { + return "Gå till den textbaserade klasshierarkin"; + } + virtual QCString trPageIndex() + { + return "Sidindex"; + } + +////////////////////////////////////////////////////////////////////////// +// new since 1.1.0 +////////////////////////////////////////////////////////////////////////// + + virtual QCString trNote() + { + return "Notera"; + } + virtual QCString trPublicTypes() + { + return "Publika typer"; + } + virtual QCString trPublicAttribs() + { + if (Config_getBool("OPTIMIZE_OUTPUT_FOR_C")) + { + return "Datafält"; + } + else + { + return "Publika attribut"; + } + } + virtual QCString trStaticPublicAttribs() + { + return "Statiska publika attribut"; + } + virtual QCString trProtectedTypes() + { + return "Skyddade typer"; + } + virtual QCString trProtectedAttribs() + { + return "Skyddade attribut"; + } + virtual QCString trStaticProtectedAttribs() + { + return "Statiska skyddade attribut"; + } + virtual QCString trPrivateTypes() + { + return "Privata typer"; + } + virtual QCString trPrivateAttribs() + { + return "Privata attribut"; + } + virtual QCString trStaticPrivateAttribs() + { + return "Statiska privata attribut"; + } + +////////////////////////////////////////////////////////////////////////// +// new since 1.1.3 +////////////////////////////////////////////////////////////////////////// + + /*! Used as a marker that is put before a \\todo item */ + virtual QCString trTodo() + { + return "Att-göra"; + } + /*! Used as the header of the todo list */ + virtual QCString trTodoList() + { + return "Att-göra lista"; + } + +////////////////////////////////////////////////////////////////////////// +// new since 1.1.4 +////////////////////////////////////////////////////////////////////////// + + virtual QCString trReferencedBy() + { + return "Refererad av"; + } + virtual QCString trRemarks() + { + return "Lägg märke till"; + } + virtual QCString trAttention() + { + return "Observera"; + } + virtual QCString trInclByDepGraph() + { + return "Den här grafen visar vilka filer som direkt eller " + "indirekt inkluderar denna filen."; + } + virtual QCString trSince() + { + return "Sedan"; + } + +////////////////////////////////////////////////////////////////////////// +// new since 1.1.5 +////////////////////////////////////////////////////////////////////////// + + /*! title of the graph legend page */ + virtual QCString trLegendTitle() + { + return "Grafförklaring"; + } + + /*! page explaining how the dot graph's should be interpreted + * The %A in the text below are to prevent link to classes called "A". + */ + virtual QCString trLegendDocs() + { + return + "Den här sidan förklarar hur man ska tolka de grafer som doxygen " + "genererar.<p>\n" + "Tag följande exempel:\n" + "\\code\n" + "/*! Osynlig klass på grund av stympning */\n" + "class Invisible { };\n\n" + "/*! Stympad klass, ärvningsrelationen är dold */\n" + "class Truncated : public Invisible { };\n\n" + "/* Klass utan doxygen-kommentarer */\n" + "class Undocumented { };\n\n" + "/*! Klass som ärvs med publikt arv */\n" + "class PublicBase : public Truncated { };\n\n" + "/*! En template-klass */\n" + "template<class T> class Templ { };\n\n" + "/*! Klass som ärvs med skyddat arv */\n" + "class ProtectedBase { };\n\n" + "/*! Klass som ärvs med privat arv */\n" + "class PrivateBase { };\n\n" + "/*! Klass som används av Inherited klassen */\n" + "class Used { };\n\n" + "/*! Super klassen som ärver ett antal andra klasser */\n" + "class Inherited : public PublicBase,\n" + " protected ProtectedBase,\n" + " private PrivateBase,\n" + " public Undocumented\n" + " public Templ<int>\n" + "{\n" + " private:\n" + " Used *m_usedClass;\n" + "};\n" + "\\endcode\n" + "Om \\c MAX_DOT_GRAPH_HEIGHT är satt till 240 i konfigurationsfilen, " + "kommer följande graf att generas:" + "<p><center><img alt=\"\" src=\"graph_legend."+Config_getEnum("DOT_IMAGE_FORMAT")+"\"></center>\n" + "<p>\n" + "Rektanglarna i den ovanstående grafen har följande betydelser:\n" + "<ul>\n" + "<li>%En fylld svart rektangel representerar den strukt eller klass " + "som har genererat grafen.\n" + "<li>%En rektangel med svart kant symboliserar en dokumenterad " + "strukt eller klass.\n" + "<li>%En rektangel med grå kant symboliserar en odokumenterad strukt " + "eller klass.\n" + "<li>%En klass med röd kant symboliserar en strukt eller klass där " + "alla dess relationer inte visas. %En graf stympas om den inte får " + "plats inom de givna gränserna.\n" + "</ul>\n" + "Pilarna har följande betydelser:\n" + "<ul>\n" + "<li>%En mörkblå pil används för att visualisera en publik arvrelation " + "mellan två klasser.\n" + "<li>%En mörkgrön pil används för en skyddad arvsrelation.\n" + "<li>%En mörkröd pil används för en privat arvsrelation.\n" + "<li>%En sträckad lila pil används om en klass är innesluten eller " + "använd av en annan klass. Vid pilen står namnet på den eller de " + "variabler som klassen pilen pekar på kommer åt.\n" + "<li>%En sträckad gul pil symboliserar förhållandet mellan en " + "template-instans och template-klassen, som den instantierades från.\n" + "Vid pilen står instansens template-parametrar.\n" + "</ul>\n"; + } + + /*! text for the link to the legend page */ + virtual QCString trLegend() + { + return "förklaring"; + } + +////////////////////////////////////////////////////////////////////////// +// new since 1.2.0 +////////////////////////////////////////////////////////////////////////// + + /*! Used as a marker that is put before a test item */ + virtual QCString trTest() + { + return "Test"; + } + /*! Used as the header of the test list */ + virtual QCString trTestList() + { + return "Testlista"; + } + +////////////////////////////////////////////////////////////////////////// +// new since 1.2.1 +////////////////////////////////////////////////////////////////////////// + + /*! Used as a section header for KDE-2 IDL methods */ + virtual QCString trDCOPMethods() + { + return "DCOP metoder"; + } + +////////////////////////////////////////////////////////////////////////// +// new since 1.2.2 +////////////////////////////////////////////////////////////////////////// + + /*! Used as a section header for IDL properties */ + virtual QCString trProperties() + { + return "Egenskaper"; + } + /*! Used as a section header for IDL property documentation */ + virtual QCString trPropertyDocumentation() + { + return "Egenskapsdokumentation"; + } + +////////////////////////////////////////////////////////////////////////// +// new since 1.2.4 +////////////////////////////////////////////////////////////////////////// + + /*! Used for Java interfaces in the summary section of Java packages */ + virtual QCString trInterfaces() + { + return "Gränssnitt"; + } + /*! Used for Java classes in the summary section of Java packages */ + virtual QCString trClasses() + { + if (Config_getBool("OPTIMIZE_OUTPUT_FOR_C")) + { + return "Datastrukturer"; + } + else + { + return "Klasser"; + } + } + /*! Used as the title of a Java package */ + virtual QCString trPackage(const char *name) + { + return (QCString)"Paket "+name; + } + /*! Title of the package index page */ + virtual QCString trPackageList() + { + return "Paketlista"; + } + /*! The description of the package index page */ + virtual QCString trPackageListDescription() + { + return "Här är en lista över paketen med en kort beskrivning " + "(om sådan finns):"; + } + /*! The link name in the Quick links header for each page */ + virtual QCString trPackages() + { + return "Paket"; + } + /*! Used as a chapter title for Latex & RTF output */ + virtual QCString trPackageDocumentation() + { + return "Paketdokumentation"; + } + /*! Text shown before a multi-line define */ + virtual QCString trDefineValue() + { + return "Värde:"; + } + +////////////////////////////////////////////////////////////////////////// +// new since 1.2.5 +////////////////////////////////////////////////////////////////////////// + + /*! Used as a marker that is put before a \\bug item */ + virtual QCString trBug() + { + return "Bugg"; + } + /*! Used as the header of the bug list */ + virtual QCString trBugList() + { + return "Bugglista"; + } + +////////////////////////////////////////////////////////////////////////// +// new since 1.2.6 +////////////////////////////////////////////////////////////////////////// + + /*! Used as ansicpg for RTF file + * (used table extract:) + * <pre> + * Charset Name Charset Value(hex) Codepage number + * ------------------------------------------------------ + * ANSI_CHARSET 0 (x00) 1252 + * </pre> + */ + virtual QCString trRTFansicp() + { + return "1252"; + } + + /*! Used as ansicpg for RTF fcharset */ + virtual QCString trRTFCharSet() + { + return "0"; + } + + /*! Used as header RTF general index */ + virtual QCString trRTFGeneralIndex() + { + return "Index"; + } + + /*! This is used for translation of the word that will possibly + * be followed by a single name or by a list of names + * of the category. + */ + virtual QCString trClass(bool first_capital, bool singular) + { + QCString result((first_capital ? "Klass" : "klass")); + if (!singular) result+="er"; + return result; + } + + /*! This is used for translation of the word that will possibly + * be followed by a single name or by a list of names + * of the category. + */ + virtual QCString trFile(bool first_capital, bool singular) + { + QCString result((first_capital ? "Fil" : "fil")); + if (!singular) result+="er"; + return result; + } + + /*! This is used for translation of the word that will possibly + * be followed by a single name or by a list of names + * of the category. + */ + virtual QCString trNamespace(bool first_capital, bool singular) + { + QCString result((first_capital ? "Namnrymd" : "namnrynd")); + if (!singular) result+="er"; + return result; + } + + /*! This is used for translation of the word that will possibly + * be followed by a single name or by a list of names + * of the category. + */ + virtual QCString trGroup(bool first_capital, bool singular) + { + QCString result((first_capital ? "Grupp" : "grupp")); + if (!singular) result+="er"; + return result; + } + + /*! This is used for translation of the word that will possibly + * be followed by a single name or by a list of names + * of the category. + */ + virtual QCString trPage(bool first_capital, bool singular) + { + QCString result((first_capital ? "Sid" : "sid")); + if (singular) + result+="a"; + else + result+="or"; + return result; + } + + /*! This is used for translation of the word that will possibly + * be followed by a single name or by a list of names + * of the category. + */ + virtual QCString trMember(bool first_capital, bool singular) + { + QCString result((first_capital ? "Medlem" : "medlem")); + if (!singular) result+="mar"; + return result; + } + + /*! This is used for translation of the word that will possibly + * be followed by a single name or by a list of names + * of the category. + */ + virtual QCString trField(bool first_capital, bool /*singular*/) + { + QCString result((first_capital ? "Fält" : "fält")); + return result; + } + + /*! This is used for translation of the word that will possibly + * be followed by a single name or by a list of names + * of the category. + */ + virtual QCString trGlobal(bool first_capital, bool singular) + { + QCString result((first_capital ? "Global" : "global")); + if (!singular) result+="er"; + return result; + } + +////////////////////////////////////////////////////////////////////////// +// new since 1.2.7 +////////////////////////////////////////////////////////////////////////// + + /*! This text is generated when the \\author command is used and + * for the author section in man pages. */ + virtual QCString trAuthor(bool first_capital, bool /*singular*/) + { + QCString result((first_capital ? "Författare" : "författare")); + return result; + } + +////////////////////////////////////////////////////////////////////////// +// new since 1.2.11 +////////////////////////////////////////////////////////////////////////// + + /*! This text is put before the list of members referenced by a member + */ + virtual QCString trReferences() + { + return "Referenser"; + } + +////////////////////////////////////////////////////////////////////////// +// new since 1.2.13 +////////////////////////////////////////////////////////////////////////// + + /*! used in member documentation blocks to produce a list of + * members that are implemented by this one. + */ + virtual QCString trImplementedFromList(int numEntries) + { + return "Implementerar "+trWriteList(numEntries)+"."; + } + + /*! used in member documentation blocks to produce a list of + * all members that implement this abstract member. + */ + virtual QCString trImplementedInList(int numEntries) + { + return "Implementerad i "+trWriteList(numEntries)+"."; + } + +////////////////////////////////////////////////////////////////////////// +// new since 1.2.16 +////////////////////////////////////////////////////////////////////////// + + /*! used in RTF documentation as a heading for the Table + * of Contents. + */ + virtual QCString trRTFTableOfContents() + { + return "Innehållsförteckning"; + } + +////////////////////////////////////////////////////////////////////////// +// new since 1.2.17 +////////////////////////////////////////////////////////////////////////// + + /*! Used as the header of the list of item that have been + * flagged deprecated + */ + virtual QCString trDeprecatedList() + { + return "Lista över föråldrade"; + } + +////////////////////////////////////////////////////////////////////////// +// new since 1.2.18 +////////////////////////////////////////////////////////////////////////// + + /*! Used as a header for declaration section of the events found in + * a C# program + */ + virtual QCString trEvents() + { + return "Händelser"; + } + /*! Header used for the documentation section of a class' events. */ + virtual QCString trEventDocumentation() + { + return "Händelse Dokumentation"; + } + +////////////////////////////////////////////////////////////////////////// +// new since 1.3 +////////////////////////////////////////////////////////////////////////// + + /*! Used as a heading for a list of Java class types with package scope. + */ + virtual QCString trPackageTypes() + { + return "Paket typer"; + } + /*! Used as a heading for a list of Java class functions with package + * scope. + */ + virtual QCString trPackageMembers() + { + return "Paket funktioner"; + } + /*! Used as a heading for a list of static Java class functions with + * package scope. + */ + virtual QCString trStaticPackageMembers() + { + return "Statiska paket funktioner"; + } + /*! Used as a heading for a list of Java class variables with package + * scope. + */ + virtual QCString trPackageAttribs() + { + return "Paket attribut"; + } + /*! Used as a heading for a list of static Java class variables with + * package scope. + */ + virtual QCString trStaticPackageAttribs() + { + return "Statiska paket attribut"; + } + +////////////////////////////////////////////////////////////////////////// +// new since 1.3.1 +////////////////////////////////////////////////////////////////////////// + + /*! Used in the quick index of a class/file/namespace member list page + * to link to the unfiltered list of all members. + */ + virtual QCString trAll() + { + return "Alla"; + } + /*! Put in front of the call graph for a function. */ + virtual QCString trCallGraph() + { + return "Här är anropnings diagrammet för den här funktionen:"; + } + + + }; #endif diff --git a/src/translator_sr.h b/src/translator_sr.h index 8fe5973..4ee9a12 100644 --- a/src/translator_sr.h +++ b/src/translator_sr.h @@ -20,7 +20,7 @@ // translation by Dejan D. M. Milosavljevic <dmilos@email.com>;<dmilosx@ptt.yu> -class TranslatorSerbian : public Translator +class TranslatorSerbian : public TranslatorAdapter_1_3_3 { private: QCString decode(const QCString& sInput) diff --git a/src/translator_tw.h b/src/translator_tw.h index bccfece..646d992 100644 --- a/src/translator_tw.h +++ b/src/translator_tw.h @@ -41,7 +41,7 @@ // Translator class (by the local maintainer) when the localized // translator is made up-to-date again. -class TranslatorChinesetraditional : public Translator +class TranslatorChinesetraditional : public TranslatorAdapter_1_3_3 { public: diff --git a/src/util.cpp b/src/util.cpp index 832ff5f..bab9314 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -542,7 +542,9 @@ NamespaceDef *getResolvedNamespace(const char *name) } } -ClassDef *getResolvedClass( +static QDict<Definition> g_resolvedScopes; + +ClassDef *getResolvedClassRecursive( Definition *scope, const char *n, bool *pIsTypeDef, @@ -678,8 +680,13 @@ ClassDef *getResolvedClass( NamespaceDef *und; for (nli.toFirst();(und=nli.current());++nli) { - cd = getResolvedClass(und,name,pIsTypeDef,pTemplSpec); - if (cd) break; + if (g_resolvedScopes.find(und->name())==0) + { + g_resolvedScopes.insert(und->name(),und); + cd = getResolvedClassRecursive(und,name,pIsTypeDef,pTemplSpec); + g_resolvedScopes.remove(und->name()); + if (cd) break; + } } } } @@ -697,6 +704,18 @@ found: return cd; } + +ClassDef *getResolvedClass( + Definition *scope, + const char *n, + bool *pIsTypeDef, + QCString *pTemplSpec + ) +{ + g_resolvedScopes.clear(); + return getResolvedClassRecursive(scope,n,pIsTypeDef,pTemplSpec); +} + static bool findOperator(const QCString &s,int i) { int b = s.findRev("operator",i); @@ -1526,45 +1545,51 @@ static void trimNamespaceScope(QCString &t1,QCString &t2,const QCString &nsName) */ void stripIrrelevantConstVolatile(QCString &s) { + //printf("stripIrrelevantConstVolatile(%s)=",s.data()); int i; if (s=="const") { s.resize(0); return; } if (s=="volatile") { s.resize(0); return; } // strip occurrences of const + int constLen=6; i = s.find("const "); + if (i==-1 && s.right(5)=="const") { i=s.length()-5;constLen=5; } if (i!=-1) { // no & or * after the const - int i1=s.find('*',i+6); - int i2=s.find('&',i+6); + int i1=s.find('*',i+constLen); + int i2=s.find('&',i+constLen); if (i1==-1 && i2==-1) { - s=s.left(i)+s.right(s.length()-i-6); + s=s.left(i)+s.right(s.length()-i-constLen); } else if ((i1!=-1 && i<i1) || (i2!=-1 && i<i2)) // const before * or & { // move const to front - s=(QCString)"const "+s.left(i)+s.right(s.length()-i-6); + s=(QCString)"const "+s.left(i)+s.right(s.length()-i-constLen); } } // strip occurrences of volatile + int volatileLen=6; i = s.find("volatile "); + if (i==-1 && s.right(8)=="volatile") { i=s.length()-8;constLen=8; } if (i!=-1) { // no & or * after the volatile - int i1=s.find('*',i+9); - int i2=s.find('&',i+9); + int i1=s.find('*',i+volatileLen); + int i2=s.find('&',i+volatileLen); if (i1==-1 && i2==-1) { - s=s.left(i)+s.right(s.length()-i-9); + s=s.left(i)+s.right(s.length()-i-volatileLen); } else if ((i1!=-1 && i<i1) || (i2!=-1 && i<i2)) // volatile before * or & { // move volatile to front - s=(QCString)"volatile "+s.left(i)+s.right(s.length()-i-9); + s=(QCString)"volatile "+s.left(i)+s.right(s.length()-i-volatileLen); } } + //printf("%s\n",s.data()); } @@ -2608,7 +2633,7 @@ bool resolveRef(/* in */ const char *scName, return FALSE; } -QCString linkToText(const char *link) +QCString linkToText(const char *link,bool isFileName) { QCString result=link; if (!result.isEmpty()) @@ -2616,8 +2641,8 @@ QCString linkToText(const char *link) // replace # by :: result=substitute(result,"#","::"); // replace . by :: - result=substitute(result,".","::"); - // strip :: prefix if present + if (!isFileName) result=substitute(result,".","::"); + // strip leading :: prefix if present if (result.at(0)==':' && result.at(1)==':') { result=result.right(result.length()-2); @@ -2658,7 +2683,7 @@ bool generateRef(OutputDocInterface &od,const char *scName, MemberDef *md; // create default link text - QCString linkText = linkToText(rt); + QCString linkText = linkToText(rt,FALSE); if (resolveRef(scName,name,inSeeBlock,&compound,&md)) { @@ -2680,6 +2705,10 @@ bool generateRef(OutputDocInterface &od,const char *scName, { linkText=((GroupDef *)compound)->groupTitle(); } + if (compound && compound->definitionType()==Definition::TypeFile) + { + linkText=linkToText(rt,TRUE); + } od.writeObjectLink(compound->getReference(), compound->getOutputFileBase(), 0,linkText); @@ -2784,7 +2813,7 @@ bool generateLink(OutputDocInterface &od,const char *clName, //printf("generateLink(clName=%s,lr=%s,lr=%s)\n",clName,lr,lt); Definition *compound; //PageDef *pageDef=0; - QCString anchor,linkText=linkToText(lt); + QCString anchor,linkText=linkToText(lt,FALSE); //printf("generateLink linkText=%s\n",linkText.data()); if (resolveLink(clName,lr,inSeeBlock,&compound,anchor)) { @@ -2808,7 +2837,7 @@ bool generateLink(OutputDocInterface &od,const char *clName, } else if (compound->definitionType()==Definition::TypeFile) { - linkText=lt; // use text "as is" + linkText=linkToText(lt,TRUE); } od.writeObjectLink(compound->getReference(), compound->getOutputFileBase(),anchor,linkText); @@ -4031,6 +4060,7 @@ void filterLatexString(QTextStream &t,const char *str, theTranslator->idLanguage()=="chinese-traditional"; static bool isLatin2 = theTranslator->idLanguageCharset()=="iso-8859-2"; static bool isGreek = theTranslator->idLanguage()=="greek"; + //printf("filterLatexString(%s)\n",str); if (str) { const unsigned char *p=(const unsigned char *)str; @@ -198,7 +198,7 @@ void filterLatexString(QTextStream &t,const char *str, bool insideTabbing=FALSE,bool insidePre=FALSE, bool insideItem=FALSE); QCString rtfFormatBmkStr(const char *name); -QCString linkToText(const char *link); +QCString linkToText(const char *link,bool isFileName); QCString stripExtension(const char *fName); void replaceNamespaceAliases(QCString &scope,int i); diff --git a/src/xmldocvisitor.cpp b/src/xmldocvisitor.cpp index 51dac52..917bb7a 100644 --- a/src/xmldocvisitor.cpp +++ b/src/xmldocvisitor.cpp @@ -89,6 +89,7 @@ void XmlDocVisitor::visit(DocSymbol *s) case DocSymbol::Szlig: m_t << "<szlig/>"; break; case DocSymbol::Cedil: m_t << "<cedil char=\"" << s->letter() << "\"/>"; break; case DocSymbol::Ring: m_t << "<ring char=\"" << s->letter() << "\"/>"; break; + case DocSymbol::Slash: m_t << "<slash char=\"" << s->letter() << "\"/>"; break; case DocSymbol::Nbsp: m_t << "<nonbreakablespace/>"; break; default: err("Error: unknown symbol found\n"); @@ -653,14 +654,14 @@ void XmlDocVisitor::visitPost(DocLink *) void XmlDocVisitor::visitPre(DocRef *ref) { if (m_hide) return; - startLink(ref->ref(),ref->file(),ref->anchor()); + if (!ref->file().isEmpty()) startLink(ref->ref(),ref->file(),ref->anchor()); if (!ref->hasLinkText()) filter(ref->targetTitle()); } -void XmlDocVisitor::visitPost(DocRef *) +void XmlDocVisitor::visitPost(DocRef *ref) { if (m_hide) return; - endLink(); + if (!ref->file().isEmpty()) endLink(); m_t << " "; } diff --git a/src/xmlgen.cpp b/src/xmlgen.cpp index f2f669e..695f9b2 100644 --- a/src/xmlgen.cpp +++ b/src/xmlgen.cpp @@ -391,14 +391,14 @@ static void writeTemplateList(ClassDef *cd,QTextStream &t) static void writeXMLDocBlock(QTextStream &t, const QCString &fileName, int lineNr, - const QCString &scope, + Definition *scope, MemberDef * md, const QCString &text) { QCString stext = text.stripWhiteSpace(); if (stext.isEmpty()) return; // convert the documentation string into an abstract syntax tree - DocNode *root = validatingParseDoc(fileName,lineNr,scope,md,text+"\n",FALSE); + DocNode *root = validatingParseDoc(fileName,lineNr,scope,md,text+"\n",FALSE,FALSE); // create a code generator XMLCodeGenerator *xmlCodeGen = new XMLCodeGenerator(t); // create a parse tree visitor for XML @@ -653,7 +653,7 @@ static void generateXMLForMember(MemberDef *md,QTextStream &ti,QTextStream &t,De { t << " <briefdescription>"; writeXMLDocBlock(t,md->getDefFileName(),md->getDefLine(), - scopeName,md,defArg->docs); + md->getOuterScope(),md,defArg->docs); t << "</briefdescription>" << endl; } t << " </param>" << endl; @@ -717,20 +717,20 @@ static void generateXMLForMember(MemberDef *md,QTextStream &ti,QTextStream &t,De t << "</initializer>" << endl; } t << " <briefdescription>" << endl; - writeXMLDocBlock(t,emd->briefFile(),emd->briefLine(),scopeName,emd,emd->briefDescription()); + writeXMLDocBlock(t,emd->briefFile(),emd->briefLine(),emd->getOuterScope(),emd,emd->briefDescription()); t << " </briefdescription>" << endl; t << " <detaileddescription>" << endl; - writeXMLDocBlock(t,emd->docFile(),emd->docLine(),scopeName,emd,emd->documentation()); + writeXMLDocBlock(t,emd->docFile(),emd->docLine(),emd->getOuterScope(),emd,emd->documentation()); t << " </detaileddescription>" << endl; t << " </enumvalue>" << endl; } } } t << " <briefdescription>" << endl; - writeXMLDocBlock(t,md->briefFile(),md->briefLine(),scopeName,md,md->briefDescription()); + writeXMLDocBlock(t,md->briefFile(),md->briefLine(),md->getOuterScope(),md,md->briefDescription()); t << " </briefdescription>" << endl; t << " <detaileddescription>" << endl; - writeXMLDocBlock(t,md->docFile(),md->docLine(),scopeName,md,md->documentation()); + writeXMLDocBlock(t,md->docFile(),md->docLine(),md->getOuterScope(),md,md->documentation()); t << " </detaileddescription>" << endl; if (md->getDefLine()!=-1) { @@ -996,10 +996,10 @@ static void generateXMLForClass(ClassDef *cd,QTextStream &ti) generateXMLSection(cd,ti,t,&cd->related,"related"); t << " <briefdescription>" << endl; - writeXMLDocBlock(t,cd->briefFile(),cd->briefLine(),cd->name(),0,cd->briefDescription()); + writeXMLDocBlock(t,cd->briefFile(),cd->briefLine(),cd,0,cd->briefDescription()); t << " </briefdescription>" << endl; t << " <detaileddescription>" << endl; - writeXMLDocBlock(t,cd->docFile(),cd->docLine(),cd->name(),0,cd->documentation()); + writeXMLDocBlock(t,cd->docFile(),cd->docLine(),cd,0,cd->documentation()); t << " </detaileddescription>" << endl; DotClassGraph inheritanceGraph(cd,DotNode::Inheritance, Config_getInt("MAX_DOT_GRAPH_DEPTH")); @@ -1105,10 +1105,10 @@ static void generateXMLForNamespace(NamespaceDef *nd,QTextStream &ti) generateXMLSection(nd,ti,t,&nd->decVarMembers,"var"); t << " <briefdescription>" << endl; - writeXMLDocBlock(t,nd->briefFile(),nd->briefLine(),0,0,nd->briefDescription()); + writeXMLDocBlock(t,nd->briefFile(),nd->briefLine(),nd,0,nd->briefDescription()); t << " </briefdescription>" << endl; t << " <detaileddescription>" << endl; - writeXMLDocBlock(t,nd->docFile(),nd->docLine(),0,0,nd->documentation()); + writeXMLDocBlock(t,nd->docFile(),nd->docLine(),nd,0,nd->documentation()); t << " </detaileddescription>" << endl; t << " <location file=\"" << nd->getDefFileName() << "\" line=\"" @@ -1240,10 +1240,10 @@ static void generateXMLForFile(FileDef *fd,QTextStream &ti) generateXMLSection(fd,ti,t,&fd->decVarMembers,"var"); t << " <briefdescription>" << endl; - writeXMLDocBlock(t,fd->briefFile(),fd->briefLine(),0,0,fd->briefDescription()); + writeXMLDocBlock(t,fd->briefFile(),fd->briefLine(),fd,0,fd->briefDescription()); t << " </briefdescription>" << endl; t << " <detaileddescription>" << endl; - writeXMLDocBlock(t,fd->docFile(),fd->docLine(),0,0,fd->documentation()); + writeXMLDocBlock(t,fd->docFile(),fd->docLine(),fd,0,fd->documentation()); t << " </detaileddescription>" << endl; t << " <programlisting>" << endl; writeXMLCodeBlock(t,fd); @@ -1364,10 +1364,10 @@ static void generateXMLForGroup(GroupDef *gd,QTextStream &ti) generateXMLSection(gd,ti,t,&gd->decVarMembers,"var"); t << " <briefdescription>" << endl; - writeXMLDocBlock(t,gd->briefFile(),gd->briefLine(),0,0,gd->briefDescription()); + writeXMLDocBlock(t,gd->briefFile(),gd->briefLine(),gd,0,gd->briefDescription()); t << " </briefdescription>" << endl; t << " <detaileddescription>" << endl; - writeXMLDocBlock(t,gd->docFile(),gd->docLine(),0,0,gd->documentation()); + writeXMLDocBlock(t,gd->docFile(),gd->docLine(),gd,0,gd->documentation()); t << " </detaileddescription>" << endl; t << " </compounddef>" << endl; t << "</doxygen>" << endl; @@ -1412,7 +1412,7 @@ static void generateXMLForPage(PageDef *pd,QTextStream &ti) t << " <title>" << convertToXML(si->title) << "</title>" << endl; } t << " <detaileddescription>" << endl; - writeXMLDocBlock(t,pd->docFile(),pd->docLine(),0,0,pd->documentation()); + writeXMLDocBlock(t,pd->docFile(),pd->docLine(),pd,0,pd->documentation()); t << " </detaileddescription>" << endl; t << " </compounddef>" << endl; t << "</doxygen>" << endl; |