diff options
author | Dimitri van Heesch <dimitri@stack.nl> | 2004-09-13 17:26:00 (GMT) |
---|---|---|
committer | Dimitri van Heesch <dimitri@stack.nl> | 2004-09-13 17:26:00 (GMT) |
commit | 2fbdd54de993944146888498d997e6ade29e8d8c (patch) | |
tree | e74e4a8d2b3a92ce8032ad6114a63f1ddb8fed48 /src | |
parent | 4ccd672ea5dbda17649f2e33577b5ab7eb02db7e (diff) | |
download | Doxygen-2fbdd54de993944146888498d997e6ade29e8d8c.zip Doxygen-2fbdd54de993944146888498d997e6ade29e8d8c.tar.gz Doxygen-2fbdd54de993944146888498d997e6ade29e8d8c.tar.bz2 |
Release-1.3.8-20040913
Diffstat (limited to 'src')
-rw-r--r-- | src/classdef.cpp | 2 | ||||
-rw-r--r-- | src/code.l | 2 | ||||
-rw-r--r-- | src/commentcnv.l | 2 | ||||
-rw-r--r-- | src/config.l | 3 | ||||
-rw-r--r-- | src/declinfo.l | 2 | ||||
-rw-r--r-- | src/dirdef.cpp | 15 | ||||
-rw-r--r-- | src/docparser.cpp | 4 | ||||
-rw-r--r-- | src/dot.cpp | 10 | ||||
-rw-r--r-- | src/dot.h | 8 | ||||
-rw-r--r-- | src/doxygen.cpp | 19 | ||||
-rw-r--r-- | src/filedef.cpp | 2 | ||||
-rw-r--r-- | src/groupdef.cpp | 2 | ||||
-rw-r--r-- | src/memberdef.cpp | 6 | ||||
-rw-r--r-- | src/namespacedef.cpp | 2 | ||||
-rw-r--r-- | src/scanner.l | 52 | ||||
-rw-r--r-- | src/search.php | 68 | ||||
-rw-r--r-- | src/search_php.h | 68 | ||||
-rw-r--r-- | src/searchindex.cpp | 46 | ||||
-rw-r--r-- | src/searchindex.h | 4 | ||||
-rw-r--r-- | src/translator_en.h | 29 | ||||
-rw-r--r-- | src/translator_nl.h | 48 | ||||
-rw-r--r-- | src/xmlgen.cpp | 18 |
22 files changed, 276 insertions, 136 deletions
diff --git a/src/classdef.cpp b/src/classdef.cpp index 9229ce3..9fa0cd5 100644 --- a/src/classdef.cpp +++ b/src/classdef.cpp @@ -955,7 +955,7 @@ void ClassDef::writeDocumentation(OutputList &ol) if (Config_getBool("SEARCHENGINE")) { Doxygen::searchIndex->setCurrentDoc(pageTitle,getOutputFileBase()); - Doxygen::searchIndex->addWord(localName()); + Doxygen::searchIndex->addWord(localName(),TRUE); } ol.startTextBlock(); @@ -388,7 +388,7 @@ static void addToSearchIndex(const char *text) static bool searchEngineEnabled=Config_getBool("SEARCHENGINE"); if (searchEngineEnabled) { - Doxygen::searchIndex->addWord(text); + Doxygen::searchIndex->addWord(text,FALSE); } } diff --git a/src/commentcnv.l b/src/commentcnv.l index 0f9f956..76c624f 100644 --- a/src/commentcnv.l +++ b/src/commentcnv.l @@ -252,7 +252,7 @@ CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^' \\\n]{1,4}"'")) } <SComment>\n[ \t]*"//!" | <SComment>\n[ \t]*"//!<"/.*\n | -<SComment>\n[ \t]*"//!"[^<]/.*\n { +<SComment>\n[ \t]*"//!"[^<\n]/.*\n { replaceComment(1); g_readLineCtx=YY_START; BEGIN(ReadLine); diff --git a/src/config.l b/src/config.l index 4d8d4ac..96357a5 100644 --- a/src/config.l +++ b/src/config.l @@ -1001,7 +1001,8 @@ void Config::check() alias=alias.stripWhiteSpace(); if (alias.find(re)!=0) { - config_err("Illegal alias format `%s'. Use \"name=value\"\n",alias.data()); + config_err("Illegal alias format `%s'. Use \"name=value\"\n", + alias.data()); } s=aliasList.next(); } diff --git a/src/declinfo.l b/src/declinfo.l index 0be2a08..d115fb1 100644 --- a/src/declinfo.l +++ b/src/declinfo.l @@ -132,7 +132,7 @@ ID ([a-z_A-Z][a-z_A-Z0-9]*)|(@[0-9]+) } name.resize(0); } -<Start>":" { // Objective-C argument separator +<Start>{B}*":" { // Objective-C argument separator name+=yytext; } <Start>[*&]+ { diff --git a/src/dirdef.cpp b/src/dirdef.cpp index 38808f6..66ab173 100644 --- a/src/dirdef.cpp +++ b/src/dirdef.cpp @@ -207,6 +207,7 @@ void DirDef::writePathFragment(OutputList &ol) if (getOuterScope()!=Doxygen::globalScope && getOuterScope()->definitionType()==Definition::TypeDir) { + //printf("getOuterScope %s\n",getOuterScope()->name().data()); ((DirDef*)getOuterScope())->writePathFragment(ol); ol.writeString(" / "); } @@ -236,6 +237,7 @@ DirDef *DirDef::createNewDir(const char *path) { //printf("Adding new dir %s\n",path); dir = new DirDef(path); + //printf("createNewDir %s short=%s\n",path,dir->shortName().data()); Doxygen::directories.inSort(path,dir); } return dir; @@ -267,7 +269,7 @@ DirDef *DirDef::mergeDirectoryInTree(const QCString &path) while ((i=path.find('/',p))!=-1) { QCString part=path.left(i+1); - if (!matchPath(part,Config_getList("STRIP_FROM_PATH"))) + if (!matchPath(part,Config_getList("STRIP_FROM_PATH")) && part!="/") { dir=createNewDir(part); } @@ -316,13 +318,16 @@ void buildDirectories() //printf("New dir %s\n",dir->displayName().data()); QCString name = dir->name(); int i=name.findRev('/',name.length()-2); - if (i!=-1) + if (i>0) { DirDef *parent = Doxygen::directories.find(name.left(i+1)); //if (parent==0) parent=root; - if (parent) parent->addSubDir(dir); - //printf("DirDef::addSubdir(): Adding subdir\n%s to\n%s\n", - // dir->displayName().data(), parent->displayName().data()); + if (parent) + { + parent->addSubDir(dir); + //printf("DirDef::addSubdir(): Adding subdir\n%s to\n%s\n", + // dir->displayName().data(), parent->displayName().data()); + } } } } diff --git a/src/docparser.cpp b/src/docparser.cpp index d474cfe..b69c98a 100644 --- a/src/docparser.cpp +++ b/src/docparser.cpp @@ -1247,7 +1247,7 @@ DocWord::DocWord(DocNode *parent,const QString &word) : //printf("new word %s url=%s\n",word.data(),g_searchUrl.data()); if (!g_searchUrl.isEmpty()) { - Doxygen::searchIndex->addWord(word); + Doxygen::searchIndex->addWord(word,FALSE); } } @@ -1262,7 +1262,7 @@ DocLinkedWord::DocLinkedWord(DocNode *parent,const QString &word, //printf("new word %s url=%s\n",word.data(),g_searchUrl.data()); if (!g_searchUrl.isEmpty()) { - Doxygen::searchIndex->addWord(word); + Doxygen::searchIndex->addWord(word,FALSE); } } diff --git a/src/dot.cpp b/src/dot.cpp index 9e26576..4b9f11b 100644 --- a/src/dot.cpp +++ b/src/dot.cpp @@ -2327,6 +2327,16 @@ bool DotCallGraph::isTrivial() const //------------------------------------------------------------- +DotDirDeps::DotDirDeps(DirDef *) +{ +} + +DotDirDeps::~DotDirDeps() +{ +} + +//------------------------------------------------------------- + void generateGraphLegend(const char *path) { QFile dotFile((QCString)path+"/graph_legend.dot"); @@ -31,6 +31,7 @@ class DotNodeList; class ClassSDict; class MemberDef; class Definition; +class DirDef; enum GraphOutputFormat { BITMAP , EPS }; @@ -201,6 +202,13 @@ class DotCallGraph Definition * m_scope; }; +class DotDirDeps +{ + public: + DotDirDeps(DirDef *dir); + ~DotDirDeps(); +}; + void generateGraphLegend(const char *path); void writeDotGraphFromFile(const char *inFile,const char *outDir, const char *outFile,GraphOutputFormat format); diff --git a/src/doxygen.cpp b/src/doxygen.cpp index 2abe36a..588f401 100644 --- a/src/doxygen.cpp +++ b/src/doxygen.cpp @@ -1785,10 +1785,16 @@ static bool isVarWithConstructor(Entry *root) Argument *a; for (ali.toFirst();(a=ali.current());++ali) { - //printf("a->name=%s a->type=%s\n",a->name.data(),a->type.data()); if (!a->name.isEmpty() || !a->defval.isEmpty()) { - result=FALSE; // arg has (type,name) pair -> function prototype + if (a->name.find(initChars)==0) + { + result=TRUE; + } + else + { + result=FALSE; // arg has (type,name) pair -> function prototype + } goto done; } if (a->type.isEmpty() || getResolvedClass(ctx,fd,a->type)!=0) @@ -2197,8 +2203,8 @@ static void buildFunctionList(Entry *root) ClassDef *cd=0; // check if this function's parent is a class static QRegExp re("([a-z_A-Z0-9: ]*[ *]*[ ]*"); - //printf("root->parent=`%s' cd=%p root->type.find(re,0)=%d\n", - // root->parent->name.data(),getClass(root->parent->name), + //printf("root->parent=`%s' %x cd=%p root->type.find(re,0)=%d\n", + // root->parent->name.data(),root->parent->section,getClass(root->parent->name), // root->type.find(re,0)); QCString scope=stripAnonymousNamespaceScope(root->parent->name); scope=stripTemplateSpecifiersFromScope(scope,FALSE); @@ -2225,6 +2231,7 @@ static void buildFunctionList(Entry *root) isMember=memIndex<ts || memIndex>te; } } + if (root->parent && !root->parent->name.isEmpty() && (root->parent->section & Entry::COMPOUND_MASK) && @@ -6466,7 +6473,7 @@ static void findDirDocumentation(Entry *root) SDict<DirDef>::Iterator sdi(Doxygen::directories); for (sdi.toFirst();(dir=sdi.current());++sdi) { - printf("Dir: %s<->%s\n",dir->name().data(),normalizedName.data()); + //printf("Dir: %s<->%s\n",dir->name().data(),normalizedName.data()); if (dir->name().right(normalizedName.length())==normalizedName) { if (matchingDir) @@ -6486,7 +6493,7 @@ static void findDirDocumentation(Entry *root) } if (matchingDir) { - printf("Match for with dir %s\n",matchingDir->name().data()); + //printf("Match for with dir %s\n",matchingDir->name().data()); matchingDir->setBriefDescription(root->brief,root->briefFile,root->briefLine); matchingDir->setDocumentation(root->doc,root->docFile,root->docLine); } diff --git a/src/filedef.cpp b/src/filedef.cpp index a9dda5b..fbadd59 100644 --- a/src/filedef.cpp +++ b/src/filedef.cpp @@ -241,7 +241,7 @@ void FileDef::writeDocumentation(OutputList &ol) if (Config_getBool("SEARCHENGINE")) { Doxygen::searchIndex->setCurrentDoc(pageTitle,getOutputFileBase()); - Doxygen::searchIndex->addWord(localName()); + Doxygen::searchIndex->addWord(localName(),TRUE); } if (!Config_getString("GENERATE_TAGFILE").isEmpty()) diff --git a/src/groupdef.cpp b/src/groupdef.cpp index ad79427..5a032c2 100644 --- a/src/groupdef.cpp +++ b/src/groupdef.cpp @@ -468,7 +468,7 @@ void GroupDef::writeDocumentation(OutputList &ol) int i=0,p=0,l=0; while ((i=we.match(title,p,&l))!=-1) // foreach word in the title { - Doxygen::searchIndex->addWord(title.mid(i,l)); + Doxygen::searchIndex->addWord(title.mid(i,l),TRUE); p=i+l; } } diff --git a/src/memberdef.cpp b/src/memberdef.cpp index a515a3d..002352c 100644 --- a/src/memberdef.cpp +++ b/src/memberdef.cpp @@ -201,7 +201,7 @@ static bool writeDefArgumentList(OutputList &ol,ClassDef *cd, if (!md->isDefine()) { QCString key; - if (md->isObjCMethod() && a->attrib.length()>2) + if (md->isObjCMethod() && a->attrib.length()>=2) { //printf("Found parameter keyword %s\n",a->attrib.data()); // strip [ and ] @@ -845,8 +845,8 @@ void MemberDef::writeDeclaration(OutputList &ol, if (Config_getBool("SEARCHENGINE")) { Doxygen::searchIndex->setCurrentDoc(qualifiedName(),getOutputFileBase(),anchor()); - Doxygen::searchIndex->addWord(localName()); - Doxygen::searchIndex->addWord(qualifiedName()); + Doxygen::searchIndex->addWord(localName(),TRUE); + Doxygen::searchIndex->addWord(qualifiedName(),FALSE); } Definition *d=0; diff --git a/src/namespacedef.cpp b/src/namespacedef.cpp index 2d1a717..b11290f 100644 --- a/src/namespacedef.cpp +++ b/src/namespacedef.cpp @@ -282,7 +282,7 @@ void NamespaceDef::writeDocumentation(OutputList &ol) if (Config_getBool("SEARCHENGINE")) { Doxygen::searchIndex->setCurrentDoc(pageTitle,getOutputFileBase()); - Doxygen::searchIndex->addWord(localName()); + Doxygen::searchIndex->addWord(localName(),TRUE); } if (!Config_getString("GENERATE_TAGFILE").isEmpty()) diff --git a/src/scanner.l b/src/scanner.l index 8fef9b3..09b6b88 100644 --- a/src/scanner.l +++ b/src/scanner.l @@ -1101,10 +1101,17 @@ PHPKW ("require"|"require_once"|"include"|"include_once"|"echo")[^a-zA-Z0-9_;] <ObjCReturnType>")" { BEGIN( ObjCMethod ); } -<ObjCParams>{ID}{BN}*/":" { // Keyword of parameter - lineCount(); - QCString keyw = QCString(yytext).stripWhiteSpace(); - current->name += keyw; +<ObjCParams>({ID})?":" { // Keyword of parameter + QCString keyw = yytext; + keyw=keyw.left(keyw.length()-1); // strip : + if (keyw.isEmpty()) + { + current->name += " :"; + } + else + { + current->name += keyw+":"; + } if (current->argList->getLast()->type.isEmpty()) { current->argList->getLast()->type="id"; @@ -1121,19 +1128,25 @@ PHPKW ("require"|"require_once"|"include"|"include_once"|"echo")[^a-zA-Z0-9_;] current->argList->getLast()->attrib="[,]"; current->argList->getLast()->type="..."; } + /* <ObjCParams>":" { current->name += ':'; } + */ <ObjCParams>"(" { BEGIN( ObjCParamType ); } <ObjCParamType>[^)]* { - current->argList->getLast()->type=yytext; + current->argList->getLast()->type=QCString(yytext).stripWhiteSpace(); } -<ObjCParamType>")"{B}* { +<ObjCParamType>")"/{B}* { BEGIN( ObjCParams ); } <ObjCMethod,ObjCParams>";" { // end of method declaration + if (current->argList->getLast() && current->argList->getLast()->type.isEmpty()) + { + current->argList->getLast()->type="id"; + } current->args = argListToString(current->argList); //printf("argList=%s\n",current->args.data()); unput(';'); @@ -1143,6 +1156,11 @@ PHPKW ("require"|"require_once"|"include"|"include_once"|"echo")[^a-zA-Z0-9_;] //printf("Type=%s Name=%s args=%s\n", // current->type.data(),current->name.data(),argListToString(current->argList).data() // ); + if (current->argList->getLast() && current->argList->getLast()->type.isEmpty()) + { + current->argList->getLast()->type="id"; + } + current->args = argListToString(current->argList); unput('{'); BEGIN( Function ); } @@ -2094,12 +2112,19 @@ PHPKW ("require"|"require_once"|"include"|"include_once"|"echo")[^a-zA-Z0-9_;] yyLineNr++; } <ReadInitializer>"@\"" { + printf("insideCS=%d\n",insideCS); current->initializer+=yytext; - if (!insideCS) REJECT; - // C# verbatim string - lastSkipVerbStringContext=YY_START; - pSkipVerbString=¤t->initializer; - BEGIN(SkipVerbString); + if (!insideCS && !insideObjC) + { + REJECT; + } + else + { + // C#/ObjC verbatim string + lastSkipVerbStringContext=YY_START; + pSkipVerbString=¤t->initializer; + BEGIN(SkipVerbString); + } } <SkipVerbString>[^\n"]+ { *pSkipVerbString+=yytext; @@ -3589,7 +3614,10 @@ PHPKW ("require"|"require_once"|"include"|"include_once"|"echo")[^a-zA-Z0-9_;] if (insideObjC && *yytext=='(') // class category { current->name+='('; - current->section=Entry::CATEGORY_SEC; + if (current->section!=Entry::OBJCIMPL_SEC) + { + current->section=Entry::CATEGORY_SEC; + } BEGIN( ClassCategory ); } else diff --git a/src/search.php b/src/search.php index cef406c..f403af6 100644 --- a/src/search.php +++ b/src/search.php @@ -1,3 +1,4 @@ +<? function readInt($file) { $b1 = ord(fgetc($file)); $b2 = ord(fgetc($file)); @@ -60,10 +61,15 @@ function search($file,$word,&$statsList) } $w = readString($file); } - $totalFreq=0; + $totalHi=0; + $totalFreqHi=0; + $totalFreqLo=0; for ($count=$start;$count<sizeof($statsList);$count++) { $statInfo = &$statsList[$count]; + $multiplier = 1; + // whole word matches have a double weight + if ($statInfo["full"]) $multiplier=2; fseek($file,$statInfo["index"]); $numDocs = readInt($file); $docInfo = array(); @@ -72,11 +78,22 @@ function search($file,$word,&$statsList) { $idx=readInt($file); $freq=readInt($file); - $docInfo[$i]=array("idx"=>$idx,"freq"=>$freq,"rank"=>0.0); - $totalFreq+=$freq; - if ($statInfo["full"]) $totalFreq+=$freq; + $docInfo[$i]=array("idx" => $idx, + "freq" => $freq>>1, + "rank" => 0.0, + "hi" => $freq&1 + ); + if ($freq&1) // word occurs in high priority doc + { + $totalHi++; + $totalFreqHi+=$freq*$multiplier; + } + else // word occurs in low priority doc + { + $totalFreqLo+=$freq*$multiplier; + } } - // read name an url info for the doc + // read name and url info for the doc for ($i=0;$i<$numDocs;$i++) { fseek($file,$docInfo[$i]["idx"]); @@ -85,15 +102,28 @@ function search($file,$word,&$statsList) } $statInfo["docs"]=$docInfo; } + $totalFreq=($totalHi+1)*$totalFreqLo + $totalFreqHi; for ($count=$start;$count<sizeof($statsList);$count++) { $statInfo = &$statsList[$count]; + $multiplier = 1; + // whole word matches have a double weight + if ($statInfo["full"]) $multiplier=2; 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; + $freq=$docInfo[$i]["freq"]; + if ($docInfo[$i]["hi"]) + { + $statInfo["docs"][$i]["rank"]= + (float)($freq*$multiplier+$totalFreqLo)/$totalFreq; + } + else + { + $statInfo["docs"][$i]["rank"]= + (float)($freq*$multiplier)/$totalFreq; + } } } } @@ -113,7 +143,6 @@ function combine_results($results,&$docs) if (in_array($key, array_keys($docs))) { $docs[$key]["rank"]+=$rank; - $docs[$key]["rank"]*=2; // multiple matches increases rank } else { @@ -132,25 +161,6 @@ function combine_results($results,&$docs) 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(); @@ -284,7 +294,7 @@ function main() if (!in_array($word,$foundWords)) { $foundWords[]=$word; - search($file,strtolower($word),$results); + search($file,$word,$results); } $word=strtok(" "); } @@ -293,8 +303,6 @@ function main() // 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); diff --git a/src/search_php.h b/src/search_php.h index fb6668a..337662c 100644 --- a/src/search_php.h +++ b/src/search_php.h @@ -1,3 +1,4 @@ +"<?\n" "function readInt($file)\n" "{\n" " $b1 = ord(fgetc($file)); $b2 = ord(fgetc($file));\n" @@ -60,10 +61,15 @@ " }\n" " $w = readString($file);\n" " }\n" -" $totalFreq=0;\n" +" $totalHi=0;\n" +" $totalFreqHi=0;\n" +" $totalFreqLo=0;\n" " for ($count=$start;$count<sizeof($statsList);$count++)\n" " {\n" " $statInfo = &$statsList[$count];\n" +" $multiplier = 1;\n" +" // whole word matches have a double weight\n" +" if ($statInfo[\"full\"]) $multiplier=2;\n" " fseek($file,$statInfo[\"index\"]); \n" " $numDocs = readInt($file);\n" " $docInfo = array();\n" @@ -72,11 +78,22 @@ " {\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" +" $docInfo[$i]=array(\"idx\" => $idx,\n" +" \"freq\" => $freq>>1,\n" +" \"rank\" => 0.0,\n" +" \"hi\" => $freq&1\n" +" );\n" +" if ($freq&1) // word occurs in high priority doc\n" +" {\n" +" $totalHi++;\n" +" $totalFreqHi+=$freq*$multiplier;\n" +" }\n" +" else // word occurs in low priority doc\n" +" {\n" +" $totalFreqLo+=$freq*$multiplier;\n" +" }\n" " }\n" -" // read name an url info for the doc\n" +" // read name and url info for the doc\n" " for ($i=0;$i<$numDocs;$i++)\n" " {\n" " fseek($file,$docInfo[$i][\"idx\"]);\n" @@ -85,15 +102,28 @@ " }\n" " $statInfo[\"docs\"]=$docInfo;\n" " }\n" +" $totalFreq=($totalHi+1)*$totalFreqLo + $totalFreqHi;\n" " for ($count=$start;$count<sizeof($statsList);$count++)\n" " {\n" " $statInfo = &$statsList[$count];\n" +" $multiplier = 1;\n" +" // whole word matches have a double weight\n" +" if ($statInfo[\"full\"]) $multiplier=2;\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" +" $freq=$docInfo[$i][\"freq\"];\n" +" if ($docInfo[$i][\"hi\"])\n" +" {\n" +" $statInfo[\"docs\"][$i][\"rank\"]=\n" +" (float)($freq*$multiplier+$totalFreqLo)/$totalFreq;\n" +" }\n" +" else\n" +" {\n" +" $statInfo[\"docs\"][$i][\"rank\"]=\n" +" (float)($freq*$multiplier)/$totalFreq;\n" +" }\n" " }\n" " }\n" " }\n" @@ -113,7 +143,6 @@ " 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" @@ -132,25 +161,6 @@ " 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" @@ -284,7 +294,7 @@ " if (!in_array($word,$foundWords))\n" " {\n" " $foundWords[]=$word;\n" -" search($file,strtolower($word),$results);\n" +" search($file,$word,$results);\n" " }\n" " $word=strtok(\" \");\n" " }\n" @@ -293,8 +303,6 @@ " // 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" diff --git a/src/searchindex.cpp b/src/searchindex.cpp index b85d87e..ba04b6f 100644 --- a/src/searchindex.cpp +++ b/src/searchindex.cpp @@ -21,14 +21,16 @@ #include <qfile.h> -// file format: +// file format: (all multi-byte values are stored in big endian format) // 4 byte header -// 256*256*4 byte index +// 256*256*4 byte index (4 bytes) // for each index entry: a zero terminated list of words -// for each word: a 0 terminated string + 4 bytes stats index +// for each word: a \0 terminated string + 4 byte offset to the stats info // 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 +// for each word: the number of urls (4 bytes) +// + for each url containing the word 8 bytes statistics +// (4 bytes index to url string + 4 bytes frequency counter) +// for each url: a \0 terminated string const int numIndexEntries = 256*256; @@ -37,17 +39,21 @@ const int numIndexEntries = 256*256; IndexWord::IndexWord(const char *word) : m_word(word), m_urls(17) { m_urls.setAutoDelete(TRUE); + //printf("IndexWord::IndexWord(%s)\n",word); } -void IndexWord::addUrlIndex(int idx) +void IndexWord::addUrlIndex(int idx,bool hiPriority) { + //printf("IndexWord::addUrlIndex(%d,%d)\n",idx,hiPriority); URLInfo *ui = m_urls.find(idx); if (ui==0) { + //printf("URLInfo::URLInfo(%d)\n",idx); ui=new URLInfo(idx,0); m_urls.insert(idx,ui); } - ui->freq++; + ui->freq+=2; + if (hiPriority) ui->freq|=1; // mark as high priority document } //-------------------------------------------------------------------- @@ -62,6 +68,7 @@ SearchIndex::SearchIndex() : m_words(328829), m_index(numIndexEntries), m_urlInd void SearchIndex::setCurrentDoc(const char *name,const char *baseName,const char *anchor) { + //printf("SearchIndex::setCurrentDoc(%s,%s,%s)\n",name,baseName,anchor); QCString url=baseName+Config_getString("HTML_FILE_EXTENSION"); if (anchor) url+=(QCString)"#"+anchor; m_urlIndex++; @@ -79,9 +86,11 @@ static int charsToIndex(const char *word) return c1*256+c2; } -void SearchIndex::addWord(const char *word) +void SearchIndex::addWord(const char *word,bool hiPriority) { - QString wStr=QString(word).lower(); + //printf("SearchIndex::addWord(%s,%d)\n",word,hiPriority); + //QString wStr=QString(word).lower(); + QString wStr(word); if (wStr.isEmpty()) return; IndexWord *w = m_words[wStr]; if (w==0) @@ -91,9 +100,9 @@ void SearchIndex::addWord(const char *word) w = new IndexWord(wStr); //fprintf(stderr,"addWord(%s) at index %d\n",word,idx); m_index[idx]->append(w); - m_words.insert(word,w); + m_words.insert(wStr,w); } - w->addUrlIndex(m_urlIndex); + w->addUrlIndex(m_urlIndex,hiPriority); } @@ -257,21 +266,6 @@ void SearchIndex::write(const char *fileName) } } - //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 cd961a4..a2d8690 100644 --- a/src/searchindex.h +++ b/src/searchindex.h @@ -44,7 +44,7 @@ class IndexWord { public: IndexWord(const char *word); - void addUrlIndex(int); + void addUrlIndex(int,bool); const QIntDict<URLInfo> &urls() const { return m_urls; } QCString word() const { return m_word; } @@ -58,7 +58,7 @@ class SearchIndex public: SearchIndex(); void setCurrentDoc(const char *name,const char *baseName,const char *anchor=0); - void addWord(const char *word); + void addWord(const char *word,bool hiPriority); void write(const char *file); private: QDict<IndexWord> m_words; diff --git a/src/translator_en.h b/src/translator_en.h index e327541..4fba718 100644 --- a/src/translator_en.h +++ b/src/translator_en.h @@ -1560,16 +1560,41 @@ class TranslatorEnglish : public Translator // new since 1.3.9 ////////////////////////////////////////////////////////////////////////// + /*! This is used as the name of the chapter containing the directory + * hierarchy. + */ virtual QCString trDirIndex() - { return "Directories"; } + { return "Directory Hierarchy"; } + + /*! This is used as the name of the chapter containing the documentation + * of the directories. + */ virtual QCString trDirDocumentation() { return "Directory Documentation"; } + + /*! This is used as the title of the directory index and also in the + * Quick links of a HTML page, to link to the directory hierarchy. + */ virtual QCString trDirectories() { return "Directories"; } + + /*! This returns a sentences that introduces the directory hierarchy. + * and the fact that it is sorted alphabetically per level + */ virtual QCString trDirDescription() - { return "Here is a list of all directories:"; } + { return "This directory hierarchy is sorted roughly, " + "but not completely, alphabetically:"; + } + + /*! This returns the title of a directory page. The name of the + * directory is passed via \a dirName. + */ virtual QCString trDirReference(const char *dirName) { QCString result=dirName; result+=" Directory Reference"; return result; } + + /*! This returns the word directory with or without starting capital + * (\a first_capital) and in sigular or plural form (\a singular). + */ virtual QCString trDir(bool first_capital, bool singular) { QCString result((first_capital ? "Director" : "director")); diff --git a/src/translator_nl.h b/src/translator_nl.h index 12348cd..796051e 100644 --- a/src/translator_nl.h +++ b/src/translator_nl.h @@ -18,7 +18,7 @@ #ifndef TRANSLATOR_NL_H #define TRANSLATOR_NL_H -class TranslatorDutch : public TranslatorAdapter_1_3_9 +class TranslatorDutch : public Translator { public: QCString idLanguage() @@ -1154,6 +1154,52 @@ class TranslatorDutch : public TranslatorAdapter_1_3_9 return filename + " Bron Bestand"; } +////////////////////////////////////////////////////////////////////////// +// new since 1.3.9 +////////////////////////////////////////////////////////////////////////// + + /*! This is used as the name of the chapter containing the directory + * hierarchy. + */ + virtual QCString trDirIndex() + { return "Directory Hiërarchie"; } + + /*! This is used as the name of the chapter containing the documentation + * of the directories. + */ + virtual QCString trDirDocumentation() + { return "Directory Documentatie"; } + + /*! This is used as the title of the directory index and also in the + * Quick links of a HTML page, to link to the directory hierarchy. + */ + virtual QCString trDirectories() + { return "Directories"; } + + /*! This returns a sentences that introduces the directory hierarchy. + * and the fact that it is sorted alphabetically per level + */ + virtual QCString trDirDescription() + { return "Deze directory hiërarchie is min of meer alfabetisch " + "gesorteerd:"; + } + + /*! This returns the title of a directory page. The name of the + * directory is passed via \a dirName. + */ + virtual QCString trDirReference(const char *dirName) + { QCString result=dirName; result+=" Directory Referentie"; return result; } + + /*! This returns the word directory with or without starting capital + * (\a first_capital) and in sigular or plural form (\a singular). + */ + virtual QCString trDir(bool first_capital, bool singular) + { + QCString result((first_capital ? "Director" : "director")); + if (singular) result+="y"; else result+="ies"; + return result; + } + }; diff --git a/src/xmlgen.cpp b/src/xmlgen.cpp index 18e3206..27f278a 100644 --- a/src/xmlgen.cpp +++ b/src/xmlgen.cpp @@ -1678,15 +1678,15 @@ void generateXML() generateXMLForClass(cd,t); } } - { - ClassSDict::Iterator cli(Doxygen::hiddenClasses); - ClassDef *cd; - for (cli.toFirst();(cd=cli.current());++cli) - { - msg("Generating XML output for class %s\n",cd->name().data()); - generateXMLForClass(cd,t); - } - } + //{ + // ClassSDict::Iterator cli(Doxygen::hiddenClasses); + // ClassDef *cd; + // for (cli.toFirst();(cd=cli.current());++cli) + // { + // msg("Generating XML output for class %s\n",cd->name().data()); + // generateXMLForClass(cd,t); + // } + //} NamespaceSDict::Iterator nli(Doxygen::namespaceSDict); NamespaceDef *nd; for (nli.toFirst();(nd=nli.current());++nli) |