void FixedFormParser::parse(const QString &fileName) { QFile f(QFile::encodeName(fileName)); if (!f.open(IO_ReadOnly)) return; QTextStream stream(&f); m_file = m_model->create<FileModel>(); m_file->setName( fileName ); QCString line; int lineNum=0, startLineNum=0; while (!stream.atEnd()) { ++lineNum; QCString str = stream.readLine().local8Bit(); if (!str.isEmpty() && QCString("*Cc#!").find(str[0]) != -1) continue; // Continuation line if (str.length() > 6 && str.left(5) == " " && str[5] != ' ') { line += str.right(str.length()-6); continue; } // An initial or invalid line. We don't care // about validity process(line, fileName, startLineNum); line = str.right(str.length()-6); startLineNum = lineNum-1; } process(line, fileName, startLineNum); f.close(); m_model->addFile( m_file ); }
static QCString getListOfBibFiles(const QCString &sep,bool stripExtension) { QCString result; QStrList &citeDataList = Config_getList("CITE_BIB_FILES"); const char *bibdata = citeDataList.first(); while (bibdata) { int i; QCString bibFile = bibdata; if (stripExtension && bibFile.right(4)==".bib") { bibFile = bibFile.left(bibFile.length()-4); } if (stripExtension && (i=bibFile.findRev('/'))!=-1) { bibFile = bibFile.mid(i+1); } if (!bibFile.isEmpty()) { result+=bibFile; bibdata = citeDataList.next(); if (bibdata) { result+=sep; } } else { bibdata = citeDataList.next(); } } return result; }
void CiteDict::clean() { // clean QDir thisDir; QStrList &citeDataList = Config_getList("CITE_BIB_FILES"); const char *bibdata = citeDataList.first(); while (bibdata) { QCString bibFile = bibdata; if (!bibFile.isEmpty() && bibFile.right(4)!=".bib") bibFile+=".bib"; if (!bibFile.isEmpty()) thisDir.remove(m_baseFileName+"_"+bibFile); bibdata = citeDataList.next(); } thisDir.remove(m_baseFileName + ".aux"); thisDir.remove(m_baseFileName + ".bbl"); thisDir.remove(m_baseFileName + ".blg"); thisDir.remove(m_baseFileName + ".tmp"); thisDir.remove(m_baseFileName + ".bst"); QCString &outputDirectory = Config_getString("OUTPUT_DIRECTORY"); if (outputDirectory.isEmpty()) { outputDirectory=QDir::currentDirPath(); } QDir d(outputDirectory); d.rmdir("bib"); }
void ManGenerator::startDoxyAnchor(const char *,const char *manName, const char *, const char *name, const char *) { // something to be done? if( !Config_getBool("MAN_LINKS") ) { return; // no } // the name of the link file is derived from the name of the anchor: // - truncate after an (optional) :: QCString baseName = name; int i=baseName.findRev("::"); if (i!=-1) baseName=baseName.right(baseName.length()-i-2); //printf("Converting man link '%s'->'%s'->'%s'\n", // name,baseName.data(),buildFileName(baseName).data()); // - remove dangerous characters and append suffix, then add dir prefix QCString fileName=dir+"/"+buildFileName( baseName ); QFile linkfile( fileName ); // - only create file if it doesn't exist already if ( !linkfile.open( IO_ReadOnly ) ) { if ( linkfile.open( IO_WriteOnly ) ) { FTextStream linkstream; linkstream.setDevice(&linkfile); //linkstream.setEncoding(QTextStream::UnicodeUTF8); linkstream << ".so " << getSubdir() << "/" << buildFileName( manName ) << endl; } } linkfile.close(); }
void ManGenerator::startDoxyAnchor(const char *,const char *manName, const char *, const char *name, const char *) { // something to be done? if( !Config_getBool("MAN_LINKS") ) { return; // no } // the name of the link file is derived from the name of the anchor: // - truncate after an (optional) :: QCString baseName = name; int i=baseName.findRev(':'); if (i!=-1) baseName=baseName.right(baseName.length()-i-1); // - remove dangerous characters and append suffix, then add dir prefix QCString fileName=dir+"/"+buildFileName( baseName ); QFile linkfile( fileName ); // - only create file if it doesn't exist already if ( !linkfile.open( IO_ReadOnly ) ) { if ( linkfile.open( IO_WriteOnly ) ) { QTextStream linkstream; linkstream.setDevice(&linkfile); #if QT_VERSION >= 200 linkstream.setEncoding(QTextStream::Latin1); #endif linkstream << ".so man" << getExtension() << "/" << buildFileName( manName ) << endl; } } linkfile.close(); }
void VhdlParser::oneLineComment(QCString qcs) { bool isEndCode=qcs.contains("\\endcode"); int index = qcs.find("\\code"); if (isEndCode) { int end = inputString.find(qcs.data(),iCodeLen); makeInlineDoc(end); } else if (index > 0) { // assert(false); strComment=qcs; startCodeBlock(index); strComment.resize(0); } if (!isEndCode && index==-1) { int j=qcs.find("--!"); qcs=qcs.right(qcs.length()-3-j); if (!checkMultiComment(qcs,iDocLine)) { handleCommentBlock(qcs,TRUE); } } }
void FileDef::writeDetailedDescription(OutputList &ol,const QCString &title) { if ((!briefDescription().isEmpty() && Config_getBool("REPEAT_BRIEF")) || !documentation().isEmpty() || (Config_getBool("SOURCE_BROWSER") && getStartBodyLine()!=-1 && getBodyDef()) ) { ol.pushGeneratorState(); ol.disable(OutputGenerator::Html); ol.writeRuler(); ol.popGeneratorState(); ol.pushGeneratorState(); ol.disableAllBut(OutputGenerator::Html); ol.writeAnchor(0,"details"); ol.popGeneratorState(); ol.startGroupHeader(); ol.parseText(title); ol.endGroupHeader(); ol.startTextBlock(); if (!briefDescription().isEmpty() && Config_getBool("REPEAT_BRIEF")) { ol.parseDoc(briefFile(),briefLine(),this,0,briefDescription(),FALSE,FALSE); } if (!briefDescription().isEmpty() && Config_getBool("REPEAT_BRIEF") && !documentation().isEmpty()) { ol.pushGeneratorState(); ol.disable(OutputGenerator::Man); ol.disable(OutputGenerator::RTF); // ol.newParagraph(); // FIXME:PARA ol.enableAll(); ol.disableAllBut(OutputGenerator::Man); ol.writeString("\n\n"); ol.popGeneratorState(); } if (!documentation().isEmpty()) { 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")) { ol.startParagraph(); QCString refText = theTranslator->trDefinedInSourceFile(); int fileMarkerPos = refText.find("@0"); if (fileMarkerPos!=-1) // should always pass this. { ol.parseText(refText.left(fileMarkerPos)); //text left from marker 1 ol.writeObjectLink(0,getSourceFileBase(), 0,name()); ol.parseText(refText.right( refText.length()-fileMarkerPos-2)); // text right from marker 2 } ol.endParagraph(); } ol.endTextBlock(); } }
bool CiteDict::writeAux() { //msg("..writing aux file\n"); QCString auxFileName(m_baseFileName + ".aux"); QFile auxFile(auxFileName); if (!auxFile.open(IO_WriteOnly)) // point it to something valid, because warn() relies on it { err("Error opening file %s for output\n", auxFileName.data()); return FALSE; } FTextStream t(&auxFile); QDictIterator<CiteInfo> cdi(m_entries); for (CiteInfo *ci = 0; (ci=cdi.current()); ++cdi) { t << "\\citation{" << ci->label << "}\n"; } t << "\\bibstyle{" << m_baseFileName << "}\n"; t << "\\bibdata{"; QStrList &citeDataList = Config_getList("CITE_BIB_FILES"); const char *bibdata = citeDataList.first(); while (bibdata) { QCString bibFile = bibdata; if (!bibFile.isEmpty() && bibFile.right(4)!=".bib") bibFile+=".bib"; if (!bibFile.isEmpty()) { QFileInfo fi(bibFile); if (fi.exists()) { if (!copyFile(bibFile,m_baseFileName+"_"+bibFile)) { return FALSE; } t << m_baseFileName+"_"+bibFile; bibdata = citeDataList.next(); if (bibdata) { t << ","; } } else { err("The file %s specified at CITE_BIB_FILES could not be read!\n",bibdata); return FALSE; } } else { bibdata = citeDataList.next(); } } t << "}\n"; return TRUE; }
static QCString getListOfBibFiles(const QCString &sep,bool namesOnly) { QCString result; QStrList &citeDataList = Config_getList("CITE_BIB_FILES"); const char *bibdata = citeDataList.first(); while (bibdata) { int i; QCString bibFile = bibdata; if (namesOnly && bibFile.right(4)==".bib") // strip extension { bibFile = bibFile.left(bibFile.length()-4); } else { if (!namesOnly && bibFile.right(4)!=".bib") bibFile += ".bib"; } if ((i=bibFile.findRev('/'))!=-1) // strip path { bibFile = bibFile.mid(i+1); } if (!bibFile.isEmpty()) { if (namesOnly) // bare names { result+=bibFile; } else // add quotes for paths with spaces { result+="\""+bibFile+"\""; } bibdata = citeDataList.next(); if (bibdata) { result+=sep; } } else { bibdata = citeDataList.next(); } } return result; }
//---------------------------------------------------------------------------- // strips w from s iff s starts with w static bool stripWord(QCString &s,QCString w) { bool success=FALSE; if (s.left(w.length())==w) { success=TRUE; s=s.right(s.length()-w.length()); } return success; }
void FileIn::setEncoding(QCString s) { if (s.left(3).lower() == "utf") { if (s.right(1) != "8") { UmlCom::trace("sorry, in the UTF encoding, only UTF-8 is managed"); throw 0; } else _utf8 = TRUE; } }
void LatexDocVisitor::visitPre(DocImage *img) { if (img->type()==DocImage::Latex) { if (m_hide) return; QCString gfxName = img->name(); if (gfxName.right(4)==".eps" || gfxName.right(4)==".pdf") { gfxName=gfxName.left(gfxName.length()-4); } visitPreStart(m_t,img->hasCaption(), gfxName, img->width(), img->height()); } else // other format -> skip { pushEnabled(); m_hide=TRUE; } }
static QCString stripPath(const QCString &s) { int i=s.findRev('/'); if (i!=-1) { return s.right(s.length()-i-1); } else { return s; } }
QCString DiagramItem::label() const { QCString result; if (!templSpec.isEmpty()) { // we use classDef->name() here and not diplayName() in order // to get the name used in the inheritance relation. QCString n = classDef->name(); if (n.right(2)=="-g" || n.right(2)=="-p") { n = n.left(n.length()-2); } result=insertTemplateSpecifierInScope(n,templSpec); } else { result=classDef->displayName(); } if (Config_getBool("HIDE_SCOPE_NAMES")) result=stripScope(result); return result; }
void Definition::writePathFragment(OutputList &ol) const { makeResident(); if (m_impl->outerScope && m_impl->outerScope!=Doxygen::globalScope) { m_impl->outerScope->writePathFragment(ol); } ol.writeString(" <li class=\"navelem\">"); if (isLinkable()) { if (definitionType()==Definition::TypeGroup && ((const GroupDef*)this)->groupTitle()) { ol.writeObjectLink(getReference(),getOutputFileBase(),0,((const GroupDef*)this)->groupTitle()); } else if (definitionType()==Definition::TypePage && !((const PageDef*)this)->title().isEmpty()) { ol.writeObjectLink(getReference(),getOutputFileBase(),0,((const PageDef*)this)->title()); } else if (definitionType()==Definition::TypeClass) { QCString name = m_impl->localName; if (name.right(2)=="-p" || name.right(2)=="-g") { name = name.left(name.length()-2); } ol.writeObjectLink(getReference(),getOutputFileBase(),0,name); } else { ol.writeObjectLink(getReference(),getOutputFileBase(),0,m_impl->localName); } } else { ol.startBold(); ol.docify(m_impl->localName); ol.endBold(); } ol.writeString(" </li>\n"); }
void LatexDocVisitor::visitPre(DocImage *img) { if (img->type()==DocImage::Latex) { if (m_hide) return; if (img->hasCaption()) { m_t << "\n\\begin{DoxyImage}\n"; } else { m_t << "\n\\begin{DoxyImageNoCaption}\n" " \\mbox{"; } QCString gfxName = img->name(); if (gfxName.right(4)==".eps" || gfxName.right(4)==".pdf") { gfxName=gfxName.left(gfxName.length()-4); } m_t << "\\includegraphics"; if (!img->width().isEmpty()) { m_t << "[width=" << img->width() << "]"; } else if (!img->height().isEmpty()) { m_t << "[height=" << img->height() << "]"; } m_t << "{" << gfxName << "}"; if (img->hasCaption()) { m_t << "\n\\caption{"; } } else // other format -> skip { pushEnabled(); m_hide=TRUE; } }
void DocbookDocVisitor::writePlantUMLFile(const QCString &baseName, DocVerbatim *s) { QCString shortName = baseName; int i; if ((i=shortName.findRev('/'))!=-1) { shortName=shortName.right(shortName.length()-i-1); } QCString outDir = Config_getString(DOCBOOK_OUTPUT); generatePlantUMLOutput(baseName,outDir,PUML_BITMAP); visitPreStart(m_t, s->hasCaption(), shortName, s->width(),s->height()); visitCaption(this, s->children()); visitPostEnd(m_t, s->hasCaption()); }
void DocbookDocVisitor::writeDiaFile(const QCString &baseName) { QCString shortName = baseName; int i; if ((i=shortName.findRev('/'))!=-1) { shortName=shortName.right(shortName.length()-i-1); } QCString outDir = Config_getString("DOCBOOK_OUTPUT"); writeDiaGraphFromFile(baseName+".dia",outDir,shortName,DIA_BITMAP); m_t << " <imagedata"; m_t << " align=\"center\" fileref=\"" << shortName << ".png" << "\">"; m_t << "</imagedata>" << endl; }
void LatexDocVisitor::writeDiaFile(const QCString &baseName, DocVerbatim *s) { QCString shortName = baseName; int i; if ((i=shortName.findRev('/'))!=-1) { shortName=shortName.right(shortName.length()-i-1); } QCString outDir = Config_getString("LATEX_OUTPUT"); writeDiaGraphFromFile(baseName+".dia",outDir,shortName,DIA_EPS); visitPreStart(m_t, s->hasCaption(), shortName, s->width(), s->height()); visitCaption(this, s->children()); visitPostEnd(m_t, s->hasCaption()); }
void DocbookDocVisitor::writeDotFile(const QCString &baseName, DocVerbatim *s) { QCString shortName = baseName; int i; if ((i=shortName.findRev('/'))!=-1) { shortName=shortName.right(shortName.length()-i-1); } QCString outDir = Config_getString(DOCBOOK_OUTPUT); writeDotGraphFromFile(baseName+".dot",outDir,shortName,GOF_BITMAP); visitPreStart(m_t, s->hasCaption(), baseName + ".dot", s->width(),s->height()); visitCaption(this, s->children()); visitPostEnd(m_t, s->hasCaption()); }
void DocbookDocVisitor::writeMscFile(const QCString &baseName) { QCString shortName = baseName; int i; if ((i=shortName.findRev('/'))!=-1) { shortName=shortName.right(shortName.length()-i-1); } QCString outDir = Config_getString("DOCBOOK_OUTPUT"); writeMscGraphFromFile(baseName+".msc",outDir,shortName,MSC_BITMAP); m_t << " <imagedata"; m_t << " width=\"50%\""; m_t << " align=\"center\" valign=\"middle\" scalefit=\"1\" fileref=\"" << shortName << ".png" << "\">"; m_t << "</imagedata>" << endl; }
void LatexDocVisitor::writeMscFile(const QCString &baseName) { QCString shortName = baseName; int i; if ((i=shortName.findRev('/'))!=-1) { shortName=shortName.right(shortName.length()-i-1); } QCString outDir = Config_getString("LATEX_OUTPUT"); writeMscGraphFromFile(baseName+".msc",outDir,shortName,MSC_EPS); m_t << "\n\\begin{DoxyImageNoCaption}" " \\mbox{\\includegraphics"; m_t << "{" << shortName << "}"; m_t << "}\n"; // end mbox m_t << "\\end{DoxyImageNoCaption}\n"; }
void DocbookDocVisitor::writeDotFile(const QCString &baseName) { QCString shortName = baseName; int i; if ((i=shortName.findRev('/'))!=-1) { shortName=shortName.right(shortName.length()-i-1); } QCString outDir = Config_getString("DOCBOOK_OUTPUT"); QCString imgExt = Config_getEnum("DOT_IMAGE_FORMAT"); writeDotGraphFromFile(baseName+".dot",outDir,shortName,GOF_BITMAP); m_t << " <imagedata"; //If no width is specified use default value for PDF rendering m_t << " width=\"50%\""; m_t << " align=\"center\" valign=\"middle\" scalefit=\"1\" fileref=\"" << shortName << "." << imgExt << "\">"; m_t << "</imagedata>" << endl; }
void DocSets::writeToken(FTextStream &t, const Definition *d, const QCString &type, const QCString &lang, const char *scope, const char *anchor, const char *decl) { t << " <Token>" << endl; t << " <TokenIdentifier>" << endl; QCString name = d->name(); if (name.right(2)=="-p") name=name.left(name.length()-2); t << " <Name>" << convertToXML(name) << "</Name>" << endl; if (!lang.isEmpty()) { t << " <APILanguage>" << lang << "</APILanguage>" << endl; } if (!type.isEmpty()) { t << " <Type>" << type << "</Type>" << endl; } if (scope) { t << " <Scope>" << convertToXML(scope) << "</Scope>" << endl; } t << " </TokenIdentifier>" << endl; t << " <Path>" << d->getOutputFileBase() << Doxygen::htmlFileExtension << "</Path>" << endl; if (anchor) { t << " <Anchor>" << anchor << "</Anchor>" << endl; } QCString tooltip = d->briefDescriptionAsTooltip(); if (!tooltip.isEmpty()) { t << " <Abstract>" << convertToXML(tooltip) << "</Abstract>" << endl; } if (decl) { t << " <DeclaredIn>" << convertToXML(decl) << "</DeclaredIn>" << endl; } t << " </Token>" << endl; }
void CiteDict::resolve() { QStrList &citeBibFiles = Config_getList("CITE_BIB_FILES"); if (citeBibFiles.count()==0 || m_entries.count()==0) return; // nothing to cite QCString &outputDirectory = Config_getString("OUTPUT_DIRECTORY"); if (outputDirectory.isEmpty()) { outputDirectory=QDir::currentDirPath(); } QDir d(outputDirectory); d.mkdir("bib"); uint pid = portable_pid(); m_baseFileName.sprintf("doxygen_bibtex_%d",pid); m_baseFileName.prepend(outputDirectory+"/bib/"); if (writeAux() && writeBst() && execute()) { parse(); clean(); } if (Config_getBool("GENERATE_LATEX")) { // copy bib files to the latex output dir QStrList &citeDataList = Config_getList("CITE_BIB_FILES"); QCString latexOutputDir = Config_getString("LATEX_OUTPUT")+"/"; const char *bibdata = citeDataList.first(); while (bibdata) { QCString bibFile = bibdata; if (!bibFile.isEmpty() && bibFile.right(4)!=".bib") bibFile+=".bib"; if (!bibFile.isEmpty()) { copyFile(bibFile,latexOutputDir+bibFile); } bibdata = citeDataList.next(); } } }
void startCodeBlock(int index) { int ll=strComment.length(); iCodeLen=inputString.findRev(strComment.data())+ll; // fprintf(stderr,"\n startin code..%d %d %d\n",iCodeLen,num_chars,ll); gBlock.reset(); int len=strComment.length(); QCString name=strComment.right(len-index);// name=VhdlDocGen::getIndexWord(name.data(),1); if (!name) gBlock.name="misc"+ VhdlDocGen::getRecordNumber(); else gBlock.name=name; gBlock.startLine=yyLineNr; gBlock.bodyLine=yyLineNr; strComment=strComment.left(index); VhdlDocGen::prepareComment(strComment); gBlock.brief+=strComment; }
void TooltipManager::addTooltip(Definition *d) { static bool sourceTooltips = Config_getBool(SOURCE_TOOLTIPS); if (!sourceTooltips) return; QCString id = d->getOutputFileBase(); int i=id.findRev('/'); if (i!=-1) { id = id.right(id.length()-i-1); // strip path (for CREATE_SUBDIRS=YES) } id+=escapeId(Doxygen::htmlFileExtension); QCString anc = d->anchor(); if (!anc.isEmpty()) { id+="_"+anc; } if (p->tooltipInfo.find(id)==0) { p->tooltipInfo.insert(id,d); } }
static QCString buildFileName(const char *name) { QCString fileName; if (name==0) return "noname"; const char *p=name; char c; while ((c=*p++)) { switch (c) { case ':': fileName+="_"; if (*p==':') p++; break; case '<': case '>': case '&': case '*': case '!': case '^': case '~': case '%': case '+': case '/': fileName+="_"; break; default: fileName+=c; } } QCString &manExtension = Config_getString("MAN_EXTENSION"); if (convertToQCString(fileName.right(2))!=manExtension) { fileName+=manExtension; } return fileName; }
static QCString buildFileName(const char *name) { QCString fileName; if (name==0) return "noname"; const char *p=name; char c; while ((c=*p++)) { switch (c) { case ':': fileName+="_"; if (*p==':') p++; break; case '<': case '>': case '&': case '*': case '!': case '^': case '~': case '%': case '+': case '/': fileName+="_"; break; default: fileName+=c; } } QCString manExtension = "." + getExtension(); if (fileName.right(manExtension.length())!=manExtension) { fileName+=manExtension; } return fileName; }
void CiteDict::generatePage() const { //printf("** CiteDict::generatePage() count=%d\n",m_ordering.count()); // do not generate an empty citations page if (isEmpty()) return; // nothing to cite // 1. generate file with markers and citations to OUTPUT_DIRECTORY QFile f; QCString outputDir = Config_getString("OUTPUT_DIRECTORY"); QCString citeListFile = outputDir+"/citelist.doc"; f.setName(citeListFile); if (!f.open(IO_WriteOnly)) { err("could not open file %s for writing\n",citeListFile.data()); } FTextStream t(&f); t << "<!-- BEGIN CITATIONS -->" << endl; t << "<!--" << endl; QDictIterator<CiteInfo> it(m_entries); CiteInfo *ci; for (it.toFirst();(ci=it.current());++it) { t << "\\citation{" << ci->label << "}" << endl; } t << "-->" << endl; t << "<!-- END CITATIONS -->" << endl; t << "<!-- BEGIN BIBLIOGRAPHY -->" << endl; t << "<!-- END BIBLIOGRAPHY -->" << endl; f.close(); // 2. generate bib2xhtml QCString bib2xhtmlFile = outputDir+"/bib2xhtml.pl"; f.setName(bib2xhtmlFile); QCString bib2xhtml = bib2xhtml_pl; if (!f.open(IO_WriteOnly)) { err("could not open file %s for writing\n",bib2xhtmlFile.data()); } f.writeBlock(bib2xhtml, bib2xhtml.length()); f.close(); // 3. generate doxygen.bst QCString doxygenBstFile = outputDir+"/doxygen.bst"; QCString bstData = doxygen_bst; f.setName(doxygenBstFile); if (!f.open(IO_WriteOnly)) { err("could not open file %s for writing\n",doxygenBstFile.data()); } f.writeBlock(bstData, bstData.length()); f.close(); // 4. for html we just copy the bib files to the output so that // bibtex can find them without path (bibtex doesn't support path's // with spaces!) QList<QCString> tempFiles; tempFiles.setAutoDelete(TRUE); QDir thisDir; if (Config_getBool("GENERATE_HTML")) { // copy bib files to the latex output dir QStrList &citeDataList = Config_getList("CITE_BIB_FILES"); QCString bibOutputDir = outputDir+"/"; QFileInfo fo(bibOutputDir); const char *bibdata = citeDataList.first(); while (bibdata) { QCString bibFile = bibdata; if (!bibFile.isEmpty() && bibFile.right(4)!=".bib") bibFile+=".bib"; QFileInfo fi(bibFile); if (fi.exists() && fi.dirPath(TRUE)!=fo.absFilePath()) { if (!bibFile.isEmpty()) { QCString destFile=bibOutputDir+fi.fileName().data(); copyFile(bibFile,destFile); tempFiles.append(new QCString(destFile)); } } else if (!fi.exists()) { err("bib file %s not found!\n",bibFile.data()); } bibdata = citeDataList.next(); } } QCString oldDir = QDir::currentDirPath().utf8(); QDir::setCurrent(outputDir); // 5. run bib2xhtml perl script on the generated file which will insert the // bibliography in citelist.doc portable_system("perl","\""+bib2xhtmlFile+"\" "+getListOfBibFiles(" ",FALSE)+" \""+ citeListFile+"\""); QDir::setCurrent(oldDir); // 6. read back the file f.setName(citeListFile); if (!f.open(IO_ReadOnly)) { err("could not open file %s/citelist.doc for reading\n",outputDir.data()); } bool insideBib=FALSE; QCString doc; QFileInfo fi(citeListFile); QCString input(fi.size()+1); f.readBlock(input.data(),fi.size()); f.close(); input.at(fi.size())='\0'; int p=0,s; //printf("input=[%s]\n",input.data()); while ((s=input.find('\n',p))!=-1) { QCString line = input.mid(p,s-p); //printf("p=%d s=%d line=[%s]\n",p,s,line.data()); p=s+1; if (line.find("<!-- BEGIN BIBLIOGRAPHY")!=-1) insideBib=TRUE; else if (line.find("<!-- END BIBLIOGRAPH")!=-1) insideBib=FALSE; else if (insideBib) doc+=line+"\n"; int i; // determine text to use at the location of the @cite command if (insideBib && (i=line.find("<a name=\"CITEREF_"))!=-1) { int j=line.find("\">["); int k=line.find("]</a>"); if (j!=-1 && k!=-1) { QCString label = line.mid(i+17,j-i-17); QCString number = line.mid(j+2,k-j-1); CiteInfo *ci = m_entries.find(label); //printf("label='%s' number='%s' => %p\n",label.data(),number.data(),ci); if (ci) { ci->text = number; } } } } //printf("doc=[%s]\n",doc.data()); // 7. add it as a page addRelatedPage(CiteConsts::fileName, theTranslator->trCiteReferences(),doc,0,CiteConsts::fileName,1,0,0,0); // 8. for latex we just copy the bib files to the output and let // latex do this work. if (Config_getBool("GENERATE_LATEX")) { // copy bib files to the latex output dir QStrList &citeDataList = Config_getList("CITE_BIB_FILES"); QCString latexOutputDir = Config_getString("LATEX_OUTPUT")+"/"; const char *bibdata = citeDataList.first(); while (bibdata) { QCString bibFile = bibdata; if (!bibFile.isEmpty() && bibFile.right(4)!=".bib") bibFile+=".bib"; QFileInfo fi(bibFile); if (fi.exists()) { if (!bibFile.isEmpty()) { copyFile(bibFile,latexOutputDir+fi.fileName().data()); } } else { err("bib file %s not found!\n",bibFile.data()); } bibdata = citeDataList.next(); } } // 9. Remove temporary files thisDir.remove(citeListFile); thisDir.remove(doxygenBstFile); thisDir.remove(bib2xhtmlFile); while (!tempFiles.isEmpty()) { QCString *s=tempFiles.take(0); thisDir.remove(*s); } }